From b602f01905dd85f8ccb8a3af304f370422a8424f Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Mon, 30 Sep 2024 10:57:51 +0200 Subject: [PATCH] Everything in debug mode with ENABLE_AMICI_DEBUGGING=TRUE (#2515) Also build SUNDIALS and SuiteSparse in debug mode when `ENABLE_AMICI_DEBUGGING=TRUE`. --- python/sdist/setup.py | 18 +++++++++++++----- scripts/buildSuiteSparse.sh | 10 ++++++++++ scripts/buildSundials.sh | 3 ++- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/python/sdist/setup.py b/python/sdist/setup.py index d01a0ec75c..4850763926 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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", @@ -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" @@ -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] diff --git a/scripts/buildSuiteSparse.sh b/scripts/buildSuiteSparse.sh index 326e758698..90ec1d8e4a 100755 --- a/scripts/buildSuiteSparse.sh +++ b/scripts/buildSuiteSparse.sh @@ -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 \ diff --git a/scripts/buildSundials.sh b/scripts/buildSundials.sh index 6fe031cf04..642c607cb8 100755 --- a/scripts/buildSundials.sh +++ b/scripts/buildSundials.sh @@ -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