diff --git a/build_llvm.py b/build_llvm.py index 1aa8631a..2304ce1f 100644 --- a/build_llvm.py +++ b/build_llvm.py @@ -346,34 +346,24 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None: clang_dll_path = os.path.join(build_path, f"bin/{lib_name}") - if args.build_llvm: - # obtain Clang and LLVM libraries from the local build - install_path = os.path.join(llvm_install_path, f"{args.mode}-{arch}") - libpath = os.path.join(install_path, "lib") - else: - # obtain Clang and LLVM libraries from packman - fetch_prebuilt_libraries(arch) - libpath = os.path.join(base_path, f"_build/host-deps/llvm-project/release-{arch}/lib") - - libs = [] - - for _, _, libraries in os.walk(libpath): - libs.extend(libraries) - break # just the top level contains library files + libs = ["LLVM", "clang-cpp"] + install_paths = ["@LLVM_LIB@", "@LIBCLANG_LIB@"] + libpaths = [os.path.join(install_path, "lib") for install_path in install_paths] if os.name == "nt": libs.append("Version.lib") libs.append("Ws2_32.lib") libs.append("ntdll.lib") - libs.append(f'/LIBPATH:"{libpath}"') + libs.extend(f'/LIBPATH:"{libpath}"' for libpath in libpaths) else: - libs = [f"-l{lib[3:-2]}" for lib in libs if os.path.splitext(lib)[1] == ".a"] + libs = [f"-l{lib}" for lib in libs] if sys.platform == "darwin": libs += libs # prevents unresolved symbols due to link order else: libs.insert(0, "-Wl,--start-group") libs.append("-Wl,--end-group") - libs.append(f"-L{libpath}") + libs.extend(f"-L{libpath}" for libpath in libpaths) + libs.append("-lz") libs.append("-lpthread") libs.append("-ldl") if sys.platform != "darwin":