Skip to content

Commit d6e69c3

Browse files
committed
Add windows installation instructions
1 parent 3f01c95 commit d6e69c3

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

setup.py

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,17 @@ def build_extension(self, ext):
5757
ext.libraries = ["isal"]
5858
else:
5959
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")]
6067
ext.include_dirs = [os.path.join(isa_l_prefix_dir,
6168
"include")]
6269
# -fPIC needed for proper static linking
6370
ext.extra_compile_args = ["-fPIC"]
64-
ext.extra_objects = [
65-
os.path.join(isa_l_prefix_dir, "lib", "libisal.a")]
6671

6772
if os.getenv("CYTHON_COVERAGE") is not None:
6873
# Import cython here so python setup.py can be used without
@@ -102,13 +107,19 @@ def build_isa_l():
102107
else: # sched_getaffinity not available on all platforms
103108
cpu_count = os.cpu_count() or 1 # os.cpu_count() can return None
104109
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}")
112123
return temp_prefix
113124

114125

0 commit comments

Comments
 (0)