Skip to content

Commit

Permalink
Fix SuiteSparse build (#2375)
Browse files Browse the repository at this point in the history
* Only build static suitesparse libs, but position-independent
* Make CMake prefer the vendored libraries over any system libraries

Closes #2373.
Closes #2374.
  • Loading branch information
dweindl authored Mar 11, 2024
1 parent 815a50d commit e7f2d3e
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions python/sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ def get_extensions():
# Used by all extensions
global_cmake_configure_options = [
"-DCMAKE_VERBOSE_MAKEFILE=ON",
f"-DCMAKE_MODULE_PATH={prefix_path.as_posix()}",
]

# SuiteSparse Config
Expand All @@ -51,6 +52,7 @@ def get_extensions():
cmake_configure_options=[
*global_cmake_configure_options,
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
"-DBUILD_SHARED_LIBS=OFF",
# Building SuiteSparse_config does not require a BLAS
# we just set BLAS_LIBRARIES to skip the search,
# the value is not used
Expand All @@ -68,6 +70,8 @@ def get_extensions():
source_dir="amici/ThirdParty/SuiteSparse/AMD",
cmake_configure_options=[
*global_cmake_configure_options,
"-DBUILD_SHARED_LIBS=OFF",
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
"-DSUITESPARSE_USE_FORTRAN=OFF",
],
)
Expand All @@ -79,6 +83,8 @@ def get_extensions():
cmake_configure_options=[
*global_cmake_configure_options,
"-DSUITESPARSE_USE_FORTRAN=OFF",
"-DBUILD_SHARED_LIBS=OFF",
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
],
)
# SuiteSparse COLAMD
Expand All @@ -89,6 +95,8 @@ def get_extensions():
cmake_configure_options=[
*global_cmake_configure_options,
"-DSUITESPARSE_USE_FORTRAN=OFF",
"-DBUILD_SHARED_LIBS=OFF",
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
],
)
# SuiteSparse KLU
Expand All @@ -101,6 +109,8 @@ def get_extensions():
"-DKLU_USE_CHOLMOD=OFF",
"-DSUITESPARSE_USE_CUDA=OFF",
"-DSUITESPARSE_USE_FORTRAN=OFF",
"-DBUILD_SHARED_LIBS=OFF",
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
],
)
# SUNDIALS
Expand Down

0 comments on commit e7f2d3e

Please sign in to comment.