@@ -57,12 +57,17 @@ def build_extension(self, ext):
57
57
ext .libraries = ["isal" ]
58
58
else :
59
59
isa_l_prefix_dir = build_isa_l ()
60
+ if (sys .platform .startswith ("linux" ) or
61
+ sys .platform .startswith ("darwin" )):
62
+ ext .extra_objects = [
63
+ os .path .join (isa_l_prefix_dir , "lib" , "libisal.a" )]
64
+ elif sys .platform .startswith ("win" ):
65
+ ext .extra_objects = [
66
+ os .path .join (isa_l_prefix_dir , "isa-l_static.lib" )]
60
67
ext .include_dirs = [os .path .join (isa_l_prefix_dir ,
61
68
"include" )]
62
69
# -fPIC needed for proper static linking
63
70
ext .extra_compile_args = ["-fPIC" ]
64
- ext .extra_objects = [
65
- os .path .join (isa_l_prefix_dir , "lib" , "libisal.a" )]
66
71
67
72
if os .getenv ("CYTHON_COVERAGE" ) is not None :
68
73
# Import cython here so python setup.py can be used without
@@ -102,13 +107,19 @@ def build_isa_l():
102
107
else : # sched_getaffinity not available on all platforms
103
108
cpu_count = os .cpu_count () or 1 # os.cpu_count() can return None
104
109
run_args = dict (cwd = build_dir , env = build_env )
105
- subprocess .run (os .path .join (build_dir , "autogen.sh" ), ** run_args )
106
- subprocess .run ([os .path .join (build_dir , "configure" ),
107
- "--prefix" , temp_prefix ], ** run_args )
108
- subprocess .run (["make" , "-j" , str (cpu_count )],
109
- ** run_args )
110
- subprocess .run (["make" , "install" ], ** run_args )
111
- shutil .rmtree (build_dir )
110
+ if sys .platform .startswith ("linux" ) or sys .platform .startswith ("darwin" ):
111
+ subprocess .run (os .path .join (build_dir , "autogen.sh" ), ** run_args )
112
+ subprocess .run ([os .path .join (build_dir , "configure" ),
113
+ "--prefix" , temp_prefix ], ** run_args )
114
+ subprocess .run (["make" , "-j" , str (cpu_count )],
115
+ ** run_args )
116
+ subprocess .run (["make" , "install" ], ** run_args )
117
+ shutil .rmtree (build_dir )
118
+ elif sys .platform .startswith ("win" ):
119
+ subprocess .run (["nmake" , "/f" , "Makefile.nmake" ], ** run_args )
120
+ temp_prefix = build_dir
121
+ else :
122
+ raise NotImplementedError (f"Unsupported platform: { sys .platform } " )
112
123
return temp_prefix
113
124
114
125
0 commit comments