From bd062a8a813c8b4bba7da97b09d0b791488f7864 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 14 May 2024 10:40:13 +0200 Subject: [PATCH 1/8] Require cmake-build-extension==0.6.0 https://github.com/diegoferigo/cmake-build-extension/releases/tag/v0.6.0 --- python/sdist/pyproject.toml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/python/sdist/pyproject.toml b/python/sdist/pyproject.toml index 10a3b05374..905e564cf4 100644 --- a/python/sdist/pyproject.toml +++ b/python/sdist/pyproject.toml @@ -11,7 +11,7 @@ requires = [ # cf. discussion at https://github.com/numpy/numpy/issues/5888 # (https://github.com/scipy/oldest-supported-numpy/) "oldest-supported-numpy", - "cmake-build-extension==0.5.1", + "cmake-build-extension==0.6.0", ] build-backend = "setuptools.build_meta" @@ -21,7 +21,7 @@ dynamic = ["version"] description = "Advanced multi-language Interface to CVODES and IDAS" requires-python = ">=3.10" dependencies = [ - "cmake-build-extension==0.5.1", + "cmake-build-extension==0.6.0", "sympy>=1.9", "numpy>=1.19.3; python_version=='3.9'", "numpy>=1.21.4; python_version>='3.10'", From 847d748dbd3892c61611d86e72915290710803bb Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 14 May 2024 13:01:07 +0200 Subject: [PATCH 2/8] .. --- scripts/installAmiciSource.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/installAmiciSource.sh b/scripts/installAmiciSource.sh index c074c89d46..1c0a975708 100755 --- a/scripts/installAmiciSource.sh +++ b/scripts/installAmiciSource.sh @@ -33,7 +33,7 @@ fi export PYTHON_EXECUTABLE="${AMICI_PATH}/venv/bin/python" python -m pip install --upgrade pip wheel -python -m pip install --upgrade pip setuptools cmake_build_extension numpy +python -m pip install --upgrade pip setuptools cmake_build_extension==0.6.0 numpy python -m pip install git+https://github.com/FFroehlich/pysb@fix_pattern_matching # pin to PR for SPM with compartments AMICI_BUILD_TEMP="${AMICI_PATH}/python/sdist/build/temp" \ python -m pip install --verbose -e "${AMICI_PATH}/python/sdist[petab,test,vis]" --no-build-isolation From 6032590c9f19751a0463659f3b83d9717406109c Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Tue, 14 May 2024 15:16:47 +0200 Subject: [PATCH 3/8] cmake_build_type --- python/sdist/amici/setup.template.py | 3 +++ python/sdist/setup.py | 2 ++ 2 files changed, 5 insertions(+) diff --git a/python/sdist/amici/setup.template.py b/python/sdist/amici/setup.template.py index 80fd3fde2a..c2ce7d5c20 100644 --- a/python/sdist/amici/setup.template.py +++ b/python/sdist/amici/setup.template.py @@ -24,6 +24,8 @@ def get_extension() -> CMakeExtension: else: os.environ["CMAKE_BUILD_PARALLEL_LEVEL"] = "1" + debug_build = os.getenv("AMICI_DEBUG", "").lower() in ["1", "true"] + return CMakeExtension( name="model_ext", source_dir=os.getcwd(), @@ -37,6 +39,7 @@ def get_extension() -> CMakeExtension: "-DAMICI_PYTHON_BUILD_EXT_ONLY=ON", f"-DPython3_EXECUTABLE={Path(sys.executable).as_posix()}", ], + cmake_build_type="Debug" if debug_build else "Release", ) diff --git a/python/sdist/setup.py b/python/sdist/setup.py index 83bf33237a..a29861ac75 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -141,6 +141,7 @@ def get_extensions(): ], ) # AMICI + debug_build = os.getenv("AMICI_DEBUG", "").lower() in ["1", "true"] amici_ext = CMakeExtension( name="amici", install_prefix="amici", @@ -153,6 +154,7 @@ 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] From b75abc706ba4537dd4bbf14597b66cdcffd21111 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 15 May 2024 09:06:04 +0200 Subject: [PATCH 4/8] .. --- python/sdist/amici/setup.template.py | 5 ++++- python/sdist/setup.py | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/python/sdist/amici/setup.template.py b/python/sdist/amici/setup.template.py index c2ce7d5c20..411d398aec 100644 --- a/python/sdist/amici/setup.template.py +++ b/python/sdist/amici/setup.template.py @@ -24,7 +24,10 @@ def get_extension() -> CMakeExtension: else: os.environ["CMAKE_BUILD_PARALLEL_LEVEL"] = "1" - debug_build = os.getenv("AMICI_DEBUG", "").lower() in ["1", "true"] + debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [ + "1", + "true", + ] return CMakeExtension( name="model_ext", diff --git a/python/sdist/setup.py b/python/sdist/setup.py index a29861ac75..5c121da9cc 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -141,7 +141,10 @@ def get_extensions(): ], ) # AMICI - debug_build = os.getenv("AMICI_DEBUG", "").lower() in ["1", "true"] + debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [ + "1", + "true", + ] amici_ext = CMakeExtension( name="amici", install_prefix="amici", From 257427d19d6fff70ac2d54c7a1204b33c50a5226 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 15 May 2024 09:30:18 +0200 Subject: [PATCH 5/8] .. --- CMakeLists.txt | 1 - scripts/buildAmici.sh | 3 ++- src/CMakeLists.template.cmake | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8a1109d90..91a5a737b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,6 @@ if("$ENV{ENABLE_AMICI_DEBUGGING}" OR "$ENV{ENABLE_GCOV_COVERAGE}") else() add_compile_options(-O0 -g) endif() - set(CMAKE_BUILD_TYPE "Debug") endif() # coverage options diff --git a/scripts/buildAmici.sh b/scripts/buildAmici.sh index 80b724c8c3..cb2428579c 100755 --- a/scripts/buildAmici.sh +++ b/scripts/buildAmici.sh @@ -14,7 +14,8 @@ mkdir -p "${amici_build_dir}" cd "${amici_build_dir}" if [ "${GITHUB_ACTIONS:-}" = true ] || - [ "${ENABLE_AMICI_DEBUGGING:-}" = TRUE ]; then + [ "${ENABLE_AMICI_DEBUGGING:-}" = TRUE ] || + [ "${ENABLE_GCOV_COVERAGE:-}" = TRUE ]; then # Running on CI server build_type="Debug" # exceptions instead of terminate() diff --git a/src/CMakeLists.template.cmake b/src/CMakeLists.template.cmake index ee50a551e8..575855be4a 100644 --- a/src/CMakeLists.template.cmake +++ b/src/CMakeLists.template.cmake @@ -47,7 +47,6 @@ if("$ENV{ENABLE_AMICI_DEBUGGING}" OR "$ENV{ENABLE_GCOV_COVERAGE}") else() add_compile_options(-O0 -g) endif() - set(CMAKE_BUILD_TYPE "Debug") endif() # coverage options From f7d2242e98dbf85f0e272b091d6416b51dcb95c6 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 15 May 2024 09:43:10 +0200 Subject: [PATCH 6/8] map --- CMakeLists.txt | 2 +- src/CMakeLists.template.cmake | 4 ++++ swig/CMakeLists.txt | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 91a5a737b2..4b0c95321b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -134,7 +134,7 @@ endif() set(VENDORED_SUNDIALS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/ThirdParty/sundials) set(SUNDIALS_PRIVATE_INCLUDE_DIRS "${VENDORED_SUNDIALS_DIR}/src") # Handle different sundials build/install dirs, depending on whether we are -# building the Python extension only or the full C++ interface +# building the Python extension only or the full C++ interface if(AMICI_PYTHON_BUILD_EXT_ONLY) set(VENDORED_SUNDIALS_BUILD_DIR ${CMAKE_CURRENT_SOURCE_DIR}) set(VENDORED_SUNDIALS_INSTALL_DIR ${VENDORED_SUNDIALS_BUILD_DIR}) diff --git a/src/CMakeLists.template.cmake b/src/CMakeLists.template.cmake index 575855be4a..dbad3e146c 100644 --- a/src/CMakeLists.template.cmake +++ b/src/CMakeLists.template.cmake @@ -38,6 +38,10 @@ endif() find_package(Amici TPL_AMICI_VERSION REQUIRED HINTS ${CMAKE_CURRENT_LIST_DIR}/../../build) message(STATUS "Found AMICI ${Amici_DIR}") +set_target_properties(Upstream::amici PROPERTIES + MAP_IMPORTED_CONFIG_RELWITHDEBINFO RelWithDebInfo;Release; + MAP_IMPORTED_CONFIG_RELEASE Release + MAP_IMPORTED_CONFIG_DEBUG Debug;RelWithDebInfo;) # Debug build? if("$ENV{ENABLE_AMICI_DEBUGGING}" OR "$ENV{ENABLE_GCOV_COVERAGE}") diff --git a/swig/CMakeLists.txt b/swig/CMakeLists.txt index 7b7baf9be9..5cc6e6b5a2 100644 --- a/swig/CMakeLists.txt +++ b/swig/CMakeLists.txt @@ -20,7 +20,10 @@ find_package( Python3 COMPONENTS Interpreter Development NumPy REQUIRED) -message(STATUS "Found numpy ${Python3_NumPy_VERSION} include dir ${Python3_NumPy_INCLUDE_DIRS}") +message( + STATUS + "Found numpy ${Python3_NumPy_VERSION} include dir ${Python3_NumPy_INCLUDE_DIRS}" +) set(AMICI_INTERFACE_LIST ${CMAKE_CURRENT_SOURCE_DIR}/amici.i ${CMAKE_CURRENT_SOURCE_DIR}/edata.i From 1714ccedbcd555ca51d062f43db48f33393e5d88 Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Wed, 15 May 2024 10:16:35 +0200 Subject: [PATCH 7/8] .. --- python/tests/test_misc.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/python/tests/test_misc.py b/python/tests/test_misc.py index b68e96f1a0..80e1afaa03 100644 --- a/python/tests/test_misc.py +++ b/python/tests/test_misc.py @@ -65,8 +65,9 @@ def test_cmake_compilation(sbml_example_presimulation_module): amici_dir = (Path(__file__).parents[2] / "build").absolute() cmd = ( f"set -e; " - f"cmake -S {source_dir} -B '{build_dir}' -DAmici_DIR={amici_dir}; " - f"cmake --build '{build_dir}'" + f"cmake -S {source_dir} -B '{build_dir}' " + f"-DCMAKE_BUILD_TYPE=Debug -DAmici_DIR={amici_dir}; " + f"cmake --build '{build_dir}' --config Debug" ) try: From 688c0e4bc40f94a9871c873e39f17812169181ad Mon Sep 17 00:00:00 2001 From: Daniel Weindl Date: Thu, 16 May 2024 08:07:45 +0200 Subject: [PATCH 8/8] dbg --- python/sdist/amici/setup.template.py | 2 +- python/sdist/setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/sdist/amici/setup.template.py b/python/sdist/amici/setup.template.py index 411d398aec..14edbfd2d4 100644 --- a/python/sdist/amici/setup.template.py +++ b/python/sdist/amici/setup.template.py @@ -27,7 +27,7 @@ def get_extension() -> CMakeExtension: debug_build = os.getenv("ENABLE_AMICI_DEBUGGING", "").lower() in [ "1", "true", - ] + ] or os.getenv("ENABLE_GCOV_COVERAGE", "").lower() in ["1", "true"] return CMakeExtension( name="model_ext", diff --git a/python/sdist/setup.py b/python/sdist/setup.py index 5c121da9cc..9dd268953a 100755 --- a/python/sdist/setup.py +++ b/python/sdist/setup.py @@ -144,7 +144,7 @@ def get_extensions(): 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",