Skip to content

506 overhaul cmakelist for constructing shared and static libraries of memilio 2025 #1241

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 78 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
fd08414
save progress
xsaschako Apr 6, 2025
3c1f018
delete comments
xsaschako Apr 6, 2025
e635270
major improvmeents
xsaschako Apr 6, 2025
10a42bb
fix some bugs
xsaschako Apr 6, 2025
bddef91
update testfile
xsaschako Apr 6, 2025
34d4f3b
benchmark update
xsaschako Apr 6, 2025
53c9dd7
add bug fixes
xsaschako Apr 6, 2025
5bf8bbb
bugfix
xsaschako Apr 6, 2025
ff823be
overhaul a lot
xsaschako Apr 6, 2025
c2eeedd
additional enhancements
xsaschako Apr 6, 2025
39fcafe
Final bug fixes
xsaschako Apr 6, 2025
4f40d0e
add cmakepreset
xsaschako Apr 6, 2025
389dc8f
enhance a lot of things
xsaschako Apr 6, 2025
b70dd48
make some things more clear
xsaschako Apr 6, 2025
e9f38c8
fortran is a lie
xsaschako Apr 6, 2025
c7ffff2
fix some thigns
xsaschako Apr 6, 2025
635261a
fix maybe
xsaschako Apr 6, 2025
82138af
fix ci
xsaschako Apr 6, 2025
22614be
fix: update gfortran version in build action
xsaschako Apr 6, 2025
fb3fbad
fix: update gfortran installation in build action
xsaschako Apr 6, 2025
1af4b2b
fix: specify gfortran version in build action
xsaschako Apr 6, 2025
279d335
fix: correct Fortran environment variable assignment in build action
xsaschako Apr 6, 2025
f5c72ed
```
xsaschako Apr 6, 2025
5ebb00a
fix: update CMake configuration to include Fortran compiler launcher
xsaschako Apr 6, 2025
c18cabd
fix: specify Fortran compiler in CMake configuration
xsaschako Apr 6, 2025
73bf0ac
test
xsaschako Apr 6, 2025
cc40f27
fix: update Fortran compiler path in GitHub Actions build script
xsaschako Apr 6, 2025
6d4fc04
fix: clean up GitHub Actions build script by removing unnecessary gfo…
xsaschako Apr 6, 2025
33c85c7
fix: set Fortran compiler environment variable and update CMake confi…
xsaschako Apr 6, 2025
4750e24
maybe this?
xsaschako Apr 6, 2025
7d89db8
maybe this
xsaschako Apr 6, 2025
4208d19
test this
xsaschako Apr 6, 2025
ac7bc79
maybe maybe
xsaschako Apr 6, 2025
cc72c9c
test
xsaschako Apr 6, 2025
677a48f
fix: correct syntax for Fortran compiler in build action
xsaschako Apr 6, 2025
135d92a
fix: specify Fortran compiler path in build action
xsaschako Apr 6, 2025
22644bf
fix: remove REQUIRED flag for Fortran language in CMakeLists.txt
xsaschako Apr 6, 2025
9e82a3c
quick rename
xsaschako Apr 7, 2025
315a26f
chore: update project version to 2.0.0 in CMakeLists.txt
xsaschako Apr 7, 2025
e14f52e
fix type
xsaschako Apr 7, 2025
0f49b54
refactor: replace simulation.config with flow_simulation.config and u…
xsaschako Apr 7, 2025
ecef0ce
refactor: replace bench_config_dir.h with base_dir.h and update relat…
xsaschako Apr 8, 2025
0a7f9f2
refactor: remove unused include for data_dir.h in ode_secir_read_grap…
xsaschako Apr 14, 2025
6046cdb
refactor: update config paths to include benchmarks/configs for simul…
xsaschako Apr 14, 2025
778f1d5
refactor: remove unused data_dir variable in main function
xsaschako Apr 14, 2025
5efa775
refactor: update config paths to use cpp/benchmarks/configs for consi…
xsaschako Apr 14, 2025
53441ac
refactor: remove trailing slash from MEMILIO_BASE_DIR and include str…
xsaschako Apr 14, 2025
c926a02
Refactor file paths to use `mio::memilio_dir()` for consistency
xsaschako Apr 14, 2025
8e63e0a
refactor: add diagnostic suppression for -Wmaybe-uninitialized warning
xsaschako Apr 14, 2025
5279814
maybemaybe
xsaschako Apr 14, 2025
ccb0c96
try
xsaschako Apr 14, 2025
55f3743
refactor: remove diagnostic suppression for -Wmaybe-uninitialized war…
xsaschako Apr 14, 2025
edaaf20
try
xsaschako Apr 14, 2025
1cf53e2
update path
xsaschako Apr 14, 2025
f4844bc
maybe
xsaschako Apr 14, 2025
50338be
refactor: clean up PATH setting and enforce CMAKE_FC_COMPILER_FORCED
xsaschako Apr 14, 2025
cc7d8cf
try something
xsaschako Apr 14, 2025
ac4d1a9
fix: enable Fortran language support for IPOPT and update CMake confi…
xsaschako Apr 14, 2025
dca4222
test
xsaschako Apr 14, 2025
a1d2bff
test windows
xsaschako Apr 14, 2025
1e4ba32
??
xsaschako Apr 14, 2025
8001b78
try
xsaschako Apr 14, 2025
528d141
test
xsaschako Apr 14, 2025
ec91f0e
test
xsaschako Apr 14, 2025
39fc5d6
test
xsaschako Apr 14, 2025
350b34b
test
xsaschako Apr 14, 2025
73d3f01
test
xsaschako Apr 14, 2025
49f223e
maybemaybe
xsaschako Apr 14, 2025
aba6f89
test
xsaschako Apr 14, 2025
61ef747
windows bug
xsaschako Apr 14, 2025
ba8bbd4
fix
xsaschako Apr 14, 2025
59dde64
lol
xsaschako Apr 14, 2025
330555e
fixes
xsaschako Apr 14, 2025
1489621
update Google Benchmark version to v1.9.2
xsaschako Apr 14, 2025
950a7e9
test version
xsaschako Apr 14, 2025
bf830ec
fix
xsaschako Apr 14, 2025
346b219
remove VSCode settings for CMake parallel jobs
xsaschako Apr 15, 2025
824a6ad
some uodates
xsaschako Apr 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/actions/linux-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,15 @@ runs:
run: |
sudo apt-get -qq update
sudo apt-get -qq -y install lcov ccache
sudo apt-get -qq -y install gfortran-9
if [[ "${{ inputs.optional-dependencies }}" == "ON" ]]; then
sudo apt-get -qq -y install libhdf5-dev
fi
if [[ "${{ inputs.compiler }}" == "gcc" ]]; then
if [[ "${{ inputs.version }}" == "min" ]]; then
sudo apt-get -qq -y install gcc-9
sudo apt-get -qq -y install g++-9
sudo apt-get -qq -y install gcc-9 g++-9
else
sudo apt-get -qq -y install gcc-11
sudo apt-get -qq -y install g++-11
sudo apt-get -qq -y install gcc-11 g++-11
fi
elif [[ "${{ inputs.compiler }}" == "clang" ]]; then
if [[ "${{ inputs.version }}" == "min" ]]; then
Expand Down Expand Up @@ -76,6 +75,7 @@ runs:
shell: bash
run: |
cd cpp
export FC=/usr/bin/gfortran-9
if [[ "${{ inputs.compiler }}" == "gcc" ]]; then
if [[ "${{ inputs.version }}" == "min" ]]; then
export CC=/usr/bin/gcc-9
Expand All @@ -97,7 +97,7 @@ runs:
exit 1
fi
mkdir -p build && cd build
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} ..
cmake -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_Fortran_COMPILER=/usr/bin/gfortran-9 -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=ON -DMEMILIO_TEST_COVERAGE=${{ inputs.coverage }} -DMEMILIO_SANITIZE_ADDRESS=${{ inputs.sanitizers }} -DMEMILIO_SANITIZE_UNDEFINED=${{ inputs.sanitizers }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DMEMILIO_ENABLE_OPENMP=${{ inputs.openmp }} ..
make -j4
- name: create build dir archive
shell: bash
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/windows-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ runs:
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" amd64
)
cmake --version
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DHDF5_USE_STATIC_LIBRARIES=ON -DHDF5_DIR="${{github.workspace}}/hdf5/share/cmake/hdf5" ..
cmake -G "Ninja" -DCMAKE_BUILD_TYPE=${{ inputs.config }} -DMEMILIO_ENABLE_IPOPT=OFF -DMEMILIO_USE_BUNDLED_JSONCPP=${{ inputs.optional-dependencies }} -DHDF5_USE_STATIC_LIBRARIES=ON -DHDF5_DIR="${{github.workspace}}/hdf5/share/cmake/hdf5" ..
cmake --build . -- -j 4
- name: Upload built binary files
uses: actions/upload-artifact@v4
Expand Down
638 changes: 484 additions & 154 deletions cpp/CMakeLists.txt

Large diffs are not rendered by default.

228 changes: 228 additions & 0 deletions cpp/CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,228 @@
{
"version": 5,
"cmakeMinimumRequired": {
"major": 3,
"minor": 24,
"patch": 0
},
"configurePresets": [
{
"name": "base-config",
"hidden": true,
"description": "Base settings common to all configurations.",
"binaryDir": "${sourceDir}/build/${presetName}",
"cacheVariables": {
"CMAKE_INSTALL_PREFIX": "${sourceDir}/install/${presetName}",
"CMAKE_CXX_STANDARD": "17",
"CMAKE_CXX_STANDARD_REQUIRED": "ON",
"CMAKE_CXX_EXTENSIONS": "OFF",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"MEMILIO_BUILD_TESTS": "ON",
"MEMILIO_BUILD_EXAMPLES": "ON",
"MEMILIO_BUILD_MODELS": "ON",
"MEMILIO_BUILD_BENCHMARKS": "ON",
"MEMILIO_USE_BUNDLED_EIGEN": "ON",
"MEMILIO_USE_BUNDLED_BOOST": "ON",
"MEMILIO_USE_BUNDLED_JSONCPP": "ON",
"MEMILIO_USE_BUNDLED_SPDLOG": "ON",
"MEMILIO_ENABLE_MPI": "OFF",
"MEMILIO_ENABLE_OPENMP": "OFF",
"MEMILIO_ENABLE_IPOPT": "OFF",
"MEMILIO_ENABLE_PROFILING": "OFF",
"MEMILIO_SANITIZE_ADDRESS": "OFF",
"MEMILIO_SANITIZE_UNDEFINED": "OFF",
"MEMILIO_TEST_COVERAGE": "OFF",
"MEMILIO_ENABLE_WARNINGS": "ON",
"MEMILIO_ENABLE_WARNINGS_AS_ERRORS": "ON",
"MEMILIO_BUILD_SHARED_LIBS": "OFF",
"MEMILIO_ENABLE_INSTALL": "OFF"
}
},
{
"name": "unix-base",
"hidden": true,
"inherits": "base-config",
"description": "Base settings for Unix-like systems (Linux, macOS)",
"generator": "Ninja",
"condition": {
"type": "not",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" }
}
},
{
"name": "windows-base",
"hidden": true,
"inherits": "base-config",
"description": "Base settings for Windows.",
"generator": "Visual Studio 17 2022",
"architecture": "x64",
"condition": { "type": "equals", "lhs": "${hostSystemName}", "rhs": "Windows" },
"cacheVariables": { "MEMILIO_BUILD_SHARED_LIBS": "OFF" }
},
{
"name": "system-libs-mixin",
"hidden": true,
"description": "Mixin to use system libraries instead of bundled ones.",
"cacheVariables": {
"MEMILIO_USE_BUNDLED_EIGEN": "OFF",
"MEMILIO_USE_BUNDLED_BOOST": "OFF",
"MEMILIO_USE_BUNDLED_JSONCPP": "OFF",
"MEMILIO_USE_BUNDLED_SPDLOG": "OFF"
}
},
{
"name": "unix-debug",
"displayName": "Unix Debug (Ninja, Bundled Libs)",
"inherits": "unix-base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
},
{
"name": "windows-debug",
"displayName": "Windows Debug (VS 2022, Bundled Libs)",
"inherits": "windows-base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Debug" }
},
{
"name": "unix-debug-system",
"displayName": "Unix Debug (Ninja, System Libs)",
"inherits": ["unix-debug", "system-libs-mixin"]
},
{
"name": "windows-debug-system",
"displayName": "Windows Debug (VS 2022, System Libs)",
"inherits": ["windows-debug", "system-libs-mixin"]
},
{
"name": "unix-release",
"displayName": "Unix Release (Ninja, Bundled Libs)",
"inherits": "unix-base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
},
{
"name": "windows-release",
"displayName": "Windows Release (VS 2022, Bundled Libs)",
"inherits": "windows-base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "Release" }
},
{
"name": "unix-release-system",
"displayName": "Unix Release (Ninja, System Libs)",
"inherits": ["unix-release", "system-libs-mixin"]
},
{
"name": "windows-release-system",
"displayName": "Windows Release (VS 2022, System Libs)",
"inherits": ["windows-release", "system-libs-mixin"]
},
{
"name": "unix-relwithdebinfo",
"displayName": "Unix RelWithDebInfo (Ninja, Bundled Libs)",
"inherits": "unix-base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }
},
{
"name": "windows-relwithdebinfo",
"displayName": "Windows RelWithDebInfo (VS 2022, Bundled Libs)",
"inherits": "windows-base",
"cacheVariables": { "CMAKE_BUILD_TYPE": "RelWithDebInfo" }
},
{
"name": "unix-debug-asan",
"displayName": "Unix Debug + Address Sanitizer",
"inherits": "unix-debug",
"cacheVariables": { "MEMILIO_SANITIZE_ADDRESS": "ON" }
},
{
"name": "unix-debug-ubsan",
"displayName": "Unix Debug + Undefined Behavior Sanitizer",
"inherits": "unix-debug",
"cacheVariables": { "MEMILIO_SANITIZE_UNDEFINED": "ON" }
},
{
"name": "unix-debug-asan-ubsan",
"displayName": "Unix Debug + ASan + UBSan",
"inherits": "unix-debug",
"cacheVariables": { "MEMILIO_SANITIZE_ADDRESS": "ON", "MEMILIO_SANITIZE_UNDEFINED": "ON" }
},
{
"name": "unix-debug-coverage",
"displayName": "Unix Debug + Code Coverage",
"inherits": "unix-debug",
"cacheVariables": { "MEMILIO_TEST_COVERAGE": "ON" }
},
{
"name": "unix-release-openmp",
"displayName": "Unix Release + OpenMP",
"inherits": "unix-release",
"cacheVariables": { "MEMILIO_ENABLE_OPENMP": "ON" }
},
{
"name": "unix-release-mpi",
"displayName": "Unix Release + MPI",
"inherits": "unix-release",
"cacheVariables": { "MEMILIO_ENABLE_MPI": "ON" }
},
{
"name": "unix-release-ipopt",
"displayName": "Unix Release + Ipopt",
"inherits": "unix-release",
"cacheVariables": { "MEMILIO_ENABLE_IPOPT": "ON" }
},
{
"name": "unix-release-profiling",
"displayName": "Unix Release + Profiling",
"inherits": "unix-release",
"cacheVariables": { "MEMILIO_ENABLE_PROFILING": "ON" }
},
{
"name": "unix-release-install",
"displayName": "Unix Release + Install",
"inherits": "unix-release",
"cacheVariables": { "MEMILIO_ENABLE_INSTALL": "ON" }
},
{
"name": "windows-release-install",
"displayName": "Windows Release + Install",
"inherits": "windows-release",
"cacheVariables": { "MEMILIO_ENABLE_INSTALL": "ON" }
}
],
"buildPresets": [
{ "name": "build-unix-debug", "configurePreset": "unix-debug", "configuration": "Debug" },
{ "name": "build-unix-debug-system", "configurePreset": "unix-debug-system", "configuration": "Debug" },
{ "name": "build-unix-release", "configurePreset": "unix-release", "configuration": "Release" },
{ "name": "build-unix-release-system", "configurePreset": "unix-release-system", "configuration": "Release" },
{ "name": "build-unix-relwithdebinfo", "configurePreset": "unix-relwithdebinfo", "configuration": "RelWithDebInfo" },
{ "name": "build-unix-debug-asan", "configurePreset": "unix-debug-asan", "configuration": "Debug" },
{ "name": "build-unix-debug-ubsan", "configurePreset": "unix-debug-ubsan", "configuration": "Debug" },
{ "name": "build-unix-debug-asan-ubsan", "configurePreset": "unix-debug-asan-ubsan", "configuration": "Debug" },
{ "name": "build-unix-debug-coverage", "configurePreset": "unix-debug-coverage", "configuration": "Debug" },
{ "name": "build-unix-release-openmp", "configurePreset": "unix-release-openmp", "configuration": "Release" },
{ "name": "build-unix-release-mpi", "configurePreset": "unix-release-mpi", "configuration": "Release" },
{ "name": "build-unix-release-ipopt", "configurePreset": "unix-release-ipopt", "configuration": "Release" },
{ "name": "build-unix-release-profiling", "configurePreset": "unix-release-profiling", "configuration": "Release" },
{ "name": "build-unix-release-install", "configurePreset": "unix-release-install", "configuration": "Release" },
{ "name": "build-windows-debug", "configurePreset": "windows-debug", "configuration": "Debug" },
{ "name": "build-windows-debug-system", "configurePreset": "windows-debug-system", "configuration": "Debug" },
{ "name": "build-windows-release", "configurePreset": "windows-release", "configuration": "Release" },
{ "name": "build-windows-release-system", "configurePreset": "windows-release-system", "configuration": "Release" },
{ "name": "build-windows-relwithdebinfo", "configurePreset": "windows-relwithdebinfo", "configuration": "RelWithDebInfo" },
{ "name": "build-windows-release-install", "configurePreset": "windows-release-install", "configuration": "Release" }
],
"testPresets": [
{ "name": "test-unix-debug", "configurePreset": "unix-debug", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-unix-debug-system", "configurePreset": "unix-debug-system", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-unix-release", "configurePreset": "unix-release", "configuration": "Release", "output": {"outputOnFailure": true} },
{ "name": "test-unix-release-system", "configurePreset": "unix-release-system", "configuration": "Release", "output": {"outputOnFailure": true} },
{ "name": "test-unix-relwithdebinfo", "configurePreset": "unix-relwithdebinfo", "configuration": "RelWithDebInfo", "output": {"outputOnFailure": true} },
{ "name": "test-unix-debug-asan", "configurePreset": "unix-debug-asan", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-unix-debug-ubsan", "configurePreset": "unix-debug-ubsan", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-unix-debug-asan-ubsan", "configurePreset": "unix-debug-asan-ubsan", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-unix-debug-coverage", "configurePreset": "unix-debug-coverage", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-windows-debug", "configurePreset": "windows-debug", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-windows-debug-system", "configurePreset": "windows-debug-system", "configuration": "Debug", "output": {"outputOnFailure": true} },
{ "name": "test-windows-release", "configurePreset": "windows-release", "configuration": "Release", "output": {"outputOnFailure": true} },
{ "name": "test-windows-release-system", "configurePreset": "windows-release-system", "configuration": "Release", "output": {"outputOnFailure": true} },
{ "name": "test-windows-relwithdebinfo", "configurePreset": "windows-relwithdebinfo", "configuration": "RelWithDebInfo", "output": {"outputOnFailure": true} }
]
}
88 changes: 60 additions & 28 deletions cpp/benchmarks/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,38 +1,70 @@
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Disable benchmark testing" FORCE)
# Attempt to find pre-installed Google Benchmark
set(MEMILIO_BENCHMARK_VERSION "v1.9.2" CACHE STRING "GoogleTest version to use")

# set(BENCHMARK_ENABLE_EXCEPTIONS OFF CACHE BOOL "Disable benchmark exceptions" FORCE)
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "Don't install benchmark" FORCE)
set(BENCHMARK_DOWNLOAD_DEPENDENCIES OFF CACHE BOOL "Don't download dependencies" FORCE)
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "Disable Google Test in benchmark" FORCE)
# Configure Google Benchmark build options BEFORE MakeAvailable
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "" FORCE) # Don't build benchmark's tests
set(BENCHMARK_ENABLE_INSTALL OFF CACHE BOOL "" FORCE) # Don't install benchmark
set(BENCHMARK_ENABLE_GTEST_TESTS OFF CACHE BOOL "" FORCE) # Don't require gtest

include(FetchContent)
FetchContent_Declare(benchmark
FetchContent_Declare(google_benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.6.1)
FetchContent_GetProperties(benchmark)
GIT_TAG ${MEMILIO_BENCHMARK_VERSION}
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(google_benchmark)

if(NOT benchmark_POPULATED)
FetchContent_Populate(benchmark)
set(CMAKE_SUPPRESS_DEVELOPER_WARNINGS 1 CACHE BOOL "")
add_subdirectory(${benchmark_SOURCE_DIR} ${benchmark_BINARY_DIR} EXCLUDE_FROM_ALL)
unset(CMAKE_SUPPRESS_DEVELOPER_WARNINGS)
endif()

set_target_properties(benchmark PROPERTIES FOLDER "Extern")
if(TARGET benchmark::benchmark)
set(MEMILIO_BENCHMARK_LIBRARY benchmark::benchmark)
else()
message(FATAL_ERROR "FetchContent for Google Benchmark did not provide target 'benchmark::benchmark'.")
endif()

add_executable(integrator_step_benchmark integrator_step.cpp)
target_link_libraries(integrator_step_benchmark PRIVATE memilio ode_secir benchmark::benchmark)

add_executable(flow_simulation_ode_secirvvs_benchmark flow_simulation_ode_secirvvs.cpp)
target_link_libraries(flow_simulation_ode_secirvvs_benchmark PRIVATE memilio ode_secirvvs benchmark::benchmark)

add_executable(flow_simulation_ode_seir_benchmark flow_simulation_ode_seir.cpp)
target_link_libraries(flow_simulation_ode_seir_benchmark PRIVATE memilio ode_seir benchmark::benchmark)
# Helper function to add benchmark executables
function(add_memilio_benchmark NAME SOURCES)
set(MEMILIO_DEPS ${ARGN})

add_executable(simulation_benchmark simulation.cpp)
target_link_libraries(simulation_benchmark PRIVATE memilio ode_secir benchmark::benchmark)
add_executable(graph_simulation_benchmark graph_simulation.cpp)
target_link_libraries(graph_simulation_benchmark PRIVATE memilio ode_secirvvs benchmark::benchmark)
add_executable(${NAME} ${SOURCES})
target_link_libraries(${NAME} PRIVATE
memilio
${MEMILIO_DEPS}
${MEMILIO_BENCHMARK_LIBRARY}
)
endfunction()

add_executable(abm_benchmark abm.cpp)
target_link_libraries(abm_benchmark PRIVATE abm benchmark::benchmark)

# Define benchmark executables
add_memilio_benchmark(memilio_abm_benchmark
abm.cpp
abm
)

if(MEMILIO_HAS_JSONCPP)
add_memilio_benchmark(memilio_graph_simulation_benchmark
graph_simulation.cpp
ode_secirvvs
)

add_memilio_benchmark(memilio_flow_simulation_ode_seir_benchmark
flow_simulation_ode_seir.cpp
ode_seir
)


add_memilio_benchmark(memilio_flow_simulation_ode_secirvvs_benchmark
flow_simulation_ode_secirvvs.cpp
ode_secirvvs
)

add_memilio_benchmark(integrator_secir_benchmark
integrator_secir_sim.cpp
ode_secir
)

add_memilio_benchmark(memilio_integrator_step_benchmark
integrator_step.cpp
ode_secir
)
endif()
Loading
Loading