@@ -71,20 +71,17 @@ def build_extension(self, ext):
71
71
raise NotImplementedError (
72
72
f"Unsupported platform: { sys .platform } " )
73
73
else :
74
- isa_l_prefix_dir = build_isa_l ()
74
+ isa_l_build_dir = build_isa_l ()
75
75
if SYSTEM_IS_UNIX :
76
76
ext .extra_objects = [
77
- os .path .join (isa_l_prefix_dir , "lib " , "libisal.a" )]
77
+ os .path .join (isa_l_build_dir , ".libs " , "libisal.a" )]
78
78
elif SYSTEM_IS_WINDOWS :
79
79
ext .extra_objects = [
80
- os .path .join (isa_l_prefix_dir , "isa-l_static.lib" )]
80
+ os .path .join (isa_l_build_dir , "isa-l_static.lib" )]
81
81
else :
82
82
raise NotImplementedError (
83
83
f"Unsupported platform: { sys .platform } " )
84
- ext .include_dirs = [os .path .join (isa_l_prefix_dir ,
85
- "include" )]
86
- # -fPIC needed for proper static linking
87
- ext .extra_compile_args = ["-fPIC" ]
84
+ ext .include_dirs = [isa_l_build_dir ]
88
85
super ().build_extension (ext )
89
86
90
87
@@ -98,12 +95,11 @@ def build_isa_l():
98
95
if BUILD_CACHE :
99
96
if BUILD_CACHE_FILE .exists ():
100
97
cache_path = Path (BUILD_CACHE_FILE .read_text ())
101
- if (cache_path / "include" / " isa-l" ).exists ():
98
+ if (cache_path / "isa-l.h " ).exists ():
102
99
return str (cache_path )
103
100
104
101
# Creating temporary directories
105
102
build_dir = tempfile .mktemp ()
106
- temp_prefix = tempfile .mkdtemp ()
107
103
shutil .copytree (ISA_L_SOURCE , build_dir )
108
104
109
105
# Build environment is a copy of OS environment to allow user to influence
@@ -118,27 +114,17 @@ def build_isa_l():
118
114
run_args = dict (cwd = build_dir , env = build_env )
119
115
if SYSTEM_IS_UNIX :
120
116
subprocess .run (os .path .join (build_dir , "autogen.sh" ), ** run_args )
121
- subprocess .run ([os .path .join (build_dir , "configure" ),
122
- "--prefix" , temp_prefix ], ** run_args )
117
+ subprocess .run ([os .path .join (build_dir , "configure" )], ** run_args )
123
118
subprocess .run (["make" , "-j" , str (cpu_count )], ** run_args )
124
- subprocess .run (["make" , "-j" , str (cpu_count ), "install" ], ** run_args )
125
119
elif SYSTEM_IS_WINDOWS :
126
- print (build_env , file = sys .stderr )
127
120
subprocess .run (["nmake" , "/f" , "Makefile.nmake" ], ** run_args )
128
- Path (temp_prefix , "include" ).mkdir ()
129
- print (temp_prefix , file = sys .stderr )
130
- shutil .copytree (os .path .join (build_dir , "include" ),
131
- Path (temp_prefix , "include" , "isa-l" ))
132
- shutil .copy (os .path .join (build_dir , "isa-l_static.lib" ),
133
- os .path .join (temp_prefix , "isa-l_static.lib" ))
134
- shutil .copy (os .path .join (build_dir , "isa-l.h" ),
135
- os .path .join (temp_prefix , "include" , "isa-l.h" ))
136
121
else :
137
122
raise NotImplementedError (f"Unsupported platform: { sys .platform } " )
138
- shutil .rmtree (build_dir )
123
+ shutil .copytree (os .path .join (build_dir , "include" ),
124
+ os .path .join (build_dir , "isa-l" ))
139
125
if BUILD_CACHE :
140
- BUILD_CACHE_FILE .write_text (temp_prefix )
141
- return temp_prefix
126
+ BUILD_CACHE_FILE .write_text (build_dir )
127
+ return build_dir
142
128
143
129
144
130
setup (
0 commit comments