Skip to content

Commit efc3921

Browse files
committed
only copy ol files if they exist, to avoid complex logic
1 parent fe37339 commit efc3921

File tree

1 file changed

+34
-32
lines changed

1 file changed

+34
-32
lines changed

src/bootstrap/src/core/build_steps/compile.rs

Lines changed: 34 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2230,40 +2230,42 @@ impl Step for Assemble {
22302230
let src_lib = src_dir.join(&libenzyme).with_extension(lib_ext);
22312231
let dst_lib = libdir.join(&libenzyme).with_extension(lib_ext);
22322232
let target_dst_lib = target_libdir.join(&libenzyme).with_extension(lib_ext);
2233-
builder.resolve_symlink_and_copy(&src_lib, &dst_lib);
2234-
builder.resolve_symlink_and_copy(&src_lib, &target_dst_lib);
2235-
2236-
// FIXME(offload): With LLVM-22, we should be able to drop everything below here.
2237-
let omp = format!("libomp");
2238-
let src_omp = src_dir.join(&omp).with_extension(lib_ext);
2239-
let dst_omp_lib = libdir.join(&omp).with_extension(lib_ext);
2240-
let target_omp_dst_lib = target_libdir.join(&omp).with_extension(lib_ext);
2241-
builder.resolve_symlink_and_copy(&src_omp, &dst_omp_lib);
2242-
builder.resolve_symlink_and_copy(&src_omp, &target_omp_dst_lib);
2243-
2244-
let tgt = format!("libomptarget");
2245-
let src_tgt = src_dir.join(&tgt).with_extension(lib_ext);
2246-
let dst_tgt_lib = libdir.join(&tgt).with_extension(lib_ext);
2247-
let target_tgt_dst_lib = target_libdir.join(&tgt).with_extension(lib_ext);
2248-
builder.resolve_symlink_and_copy(&src_tgt, &dst_tgt_lib);
2249-
builder.resolve_symlink_and_copy(&src_tgt, &target_tgt_dst_lib);
2250-
2251-
// The last one is slightly more tricky, since we have the same file twice, in two
2252-
// subfolders for amdgcn and nvptx64. We'll likely find two more in the future, once
2253-
// Intel and Spir-V support lands in offload.
2254-
let gpu_tgts = ["amdgcn-amd-amdhsa", "nvptx64-nvidia-cuda"];
2255-
let device = format!("libompdevice.a");
2256-
for tgt in gpu_tgts {
2257-
let dst_tgt_dir = libdir.join(&tgt);
2258-
let target_tgt_dst_dir = target_libdir.join(&tgt);
2259-
t!(fs::create_dir_all(&dst_tgt_dir));
2260-
t!(fs::create_dir_all(&target_tgt_dst_dir));
2261-
let dst_tgt_lib = dst_tgt_dir.join(&device);
2262-
let target_tgt_dst_lib = target_tgt_dst_dir.join(&device);
2233+
if src_lib.exists() {
2234+
builder.resolve_symlink_and_copy(&src_lib, &dst_lib);
2235+
builder.resolve_symlink_and_copy(&src_lib, &target_dst_lib);
2236+
2237+
// FIXME(offload): With LLVM-22, we should be able to drop everything below here.
2238+
let omp = format!("libomp");
2239+
let src_omp = src_dir.join(&omp).with_extension(lib_ext);
2240+
let dst_omp_lib = libdir.join(&omp).with_extension(lib_ext);
2241+
let target_omp_dst_lib = target_libdir.join(&omp).with_extension(lib_ext);
2242+
builder.resolve_symlink_and_copy(&src_omp, &dst_omp_lib);
2243+
builder.resolve_symlink_and_copy(&src_omp, &target_omp_dst_lib);
2244+
2245+
let tgt = format!("libomptarget");
2246+
let src_tgt = src_dir.join(&tgt).with_extension(lib_ext);
2247+
let dst_tgt_lib = libdir.join(&tgt).with_extension(lib_ext);
2248+
let target_tgt_dst_lib = target_libdir.join(&tgt).with_extension(lib_ext);
22632249
builder.resolve_symlink_and_copy(&src_tgt, &dst_tgt_lib);
22642250
builder.resolve_symlink_and_copy(&src_tgt, &target_tgt_dst_lib);
2265-
// FIXME(offload): copy the files within the directories as well, but figure out
2266-
// the naming scheme before.
2251+
2252+
// The last one is slightly more tricky, since we have the same file twice, in two
2253+
// subfolders for amdgcn and nvptx64. We'll likely find two more in the future, once
2254+
// Intel and Spir-V support lands in offload.
2255+
let gpu_tgts = ["amdgcn-amd-amdhsa", "nvptx64-nvidia-cuda"];
2256+
let device = format!("libompdevice.a");
2257+
for tgt in gpu_tgts {
2258+
let dst_tgt_dir = libdir.join(&tgt);
2259+
let target_tgt_dst_dir = target_libdir.join(&tgt);
2260+
t!(fs::create_dir_all(&dst_tgt_dir));
2261+
t!(fs::create_dir_all(&target_tgt_dst_dir));
2262+
let dst_tgt_lib = dst_tgt_dir.join(&device);
2263+
let target_tgt_dst_lib = target_tgt_dst_dir.join(&device);
2264+
builder.resolve_symlink_and_copy(&src_tgt, &dst_tgt_lib);
2265+
builder.resolve_symlink_and_copy(&src_tgt, &target_tgt_dst_lib);
2266+
// FIXME(offload): copy the files within the directories as well, but figure out
2267+
// the naming scheme before.
2268+
}
22672269
}
22682270
}
22692271
}

0 commit comments

Comments
 (0)