Skip to content

Commit

Permalink
Everything in debug mode with ENABLE_AMICI_DEBUGGING=TRUE (#2515)
Browse files Browse the repository at this point in the history
Also build SUNDIALS and SuiteSparse in debug mode when `ENABLE_AMICI_DEBUGGING=TRUE`.
  • Loading branch information
dweindl authored Sep 30, 2024
1 parent 08eb76b commit b602f01
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 6 deletions.
18 changes: 13 additions & 5 deletions python/sdist/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,18 @@ def get_extensions():
f"-DCMAKE_MODULE_PATH={prefix_path.as_posix()}",
]

debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [
"1",
"true",
] or os.getenv("ENABLE_GCOV_COVERAGE", "").lower() in ["1", "true"]
build_type = "Debug" if debug_build else "Release"

# SuiteSparse Config
suitesparse_config = CMakeExtension(
name="SuiteSparse_config",
install_prefix="amici",
source_dir="amici/ThirdParty/SuiteSparse/SuiteSparse_config",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-DCMAKE_POSITION_INDEPENDENT_CODE=ON",
Expand All @@ -69,6 +76,7 @@ def get_extensions():
name="amd",
install_prefix="amici",
source_dir="amici/ThirdParty/SuiteSparse/AMD",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-DBUILD_SHARED_LIBS=OFF",
Expand All @@ -81,6 +89,7 @@ def get_extensions():
name="btf",
install_prefix="amici",
source_dir="amici/ThirdParty/SuiteSparse/BTF",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-DSUITESPARSE_USE_FORTRAN=OFF",
Expand All @@ -93,6 +102,7 @@ def get_extensions():
name="colamd",
install_prefix="amici",
source_dir="amici/ThirdParty/SuiteSparse/COLAMD",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-DSUITESPARSE_USE_FORTRAN=OFF",
Expand All @@ -105,6 +115,7 @@ def get_extensions():
name="klu",
install_prefix="amici",
source_dir="amici/ThirdParty/SuiteSparse/KLU",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-DKLU_USE_CHOLMOD=OFF",
Expand All @@ -119,6 +130,7 @@ def get_extensions():
name="sundials",
install_prefix="amici",
source_dir="amici/ThirdParty/sundials",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-DBUILD_ARKODE=OFF",
Expand All @@ -141,14 +153,11 @@ def get_extensions():
],
)
# AMICI
debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [
"1",
"true",
] or os.getenv("ENABLE_GCOV_COVERAGE", "").lower() in ["1", "true"]
amici_ext = CMakeExtension(
name="amici",
install_prefix="amici",
source_dir="amici",
cmake_build_type=build_type,
cmake_configure_options=[
*global_cmake_configure_options,
"-Werror=dev"
Expand All @@ -159,7 +168,6 @@ def get_extensions():
"-DAMICI_PYTHON_BUILD_EXT_ONLY=ON",
f"-DPython3_EXECUTABLE={Path(sys.executable).as_posix()}",
],
cmake_build_type="Debug" if debug_build else "Release",
)
# Order matters!
return [suitesparse_config, amd, btf, colamd, klu, sundials, amici_ext]
Expand Down
10 changes: 10 additions & 0 deletions scripts/buildSuiteSparse.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,17 @@ amici_path=$(cd "$script_path/.." && pwd)
suitesparse_root="${amici_path}/ThirdParty/SuiteSparse"

cd "${suitesparse_root}/build"

if [[ "${GITHUB_REPOSITORY:-}" = *"/AMICI" ]] ||
[ "${ENABLE_AMICI_DEBUGGING:-}" = TRUE ]; then
# Running on CI server
build_type="Debug"
else
build_type="RelWithDebInfo"
fi

cmake -DSUITESPARSE_ENABLE_PROJECTS="amd;btf;colamd;klu" \
-DCMAKE_BUILD_TYPE="$build_type" \
-DCMAKE_INSTALL_PREFIX="${suitesparse_root}/install" \
-DCHOLMOD_CAMD=OFF \
-DKLU_USE_CHOLMOD=OFF \
Expand Down
3 changes: 2 additions & 1 deletion scripts/buildSundials.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ sundials_build_path="${amici_path}/ThirdParty/sundials/build/"
cmake=${CMAKE:-cmake}
make=${MAKE:-make}

if [[ $GITHUB_ACTIONS = true ]]; then
if [[ "${GITHUB_REPOSITORY:-}" = *"/AMICI" ]] ||
[ "${ENABLE_AMICI_DEBUGGING:-}" = TRUE ]; then
# Running on CI server
build_type="Debug"
else
Expand Down

0 comments on commit b602f01

Please sign in to comment.