Skip to content

Commit

Permalink
Update build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
dweindl committed Feb 25, 2024
1 parent 02c33c1 commit 1b65de1
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 13 deletions.
7 changes: 7 additions & 0 deletions cmake/AmiciConfig.cmake
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
@PACKAGE_INIT@

# TODO remove after cmake files for test models have been regenerated
# cmake >=3.27
if(POLICY CMP0144)
cmake_policy(SET CMP0144 NEW)
endif(POLICY CMP0144)


include(CMakeFindDependencyMacro)

find_package(OpenMP)
Expand Down
19 changes: 10 additions & 9 deletions python/sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ def get_extensions():
source_dir="amici/ThirdParty/SuiteSparse/SuiteSparse_config",
cmake_configure_options=[
*global_cmake_configure_options,
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
"-DBLA_VENDOR=All",
"-DENABLE_CUDA=FALSE",
"-DNFORTRAN=TRUE",
"-DSUITESPARSE_USE_CUDA=OFF",
"-DSUITESPARSE_USE_FORTRAN=OFF",
],
)
# SuiteSparse AMD
Expand All @@ -62,7 +63,7 @@ def get_extensions():
source_dir="amici/ThirdParty/SuiteSparse/AMD",
cmake_configure_options=[
*global_cmake_configure_options,
"-DNFORTRAN=TRUE",
"-DSUITESPARSE_USE_FORTRAN=OFF",
],
)
# SuiteSparse BTF
Expand All @@ -72,7 +73,7 @@ def get_extensions():
source_dir="amici/ThirdParty/SuiteSparse/BTF",
cmake_configure_options=[
*global_cmake_configure_options,
"-DNFORTRAN=TRUE",
"-DSUITESPARSE_USE_FORTRAN=OFF",
],
)
# SuiteSparse COLAMD
Expand All @@ -82,7 +83,7 @@ def get_extensions():
source_dir="amici/ThirdParty/SuiteSparse/COLAMD",
cmake_configure_options=[
*global_cmake_configure_options,
"-DNFORTRAN=TRUE",
"-DSUITESPARSE_USE_FORTRAN=OFF",
],
)
# SuiteSparse KLU
Expand All @@ -92,9 +93,9 @@ def get_extensions():
source_dir="amici/ThirdParty/SuiteSparse/KLU",
cmake_configure_options=[
*global_cmake_configure_options,
"-DNCHOLMOD=ON",
"-DENABLE_CUDA=FALSE",
"-DNFORTRAN=TRUE",
"-DKLU_USE_CHOLMOD=OFF",
"-DSUITESPARSE_USE_CUDA=OFF",
"-DSUITESPARSE_USE_FORTRAN=OFF",
],
)
# SUNDIALS
Expand All @@ -120,7 +121,7 @@ def get_extensions():
# be replaced by the actual path by `AmiciBuildCMakeExtension`
# before being passed to CMake.
"-DKLU_LIBRARY_DIR='${build_dir}/amici/lib'",
"-DKLU_INCLUDE_DIR='${build_dir}/amici/include'",
"-DKLU_INCLUDE_DIR='${build_dir}/amici/include/suitesparse'",
],
)
# AMICI
Expand Down
13 changes: 10 additions & 3 deletions scripts/buildSuiteSparse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@ script_path=$(dirname "$BASH_SOURCE")
amici_path=$(cd "$script_path/.." && pwd)

suitesparse_root="${amici_path}/ThirdParty/SuiteSparse"
export CMAKE_OPTIONS="-DBLA_VENDOR=All -DENABLE_CUDA=FALSE -DNFORTRAN=TRUE -DNCHOLMOD=TRUE"
for subdir in SuiteSparse_config BTF AMD COLAMD KLU
do cd "${suitesparse_root}/${subdir}" && make local install
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"
elif [ $subdir = "KLU" ]; then
export CMAKE_OPTIONS="$CMAKE_OPTIONS -DKLU_USE_CHOLMOD=OFF"
fi

cd "${suitesparse_root}/${subdir}" && make local install
done
2 changes: 1 addition & 1 deletion scripts/buildSundials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ ${cmake} -DCMAKE_INSTALL_PREFIX="${sundials_build_path}" \
-DEXAMPLES_INSTALL=OFF \
-DENABLE_KLU=ON \
-DKLU_LIBRARY_DIR="${suitesparse_root}/lib" \
-DKLU_INCLUDE_DIR="${suitesparse_root}/include" \
-DKLU_INCLUDE_DIR="${suitesparse_root}/include/suitesparse" \
${SuperLUMT} \
..

Expand Down

0 comments on commit 1b65de1

Please sign in to comment.