Files
nixpkgs/pkgs/development/python-modules/warp-lang/standalone-llvm.patch
Zexin Yuan 780f0f46f5 python3Packages.warp-lang: 1.7.2.post1 -> 1.8.0
python3Packages.warp-lang: 1.7.2.post1 -> 1.8.0
2025-07-06 09:52:22 +08:00

63 lines
3.0 KiB
Diff

diff --git a/build_llvm.py b/build_llvm.py
index aee0a9f1..6b9806c9 100644
--- a/build_llvm.py
+++ b/build_llvm.py
@@ -350,25 +350,19 @@ 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")
-
+ # obtain Clang and LLVM libraries from the local build
libs = []
-
- for _, _, libraries in os.walk(libpath):
- libs.extend(libraries)
- break # just the top level contains library files
+ install_paths = ["@LLVM_LIB@", "@LIBCLANG_LIB@"]
+ libpaths = [os.path.join(install_path, "lib") for install_path in install_paths]
+ for libpath in libpaths:
+ for _, _, libraries in os.walk(libpath):
+ libs.extend(libraries)
+ break # just the top level contains library files
if os.name == "nt":
libs.append("Version.lib")
libs.append("Ws2_32.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"]
if sys.platform == "darwin":
@@ -376,7 +370,8 @@ def build_warp_clang_for_arch(args, lib_name: str, arch: str) -> None:
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":
diff --git a/warp/build_dll.py b/warp/build_dll.py
index 2218ff13..3fcf5796 100644
--- a/warp/build_dll.py
+++ b/warp/build_dll.py
@@ -404,8 +404,8 @@ def build_dll_for_arch(args, dll_path, cpp_paths, cu_path, arch, libs: Optional[
cuda_compiler = "clang++" if getattr(args, "clang_build_toolchain", False) else "nvcc"
cpp_compiler = "clang++" if getattr(args, "clang_build_toolchain", False) else "g++"
- cpp_includes = f' -I"{warp_home_path.parent}/external/llvm-project/out/install/{mode}-{arch}/include"'
- cpp_includes += f' -I"{warp_home_path.parent}/_build/host-deps/llvm-project/release-{arch}/include"'
+ cpp_includes = ' -I"@LLVM_DEV@/include"'
+ cpp_includes += ' -I"@LIBCLANG_DEV@/include"'
cuda_includes = f' -I"{cuda_home}/include"' if cu_path else ""
includes = cpp_includes + cuda_includes