diff --git a/cmake/AmiciConfig.cmake.in b/cmake/AmiciConfig.cmake.in index d1e86c151e..d760587766 100644 --- a/cmake/AmiciConfig.cmake.in +++ b/cmake/AmiciConfig.cmake.in @@ -7,23 +7,8 @@ find_package(OpenMP) # Current SUNDIALSConfig.cmake doesn't use KLU's FindKLU, but hardcodes paths, # and is not relocatable. This does not work with Python package installation in # tmpdirs. -list(APPEND CMAKE_MODULE_PATH - @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/lib/cmake/SuiteSparse/) -if(NOT DEFINED SUITESPARSE_CONFIG_ROOT) - set(SUITESPARSE_CONFIG_ROOT @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/) -endif() -if(NOT DEFINED AMD_ROOT) - set(AMD_ROOT @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/) -endif() -if(NOT DEFINED BTF_ROOT) - set(BTF_ROOT @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/) -endif() -if(NOT DEFINED COLAMD_ROOT) - set(COLAMD_ROOT @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/) -endif() -if(NOT DEFINED KLU_ROOT) - set(KLU_ROOT @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/) -endif() +list(APPEND CMAKE_PREFIX_PATH + @CMAKE_SOURCE_DIR@/ThirdParty/SuiteSparse/install/) find_dependency(SuiteSparse_config REQUIRED) find_dependency(AMD REQUIRED) find_dependency(BTF REQUIRED) diff --git a/scripts/buildSuiteSparse.sh b/scripts/buildSuiteSparse.sh index 93341810f8..bce7ca1fd0 100755 --- a/scripts/buildSuiteSparse.sh +++ b/scripts/buildSuiteSparse.sh @@ -8,14 +8,21 @@ script_path=$(dirname "$BASH_SOURCE") amici_path=$(cd "$script_path/.." && pwd) suitesparse_root="${amici_path}/ThirdParty/SuiteSparse" -for subdir in SuiteSparse_config BTF AMD COLAMD KLU; do - export CMAKE_OPTIONS="-DSUITESPARSE_USE_CUDA=OFF -DSUITESPARSE_USE_FORTRAN=OFF" - if [ $subdir = "SuiteSparse_config" ]; then - export CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBLA_VENDOR=All -DSUITESPARSE_USE_64BIT_BLAS=ON -DBLAS_LIBRARIES=dummy" - elif [ $subdir = "KLU" ]; then - export CMAKE_OPTIONS="$CMAKE_OPTIONS -DKLU_USE_CHOLMOD=OFF" - fi +cd "${suitesparse_root}/build" +cmake -DSUITESPARSE_ENABLE_PROJECTS="amd;btf;colamd;klu" \ + -DCMAKE_INSTALL_PREFIX="${suitesparse_root}/install" \ + -DCHOLMOD_CAMD=OFF \ + -DKLU_USE_CHOLMOD=OFF \ + -DSUITESPARSE_CONFIG_USE_OPENMP=OFF \ + -DSUITESPARSE_USE_CUDA=OFF \ + -DSUITESPARSE_USE_FORTRAN=OFF \ + -DSUITESPARSE_USE_PYTHON=OFF \ + -DSUITESPARSE_USE_OPENMP=OFF \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DSUITESPARSE_USE_64BIT_BLAS=ON \ + -DBLAS_LIBRARIES=dummy \ + .. - cd "${suitesparse_root}/${subdir}" && make local install -done +cmake --build . +cmake --install . diff --git a/scripts/buildSundials.sh b/scripts/buildSundials.sh index f3410ef31a..6fe031cf04 100755 --- a/scripts/buildSundials.sh +++ b/scripts/buildSundials.sh @@ -47,8 +47,8 @@ ${cmake} -DCMAKE_INSTALL_PREFIX="${sundials_build_path}" \ -DEXAMPLES_ENABLE_C=OFF \ -DEXAMPLES_INSTALL=OFF \ -DENABLE_KLU=ON \ - -DKLU_LIBRARY_DIR="${suitesparse_root}/lib" \ - -DKLU_INCLUDE_DIR="${suitesparse_root}/include/suitesparse" \ + -DKLU_LIBRARY_DIR="${suitesparse_root}/install/lib" \ + -DKLU_INCLUDE_DIR="${suitesparse_root}/install/include/suitesparse" \ ${SuperLUMT} \ ..