-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
165 lines (141 loc) · 6.18 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
# licensed to the apache software foundation (asf) under one
# or more contributor license agreements. see the notice file
# distributed with this work for additional information
# regarding copyright ownership. the asf licenses this file
# to you under the apache license, version 2.0 (the
# "license"); you may not use this file except in compliance
# with the license. you may obtain a copy of the license at
#
# http://www.apache.org/licenses/license-2.0
#
# unless required by applicable law or agreed to in writing,
# software distributed under the license is distributed on an
# "as is" basis, without warranties or conditions of any
# kind, either express or implied. see the license for the
# specific language governing permissions and limitations
# under the license.
# ===============
# === Project ===
# ===============
cmake_minimum_required(VERSION 3.16)
project(exaDEM LANGUAGES C CXX)
# ===========================
# === CMake customization ===
# ===========================
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Release Coverage RelWithDebInfo Debug)
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "" FORCE)
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
# ==============================================
# === Set Some default values for polyhedra ====
# ==============================================
# These values have to be set by exaNBody
set(EXADEM_MAX_VERTICES "9" CACHE STRING "Maximum number of vertices per polyhedron")
message(STATUS "Maximum number of vertices per polyhedron: ${EXADEM_MAX_VERTICES}, default is 9 vertices.")
add_compile_options(-DEXADEM_MAX_VERTICES=${EXADEM_MAX_VERTICES})
# ======================================
# === ExaDEM Package Option ===
# ======================================
option(USE_RSA "Add RSA Package" OFF)
if(USE_RSA)
find_package(rsa_mpi REQUIRED)
message( STATUS "rsa_mpi is used, header location: ${rsa_mpi_INCLUDE_DIRS}")
message( STATUS "rsa_mpi is used, rsa_mpi_DIR: ${rsa_mpi_DIR}")
include_directories(${rsa_mpi_INCLUDE_DIRS})
endif(USE_RSA)
# ======================================
# === exaNBody application framework ===
# ======================================
find_package(exaNBody)
# =================================
# === Host System configuration ===
# =================================
# find command that gives OS description string
find_file(CCC_OS_CMD NAMES ccc_os cea_os uname PATHS /ccc/local/products/sr/bin /usr/local/sr/bin /ccc/products/ccc_users_env/bin ENV PATH)
if(CCC_OS_CMD)
execute_process(COMMAND ${CCC_OS_CMD} OUTPUT_VARIABLE HOST_OS OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
# =========================
# === Custom submodules ===
# =========================
foreach(esm ${EXASTAMP_SUBMODULES})
if(EXISTS ${CMAKE_SOURCE_DIR}/${esm}/config.cmake)
message(STATUS "load sub module configuration ${CMAKE_SOURCE_DIR}/${esm}/config.cmake")
include(${CMAKE_SOURCE_DIR}/${esm}/config.cmake)
endif()
endforeach()
# ==============================
# === Application version ===
# ==============================
set(EXASDEM_VERSION "exaDEM-1.1.0")
message(STATUS "Project version : ${EXASDEM_VERSION}")
# ==================================
# === environment setup commands ===
# ==================================
set(PROJECT_SETUP_ENV_COMMANDS "" CACHE STRING "Environment setup commands")
# ====================================
# === CCC supercomputing facility ===
# ====================================
option(EXASTAMP_CCC_USER "Use CCC job resource interface" OFF)
if(EXASTAMP_CCC_USER)
set(CCC_USER_DEFINITIONS "-D__use_lib_ccc_user=1" CACHE STRING "ccc_user macro definitions")
set(CCC_USER_INCLUDE_DIRS "" CACHE STRING "ccc_user include dir")
set(CCC_USER_LIBRARIES "ccc_user" CACHE STRING "ccc_user lib")
set(XNB_APP_DEFINITIONS ${XNB_APP_DEFINITIONS} ${CCC_USER_DEFINITIONS})
set(XNB_APP_INCLUDE_DIRS ${XNB_APP_INCLUDE_DIRS} ${CCC_USER_INCLUDE_DIRS})
set(XNB_APP_LIBRARIES ${XNB_APP_LIBRARIES} ${CCC_USER_LIBRARIES})
endif()
# ==============================
# === test data directory ===
# ==============================
include(DataDirectoryMD5)
set(EXASTAMP_TEST_DATA_DIR "./data" CACHE STRING "Path where to find input data files used by regression tests")
set(EXASTAMP_TEST_DATA_MD5_FILE ${CMAKE_SOURCE_DIR}/data/data_dir.md5)
set(EXASTAMP_TEST_DATA_DIR_STATUS ${CMAKE_CURRENT_BINARY_DIR}/data_dir_checked)
option(EXASTAMP_CHECK_DATA_DIR_MD5 "Check test data dir integrity" OFF)
if(EXISTS ${EXASTAMP_TEST_DATA_DIR_STATUS})
file(READ ${EXASTAMP_TEST_DATA_DIR_STATUS} EXASTAMP_TEST_DATA_DIR_CHECKED)
else()
set(EXASTAMP_TEST_DATA_DIR_CHECKED OFF)
endif()
if(IS_DIRECTORY ${EXASTAMP_TEST_DATA_DIR} AND EXASTAMP_CHECK_DATA_DIR_MD5 AND NOT EXASTAMP_TEST_DATA_DIR_CHECKED)
CheckDirectoryMD5(${EXASTAMP_TEST_DATA_DIR} ${EXASTAMP_TEST_DATA_MD5_FILE} EXASTAMP_TEST_DATA_DIR_CHECKED)
file(WRITE ${EXASTAMP_TEST_DATA_DIR_STATUS} ${EXASTAMP_TEST_DATA_DIR_CHECKED})
endif()
# =======================================
# === build exaNBody plugins and main ===
# =======================================
exaNBodyStartApplication()
# ======================================
# === add compiler option with CUDA ===
# ======================================
if(XNB_BUILD_CUDA)
set(CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} --expt-relaxed-constexpr")
endif()
# ==========================================
# === build application plugins and libs ===
# ==========================================
add_subdirectory(src)
# =============================
# === check exaDEM examples ===
# =============================
add_subdirectory(example)
# ==================================================
# === exaNBody plugins and unit tests final pass ===
# ==================================================
exaNBodyFinalizeApplication()
# =======================================
# === contributed tools and libraries ===
# =======================================
option(XNB_BUILD_CONTRIBS "Build contrib tools" ON)
if(XNB_BUILD_CONTRIBS)
add_subdirectory(contribs)
endif()
# ===================================
# === Documentation ===
# ===================================
option(EXASTAMP_BUILD_DOC "Build documentation" OFF)
if(EXASTAMP_BUILD_DOC)
add_subdirectory(doc)
endif()