forked from SciCompMod/memilio
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
78 lines (66 loc) · 2.91 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
cmake_minimum_required(VERSION 3.4)
project(memilio-python)
option(MEMILIO_USE_BUNDLED_PYBIND11 "Use pybind11 bundled with this library." ON)
mark_as_advanced(MEMILIO_USE_BUNDLED_PYBIND11)
include(GNUInstallDirs) # set to gnu folders. No cache variable so this is not global
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib")
set(CMAKE_PDB_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_INSTALL_RPATH "${CMAKE_BINARY_DIR}/lib" "${CMAKE_BINARY_DIR}/bin")
if(MEMILIO_USE_BUNDLED_PYBIND11)
# Fetch pybind11
include(FetchContent)
FetchContent_Declare(pybind11
GIT_REPOSITORY https://github.com/pybind/pybind11
GIT_TAG v2.11.1
)
FetchContent_GetProperties(pybind11)
if(NOT pybind11_POPULATED)
FetchContent_Populate(pybind11)
add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR})
endif()
else()
find_package(pybind11 REQUIRED)
endif()
# add in C++ library
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../cpp ${CMAKE_CURRENT_BINARY_DIR}/cpp EXCLUDE_FROM_ALL)
# build python extensions
pybind11_add_module(_simulation_secir MODULE
memilio/simulation/secir.cpp
)
target_link_libraries(_simulation_secir PRIVATE memilio ode_secir)
target_include_directories(_simulation_secir PRIVATE memilio/simulation)
install(TARGETS _simulation_secir LIBRARY DESTINATION memilio)
pybind11_add_module(_simulation_abm MODULE
memilio/simulation/abm.cpp
)
target_link_libraries(_simulation_abm PRIVATE memilio abm)
target_include_directories(_simulation_abm PRIVATE memilio/simulation)
install(TARGETS _simulation_abm LIBRARY DESTINATION memilio)
pybind11_add_module(_simulation MODULE
memilio/simulation/simulation.cpp
memilio/simulation/epidemiology/damping_sampling.cpp
memilio/simulation/epidemiology/uncertain_matrix.cpp
memilio/simulation/mobility/metapopulation_mobility_instant.cpp
memilio/simulation/utils/date.cpp
memilio/simulation/utils/logging.cpp
memilio/simulation/utils/time_series.cpp
memilio/simulation/utils/parameter_distributions.cpp
memilio/simulation/utils/uncertain_value.cpp
)
target_link_libraries(_simulation PRIVATE memilio)
target_include_directories(_simulation PRIVATE memilio/simulation)
install(TARGETS _simulation LIBRARY DESTINATION memilio)
pybind11_add_module(_simulation_oseir MODULE
memilio/simulation/oseir.cpp
)
target_link_libraries(_simulation_oseir PRIVATE memilio ode_seir)
target_include_directories(_simulation_oseir PRIVATE memilio/simulation)
install(TARGETS _simulation_oseir LIBRARY DESTINATION memilio)
pybind11_add_module(_simulation_osir MODULE
memilio/simulation/osir.cpp
)
target_link_libraries(_simulation_osir PRIVATE memilio ode_sir)
target_include_directories(_simulation_osir PRIVATE memilio/simulation)
install(TARGETS _simulation_osir LIBRARY DESTINATION memilio)