forked from LLNL/Umpire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
148 lines (122 loc) · 4.33 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
##############################################################################
# Copyright (c) 2016-20, Lawrence Livermore National Security, LLC and Umpire
# project contributors. See the COPYRIGHT file for details.
#
# SPDX-License-Identifier: (MIT)
##############################################################################
cmake_policy(SET CMP0025 NEW)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
project(Umpire
LANGUAGES CXX C
VERSION 2.1.0)
set(UMPIRE_VERSION_RC "")
option(ENABLE_DEVELOPER_DEFAULTS "Enable default options for Umpire developers" Off)
mark_as_advanced(ENABLE_DEVELOPER_DEFAULTS)
if (ENABLE_DEVELOPER_DEFAULTS)
set(ENABLE_WARNINGS_AS_ERRORS On CACHE BOOL "")
set(ENABLE_TOOLS On CACHE BOOL "")
set(ENABLE_DEVICE_CONST On CACHE BOOL "")
endif ()
set(ENABLE_CUDA Off CACHE BOOL "")
set(ENABLE_HIP Off CACHE BOOL "")
set(ENABLE_NUMA Off CACHE BOOL "")
set(ENABLE_OPENMP Off CACHE BOOL "")
set(ENABLE_COPY_HEADERS Off CACHE BOOL "")
set(ENABLE_TESTS On CACHE BOOL "")
set(ENABLE_BENCHMARKS On CACHE BOOL "")
set(ENABLE_GMOCK On CACHE BOOL "")
set(ENABLE_DOCS Off CACHE BOOL "")
option(ENABLE_EXAMPLES "Build Umpire examples" On)
option(ENABLE_LOGGING "Build Umpire with Logging enabled" On)
option(ENABLE_SLIC "Build Umpire with SLIC logging" Off)
option(ENABLE_ALLOCATION_BACKTRACE "Build Umpire with allocation backtrace enabled" Off)
option(ENABLE_STATISTICS "Track statistics for allocations and operations" Off)
option(ENABLE_COVERAGE "Enable code coverage (with GCC)" Off)
option(ENABLE_PEDANTIC_WARNINGS "Enable pedantic compiler warnings" On)
option(ENABLE_TOOLS "Enable Umpire development tools" Off)
option(ENABLE_DEVICE_CONST "Enable constant memory on GPUs" Off)
option(ENABLE_OPENMP_TARGET "Enable OpenMP target support" Off)
option(ENABLE_SANITIZERS "Enable manual memory poisoning of pools" Off)
# Set benchmark installation to OFF
set(BENCHMARK_ENABLE_INSTALL OFF)
set(BLT_CXX_STD "c++11" CACHE STRING "Version of C++ standard")
if (ENABLE_CUDA)
cmake_minimum_required(VERSION 3.9)
else ()
cmake_minimum_required(VERSION 3.8.2)
endif ()
message(STATUS "Using CMake version ${CMAKE_VERSION}")
if (ENABLE_FORTRAN)
set(ENABLE_C On)
endif()
if (ENABLE_DOCS AND NOT ENABLE_DOXYGEN)
message(FATAL_ERROR "\
Sphinx documentation requires Doxygen, \
please re-configure with ENABLE_DOXYGEN=ON")
endif ()
if (ENABLE_NUMA AND (NOT UNIX OR APPLE))
message(FATAL_ERROR "\
NUMA support unavailable. \
Please re-configure with ENABLE_NUMA=Off (default value)")
endif ()
if (ENABLE_CUDA)
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 8.0)
set (CMAKE_CUDA_FLAGS "${CMAKE_CUDA_FLAGS} -Xcompiler -mno-float128")
endif ()
endif ()
endif()
################################
# BLT
################################
if (NOT BLT_LOADED)
if (DEFINED BLT_SOURCE_DIR)
if (NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake)
message(FATAL_ERROR "Given BLT_SOURCE_DIR does not contain SetupBLT.cmake")
endif()
else ()
set (BLT_SOURCE_DIR ${PROJECT_SOURCE_DIR}/blt CACHE PATH "")
if (NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake)
message(FATAL_ERROR
"The BLT git submodule is not present. "
"Either run the following two commands in your git repository: \n"
" git submodule init\n"
" git submodule update\n"
"Or add -DBLT_SOURCE_DIR=/path/to/blt to your CMake command." )
endif ()
endif ()
include(${BLT_SOURCE_DIR}/SetupBLT.cmake)
endif()
if (Git_FOUND)
blt_git_hashcode (HASHCODE umpire_sha1
RETURN_CODE rc
SOURCE_DIR ${PROJECT_SOURCE_DIR})
set (UMPIRE_VERSION_RC ${umpire_sha1})
endif ()
include(cmake/SetupCMakeBasics.cmake)
include(cmake/SetupCompilerFlags.cmake)
include(cmake/SetupUmpireThirdParty.cmake)
configure_file(
umpire-config.cmake.in
"${PROJECT_BINARY_DIR}/umpire-config.cmake" @ONLY)
install(FILES
"${PROJECT_BINARY_DIR}/umpire-config.cmake"
DESTINATION share/umpire/cmake)
install(EXPORT umpire-targets DESTINATION share/umpire/cmake)
add_subdirectory(src)
if (ENABLE_TESTS)
add_subdirectory(tests)
endif ()
if (ENABLE_BENCHMARKS)
add_subdirectory(benchmarks)
endif ()
if (ENABLE_EXAMPLES)
add_subdirectory(examples)
endif ()
if (ENABLE_TOOLS)
add_subdirectory(tools)
endif ()
if (ENABLE_DOCS)
add_subdirectory(docs)
endif ()