From e7f2d3e6c584d8fe6395381ba0ba5f1e5e84241b Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 11 Mar 2024 13:19:54 +0100 Subject: [PATCH] Fix SuiteSparse build (#2375) * Only build static suitesparse libs, but position-independent * Make CMake prefer the vendored libraries over any system libraries Closes #2373. Closes #2374. --- python/sdist/setup.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/python/sdist/setup.py b/python/sdist/setup.py index 0da5ac9878..2f44a18342 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -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 @@ -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 @@ -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", ], ) @@ -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 @@ -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 @@ -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