Skip to content

Commit

Permalink
it should build properly on mac now?
Browse files Browse the repository at this point in the history
  • Loading branch information
flaport committed Nov 12, 2024
1 parent bcafd38 commit d04d689
Showing 1 changed file with 11 additions and 19 deletions.
30 changes: 11 additions & 19 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,8 @@
]


extensions = {}
if sys.platform == "linux":
extensions["klujax"] = Extension(
if sys.platform == "linux": # gcc
extension = Extension(
name="klujax_cpp",
sources=["klujax.cpp", *suitesparse_sources],
include_dirs=include_dirs,
Expand All @@ -40,8 +39,8 @@
extra_link_args=["-static-libgcc", "-static-libstdc++"],
language="c++",
)
elif sys.platform == "win32":
extensions["klujax"] = Extension(
elif sys.platform == "win32": # cl
extension = Extension(
name="klujax_cpp",
sources=["klujax.cpp", *suitesparse_sources],
include_dirs=include_dirs,
Expand All @@ -50,25 +49,18 @@
extra_link_args=[],
language="c++",
)
elif sys.platform == "darwin": # MacOS
extensions["klujax"] = Extension(
elif sys.platform == "darwin": # MacOS: clang
extension = Extension(
name="klujax_cpp",
sources=["klujax.cpp"],
sources=["klujax.cpp", *suitesparse_sources],
include_dirs=include_dirs,
library_dirs=site.getsitepackages(),
extra_compile_args=["-std=c++17"],
extra_compile_args=[], # clang defaults to c++17 and setting -std=c++17 prevents combined build with suitesparse c source.
extra_link_args=[],
language="c++",
)
extensions["klujax_ss"] = Extension(
name="klujax_ss",
sources=suitesparse_sources,
include_dirs=include_dirs,
library_dirs=site.getsitepackages(),
extra_compile_args=[],
extra_link_args=[],
language="c",
)
else:
raise RuntimError(f"Platform {sys.platform} not supported.")


setup(
Expand All @@ -81,7 +73,7 @@
long_description_content_type="text/markdown",
url="https://github.com/flaport/klujax",
py_modules=["klujax"],
ext_modules=list(extensions.values()),
ext_modules=[extension],
cmdclass={"build_ext": build_ext},
install_requires=["jax>=0.4.35", "jaxlib>=0.4.35"],
python_requires=">=3.8",
Expand Down

0 comments on commit d04d689

Please sign in to comment.