forked from enrico-dev/enrico
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
142 lines (121 loc) · 4.88 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
cmake_minimum_required(VERSION 3.3)
project(enrico Fortran C CXX)
# =============================================================================
# Check for SCALE (optional)
# =============================================================================
find_package(SCALE PATHS ${SCALE_DIR} COMPONENTS OmnibusDriver Tpetra)
if (SCALE_FOUND)
MESSAGE(" SCALE_FOUND!")
MESSAGE(" SCALE_DIR = ${SCALE_DIR}")
MESSAGE(" SCALE_VERSION = ${SCALE_VERSION}")
endif ()
# =============================================================================
# Discover name-mangling for routines in libnek5000
# =============================================================================
include(FortranCInterface)
FortranCInterface_VERIFY()
FortranCInterface_HEADER(${CMAKE_BINARY_DIR}/nek_mangling.h
MACRO_NAMESPACE C2F_
SYMBOL_NAMESPACE C2F_
SYMBOLS
nek_init
nek_end
nek_solve)
# =============================================================================
# Headers for all targets
# =============================================================================
include_directories(
include/
vendor/iapws/include
vendor/openmc/include
vendor
src/
${CMAKE_BINARY_DIR})
if (SCALE_FOUND)
include_directories(${SCALE_INCLUDE_DIRS})
include_directories(${SCALE_TPL_INCLUDE_DIRS})
endif ()
# =============================================================================
# Recursively build libnek5000 and libopenmc
# =============================================================================
add_subdirectory(vendor/nek5000)
add_subdirectory(vendor/openmc)
add_subdirectory(vendor/gsl)
# =============================================================================
# IAPWS Correlations
# =============================================================================
add_library(iapws vendor/iapws/iapws.cpp)
# =============================================================================
# Heat transfer surrogate
# =============================================================================
add_library(heat_xfer vendor/surrogates/heat_xfer_backend.cpp)
target_include_directories(heat_xfer PUBLIC vendor/surrogates/)
target_link_libraries(heat_xfer PUBLIC iapws)
# =============================================================================
# Build libenrico
# =============================================================================
set(SOURCES
src/driver.cpp
src/coupled_driver.cpp
src/surrogate_heat_driver.cpp
src/message_passing.cpp
src/openmc_driver.cpp
src/cell_instance.cpp
src/openmc_nek_driver.cpp
src/nek_driver.cpp
src/vtk_viz.cpp
src/openmc_heat_driver.cpp)
if (SCALE_FOUND)
list(APPEND SOURCES
src/smrt/Assembly_Model.cpp
src/smrt/shift_nek_driver.cpp
src/smrt/Multiphysics_Driver.cpp
src/smrt/Multi_Pin_Conduction.cpp
src/smrt/Multi_Pin_Subchannel.cpp
src/smrt/shift_driver.cpp
src/smrt/Single_Pin_Conduction.cpp
src/smrt/Single_Pin_Subchannel.cpp
src/smrt/Two_Group_Cross_Sections.cpp
src/smrt/Two_Group_Diffusion.cpp
src/smrt/Water_Properties.cpp)
endif ()
# Build all compoments of libenrico
add_library(libenrico
${SOURCES})
set_target_properties(libenrico PROPERTIES OUTPUT_NAME enrico)
target_link_libraries(libenrico PUBLIC iapws libnek5000 libopenmc xtensor heat_xfer pugixml gsl-lite)
target_compile_definitions(libenrico PRIVATE GSL_THROW_ON_CONTRACT_VIOLATION)
if (SCALE_FOUND)
target_link_libraries(libenrico PUBLIC ${SCALE_LIBRARIES})
target_link_libraries(libenrico PUBLIC ${SCALE_TPL_LIBRARIES})
endif ()
# =============================================================================
# Build enrico driver
# =============================================================================
add_executable(enrico src/main.cpp)
target_link_libraries(enrico PUBLIC libenrico)
# =============================================================================
# Build enrico tests and demos
# =============================================================================
add_executable(comm_split_demo tests/comm_split_demo/main.cpp)
add_executable(test_nek5000_singlerod tests/singlerod/short/test_nek5000.cpp)
target_link_libraries(test_nek5000_singlerod PUBLIC libenrico)
add_executable(test_openmc_singlerod tests/singlerod/short/test_openmc.cpp)
target_link_libraries(test_openmc_singlerod PUBLIC libenrico)
# Ensure C++14 standard is used
set_target_properties(
enrico libenrico
comm_split_demo
heat_xfer
iapws
test_nek5000_singlerod
test_openmc_singlerod
PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
if (SCALE_FOUND)
add_executable(test_shift_singlerod tests/singlerod/short/test_shift_coupled.cpp)
target_link_libraries(test_shift_singlerod PUBLIC libenrico)
# Ensure C++14 standard is used
set_target_properties(
test_shift_singlerod
PROPERTIES CXX_STANDARD 14 CXX_EXTENSIONS OFF)
endif ()