@@ -72,19 +72,7 @@ def build_extension(self, ext):
72
72
raise NotImplementedError (
73
73
f"Unsupported platform: { sys .platform } " )
74
74
else :
75
- if self .compiler .compiler_type == "msvc" :
76
- compiler = copy .deepcopy (self .compiler )
77
- if not compiler .initialized :
78
- compiler .initialize ()
79
- compiler_command = f'"{ compiler .cc } "'
80
- compiler_args = compiler .compile_options
81
- elif self .compiler .compiler_type == "unix" :
82
- compiler_command = self .compiler .compiler [0 ]
83
- compiler_args = self .compiler .compiler [1 :]
84
- else :
85
- raise NotImplementedError ("Unknown compiler" )
86
- isa_l_prefix_dir = build_isa_l (compiler_command ,
87
- " " .join (compiler_args ))
75
+ isa_l_prefix_dir = build_isa_l ()
88
76
if SYSTEM_IS_UNIX :
89
77
ext .extra_objects = [
90
78
os .path .join (isa_l_prefix_dir , "lib" , "libisal.a" )]
@@ -106,7 +94,7 @@ def build_extension(self, ext):
106
94
# 'cache' is only available from python 3.9 onwards.
107
95
# see: https://docs.python.org/3/library/functools.html#functools.cache
108
96
@functools .lru_cache (maxsize = None )
109
- def build_isa_l (compiler_command : str , compiler_options : str ):
97
+ def build_isa_l ():
110
98
# Check for cache
111
99
if BUILD_CACHE :
112
100
if BUILD_CACHE_FILE .exists ():
@@ -122,14 +110,8 @@ def build_isa_l(compiler_command: str, compiler_options: str):
122
110
# Build environment is a copy of OS environment to allow user to influence
123
111
# it.
124
112
build_env = os .environ .copy ()
125
- # Add -fPIC flag to allow static compilation
126
- build_env ["CC" ] = compiler_command
127
113
if SYSTEM_IS_UNIX :
128
- build_env ["CFLAGS" ] = compiler_options + " -fPIC"
129
- elif SYSTEM_IS_WINDOWS :
130
- # The nmake file has CLFAGS_REL for all the compiler options.
131
- # This is added to CFLAGS with all the necessary include options.
132
- build_env ["CFLAGS_REL" ] = compiler_options
114
+ build_env ["CFLAGS" ] = build_env .get ("CFLAGS" , "" ) + " -O2 -fPIC"
133
115
if hasattr (os , "sched_getaffinity" ):
134
116
cpu_count = len (os .sched_getaffinity (0 ))
135
117
else : # sched_getaffinity not available on all platforms
0 commit comments