Skip to content

Commit c4c8917

Browse files
committed
make sure same compiler and options are used for isa-l as the extension
This allows the -O2 flags etc. to be set. Which are set by default compiling the extension
1 parent c9abb83 commit c4c8917

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ def build_extension(self, ext):
7676
raise NotImplementedError(
7777
f"Unsupported platform: {sys.platform}")
7878
else:
79-
isa_l_prefix_dir = build_isa_l()
79+
isa_l_prefix_dir = build_isa_l(" ".join(self.compiler.compiler))
8080
if SYSTEM_IS_UNIX:
8181
ext.extra_objects = [
8282
os.path.join(isa_l_prefix_dir, "lib", "libisal.a")]
@@ -113,7 +113,7 @@ def build_extension(self, ext):
113113
# 'cache' is only available from python 3.9 onwards.
114114
# see: https://docs.python.org/3/library/functools.html#functools.cache
115115
@functools.lru_cache(maxsize=None)
116-
def build_isa_l():
116+
def build_isa_l(compiler):
117117
# Creating temporary directories
118118
build_dir = tempfile.mktemp()
119119
temp_prefix = tempfile.mkdtemp()
@@ -123,7 +123,7 @@ def build_isa_l():
123123
# it.
124124
build_env = os.environ.copy()
125125
# Add -fPIC flag to allow static compilation
126-
build_env["CFLAGS"] = build_env.get("CFLAGS", "") + " -fPIC"
126+
build_env["CC"] = compiler + " -fPIC"
127127
if hasattr(os, "sched_getaffinity"):
128128
cpu_count = len(os.sched_getaffinity(0))
129129
else: # sched_getaffinity not available on all platforms

0 commit comments

Comments
 (0)