From 2751c5de5c61c90b56e3e392a41847f4c47258fd Mon Sep 17 00:00:00 2001 From: SomeoneSerge Date: Sun, 13 Oct 2024 14:16:48 +0000 Subject: [PATCH 1/3] _build: allow extra cc flags --- python/triton/runtime/build.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/python/triton/runtime/build.py b/python/triton/runtime/build.py index d7baeb286..d334dce77 100644 --- a/python/triton/runtime/build.py +++ b/python/triton/runtime/build.py @@ -42,9 +42,17 @@ def _build(name, src, srcdir, library_dirs, include_dirs, libraries): py_include_dir = sysconfig.get_paths(scheme=scheme)["include"] include_dirs = include_dirs + [srcdir, py_include_dir] cc_cmd = [cc, src, "-O3", "-shared", "-fPIC", "-o", so] + + # Nixpkgs support branch + # Allows passing e.g. extra -Wl,-rpath + cc_cmd_extra_flags = "@ccCmdExtraFlags@" + if cc_cmd_extra_flags != ("@" + "ccCmdExtraFlags@"): # substituteAll hack + import shlex + cc_cmd.extend(shlex.split(cc_cmd_extra_flags)) + cc_cmd += [f'-l{lib}' for lib in libraries] cc_cmd += [f"-L{dir}" for dir in library_dirs] - cc_cmd += [f"-I{dir}" for dir in include_dirs] + cc_cmd += [f"-I{dir}" for dir in include_dirs if dir is not None] ret = subprocess.check_call(cc_cmd) if ret == 0: return so -- 2.46.0