@@ -2309,40 +2309,42 @@ impl Step for Assemble {
23092309 let src_lib = src_dir. join ( & libenzyme) . with_extension ( lib_ext) ;
23102310 let dst_lib = libdir. join ( & libenzyme) . with_extension ( lib_ext) ;
23112311 let target_dst_lib = target_libdir. join ( & libenzyme) . with_extension ( lib_ext) ;
2312- builder. resolve_symlink_and_copy ( & src_lib, & dst_lib) ;
2313- builder. resolve_symlink_and_copy ( & src_lib, & target_dst_lib) ;
2314-
2315- // FIXME(offload): With LLVM-22, we should be able to drop everything below here.
2316- let omp = format ! ( "libomp" ) ;
2317- let src_omp = src_dir. join ( & omp) . with_extension ( lib_ext) ;
2318- let dst_omp_lib = libdir. join ( & omp) . with_extension ( lib_ext) ;
2319- let target_omp_dst_lib = target_libdir. join ( & omp) . with_extension ( lib_ext) ;
2320- builder. resolve_symlink_and_copy ( & src_omp, & dst_omp_lib) ;
2321- builder. resolve_symlink_and_copy ( & src_omp, & target_omp_dst_lib) ;
2322-
2323- let tgt = format ! ( "libomptarget" ) ;
2324- let src_tgt = src_dir. join ( & tgt) . with_extension ( lib_ext) ;
2325- let dst_tgt_lib = libdir. join ( & tgt) . with_extension ( lib_ext) ;
2326- let target_tgt_dst_lib = target_libdir. join ( & tgt) . with_extension ( lib_ext) ;
2327- builder. resolve_symlink_and_copy ( & src_tgt, & dst_tgt_lib) ;
2328- builder. resolve_symlink_and_copy ( & src_tgt, & target_tgt_dst_lib) ;
2329-
2330- // The last one is slightly more tricky, since we have the same file twice, in two
2331- // subfolders for amdgcn and nvptx64. We'll likely find two more in the future, once
2332- // Intel and Spir-V support lands in offload.
2333- let gpu_tgts = [ "amdgcn-amd-amdhsa" , "nvptx64-nvidia-cuda" ] ;
2334- let device = format ! ( "libompdevice.a" ) ;
2335- for tgt in gpu_tgts {
2336- let dst_tgt_dir = libdir. join ( & tgt) ;
2337- let target_tgt_dst_dir = target_libdir. join ( & tgt) ;
2338- t ! ( fs:: create_dir_all( & dst_tgt_dir) ) ;
2339- t ! ( fs:: create_dir_all( & target_tgt_dst_dir) ) ;
2340- let dst_tgt_lib = dst_tgt_dir. join ( & device) ;
2341- let target_tgt_dst_lib = target_tgt_dst_dir. join ( & device) ;
2312+ if src_lib. exists ( ) {
2313+ builder. resolve_symlink_and_copy ( & src_lib, & dst_lib) ;
2314+ builder. resolve_symlink_and_copy ( & src_lib, & target_dst_lib) ;
2315+
2316+ // FIXME(offload): With LLVM-22, we should be able to drop everything below here.
2317+ let omp = format ! ( "libomp" ) ;
2318+ let src_omp = src_dir. join ( & omp) . with_extension ( lib_ext) ;
2319+ let dst_omp_lib = libdir. join ( & omp) . with_extension ( lib_ext) ;
2320+ let target_omp_dst_lib = target_libdir. join ( & omp) . with_extension ( lib_ext) ;
2321+ builder. resolve_symlink_and_copy ( & src_omp, & dst_omp_lib) ;
2322+ builder. resolve_symlink_and_copy ( & src_omp, & target_omp_dst_lib) ;
2323+
2324+ let tgt = format ! ( "libomptarget" ) ;
2325+ let src_tgt = src_dir. join ( & tgt) . with_extension ( lib_ext) ;
2326+ let dst_tgt_lib = libdir. join ( & tgt) . with_extension ( lib_ext) ;
2327+ let target_tgt_dst_lib = target_libdir. join ( & tgt) . with_extension ( lib_ext) ;
23422328 builder. resolve_symlink_and_copy ( & src_tgt, & dst_tgt_lib) ;
23432329 builder. resolve_symlink_and_copy ( & src_tgt, & target_tgt_dst_lib) ;
2344- // FIXME(offload): copy the files within the directories as well, but figure out
2345- // the naming scheme before.
2330+
2331+ // The last one is slightly more tricky, since we have the same file twice, in two
2332+ // subfolders for amdgcn and nvptx64. We'll likely find two more in the future, once
2333+ // Intel and Spir-V support lands in offload.
2334+ let gpu_tgts = [ "amdgcn-amd-amdhsa" , "nvptx64-nvidia-cuda" ] ;
2335+ let device = format ! ( "libompdevice.a" ) ;
2336+ for tgt in gpu_tgts {
2337+ let dst_tgt_dir = libdir. join ( & tgt) ;
2338+ let target_tgt_dst_dir = target_libdir. join ( & tgt) ;
2339+ t ! ( fs:: create_dir_all( & dst_tgt_dir) ) ;
2340+ t ! ( fs:: create_dir_all( & target_tgt_dst_dir) ) ;
2341+ let dst_tgt_lib = dst_tgt_dir. join ( & device) ;
2342+ let target_tgt_dst_lib = target_tgt_dst_dir. join ( & device) ;
2343+ builder. resolve_symlink_and_copy ( & src_tgt, & dst_tgt_lib) ;
2344+ builder. resolve_symlink_and_copy ( & src_tgt, & target_tgt_dst_lib) ;
2345+ // FIXME(offload): copy the files within the directories as well, but figure out
2346+ // the naming scheme before.
2347+ }
23462348 }
23472349 }
23482350 }
0 commit comments