-
Notifications
You must be signed in to change notification settings - Fork 62
/
CMakeLists.txt
206 lines (174 loc) · 5.92 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
if(DEFINED TRIBITS_PACKAGE)
include(pkg_tribits.cmake)
return()
endif()
# This is the top level CMake file for the SCOREC build
cmake_minimum_required(VERSION 3.8)
project(SCOREC VERSION 2.2.8 LANGUAGES CXX C)
include(cmake/bob.cmake)
include(cmake/xsdk.cmake)
option(USE_XSDK_DEFAULTS "enable the XDSK v0.3.0 default configuration" NO)
xsdk_begin_package()
bob_begin_package()
if(USE_XSDK_DEFAULTS)
xsdk_compiler_flags()
endif()
option(ENABLE_CGNS "Enable the CGNS reader: requires c++14 extensions" OFF)
message(STATUS "ENABLE_CGNS: ${ENABLE_CGNS}")
if(NOT ENABLE_CGNS)
bob_set_cxx_standard(11)
else()
message(STATUS "enabling cxx14")
bob_set_cxx_standard(14)
endif()
# Set some default compiler flags that should always be used
if(NOT USE_XSDK_DEFAULTS)
bob_set_shared_libs()
bob_begin_cxx_flags()
bob_end_cxx_flags()
set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS}")
if(ENABLE_CGNS)
bob_cxx14_flags()
else()
bob_cxx11_flags()
endif()
endif()
message(STATUS "CMAKE_CXX_FLAGS = ${CMAKE_CXX_FLAGS}")
# Let CMake know where to find custom FindFoo.cmake files
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/")
# Gets C99 support
find_package(C99 REQUIRED)
set(CMAKE_C_FLAGS "${C99_C_FLAGS} ${CMAKE_C_FLAGS}")
message(STATUS "CMAKE_C_FLAGS = ${CMAKE_C_FLAGS}")
option(IS_TESTING "Build for CTest" OFF)
message(STATUS "IS_TESTING: ${IS_TESTING}")
set(MESHES "${CMAKE_SOURCE_DIR}/pumi-meshes" CACHE STRING "Directory of test meshes")
message(STATUS "MESHES: ${MESHES}")
set(SMOKE_TEST_MESHES "${CMAKE_SOURCE_DIR}/smoke_test_meshes" CACHE STRING "Directory of
meshes used for smoke testing")
option(BUILD_EXES "Build executables" ON)
message(STATUS "BUILD_EXES: ${BUILD_EXES}")
option(PUMI_FORTRAN_INTERFACE "enable fortran interface" OFF)
message(STATUS "PUMI_FORTRAN_INTERFACE: ${PUMI_FORTRAN_INTERFACE}")
option(PUMI_PYTHON_INTERFACE "enable python interface" OFF)
message(STATUS "PUMI_PYTHON_INTERFACE: ${PUMI_PYTHON_INTERFACE}")
get_filename_component(COMPILER_DIR "${CMAKE_CXX_COMPILER}" PATH)
find_program(MPIRUN NAMES mpirun PATHS "${COMPILER_DIR}")
set(MPIRUN_PROCFLAG "-np" CACHE STRING
"the command line flag to give process count to MPIRUN")
message(STATUS "MPIRUN: ${MPIRUN} ${MPIRUN_PROCFLAG}")
set(VALGRIND "" CACHE STRING
"the valgrind executable")
set(VALGRIND_ARGS "" CACHE STRING
"the command line arguments to VALGRIND")
# smoke test target - a few tests are defined later with the 'SMOKE_TEST' label
add_custom_target(check
COMMAND ${CMAKE_CTEST_COMMAND} -L SMOKE_TEST
COMMENT "running a smoke test on the installed binaries")
# Set options for doxygen documentation
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY
)
add_custom_target(doc
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen" VERBATIM
)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile_internal.in
${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_internal @ONLY
)
add_custom_target(docInternal
${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile_internal
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating Internal API documentation with Doxygen" VERBATIM
)
endif()
set(Trilinos_PREFIX "" CACHE STRING "Trilinos installation directory")
option(SKIP_SIMMETRIX_VERSION_CHECK "enable at your own risk; it may result in undefined behavior" OFF)
option(ENABLE_SIMMETRIX "Build with Simmetrix support" OFF)
message(STATUS "ENABLE_SIMMETRIX: ${ENABLE_SIMMETRIX}")
option(ENABLE_CAPSTONE "Build with Capstone support" OFF)
message(STATUS "ENABLE_CAPSTONE: ${ENABLE_CAPSTONE}")
option(ENABLE_OMEGA_H "Enable the Omega_h interface" OFF)
option(PUMI_USE_OMEGA_H_VERSION "Specify the Omega_h version PUMI should use" 10.0.0)
message(STATUS "ENABLE_OMEGA_H: ${ENABLE_OMEGA_H}")
if(ENABLE_SIMMETRIX)
add_definitions(-DHAVE_SIMMETRIX)
endif()
if(ENABLE_CAPSTONE)
add_definitions(-DHAVE_CAPSTONE)
endif()
option(ENABLE_FPP "Build with snapping to first problem plane" OFF)
message(STATUS "ENABLE_FPP: ${ENABLE_FPP}")
if(ENABLE_FPP)
add_definitions(-DDO_FPP)
endif()
macro(scorec_export_library target)
bob_export_target(${target})
install(FILES ${HEADERS} DESTINATION include)
endmacro(scorec_export_library)
if(ENABLE_SIMMETRIX)
find_package(SimModSuite MODULE REQUIRED)
endif()
if(ENABLE_CAPSTONE)
set(SCOREC_USE_CreateMG_DEFAULT ${ENABLE_CAPSTONE})
bob_public_dep(CreateMG)
endif()
if(ENABLE_OMEGA_H)
# find the omega_h library
set(SCOREC_USE_Omega_h_DEFAULT ${ENABLE_OMEGA_H})
set(Omega_h_REQUIRED_VERSION ${PUMI_USE_OMEGA_H_VERSION})
bob_public_dep(Omega_h)
endif()
if(ENABLE_CGNS)
set(SCOREC_USE_CGNS_DEFAULT ${ENABLE_CGNS})
bob_public_dep(CGNS)
#CGNS does not provide cmake targets :(
include_directories(SYSTEM ${CGNS_INCLUDE_DIR})
set(SCOREC_USE_HDF5_DEFAULT ${ENABLE_CGNS})
bob_public_dep(HDF5)
add_definitions(-DHAVE_CGNS)
endif()
# Include the SCOREC project packages
add_subdirectory(lion)
add_subdirectory(pcu)
add_subdirectory(gmi)
add_subdirectory(gmi_sim)
add_subdirectory(can)
add_subdirectory(mth)
add_subdirectory(apf)
add_subdirectory(apf_sim)
add_subdirectory(mds)
add_subdirectory(parma)
add_subdirectory(zoltan)
add_subdirectory(pumi)
add_subdirectory(ma)
add_subdirectory(crv)
add_subdirectory(spr)
add_subdirectory(ree)
add_subdirectory(sam)
add_subdirectory(phasta)
add_subdirectory(stk)
add_subdirectory(dsp)
add_subdirectory(omega_h)
add_subdirectory(gmi_cap)
add_subdirectory(apf_cap)
# this INTERFACE target bundles all the enabled libraries together
add_library(core INTERFACE)
target_link_libraries(core INTERFACE ${SCOREC_EXPORTED_TARGETS})
if(ENABLE_CGNS)
target_link_libraries(core INTERFACE ${CMAKE_DL_LIBS}) #HDF5 uses dlopen
endif()
scorec_export_library(core)
if(BUILD_EXES)
add_subdirectory(test)
endif()
if(PUMI_PYTHON_INTERFACE)
add_subdirectory(python_wrappers)
endif()
bob_end_package()