forked from LLNL/Umpire
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
125 lines (105 loc) · 3.62 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
##############################################################################
# Copyright (c) 2018-2019, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory
#
# Created by David Beckingsale, [email protected]
# LLNL-CODE-747640
#
# All rights reserved.
#
# This file is part of Umpire.
#
# For details, see https://github.com/LLNL/Umpire
# Please also see the LICENSE file for MIT license.
##############################################################################
cmake_policy(SET CMP0025 NEW)
cmake_policy(SET CMP0048 NEW)
cmake_policy(SET CMP0057 NEW)
project(Umpire
LANGUAGES CXX C
VERSION 0.3.3)
set(ENABLE_CUDA On 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 "")
set(ENABLE_WARNINGS_AS_ERRORS On 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_STATISTICS "Track statistics for allocations and operations" Off)
option(ENABLE_COVERAGE "Enable code coverage (with GCC)" Off)
option(ENABLE_TOOLS "Enable Umpire Development Tools" On)
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 ()
################################
# 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()
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)
set(UMPIRE_TESTS_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tests)
add_subdirectory(tests)
endif ()
if (ENABLE_BENCHMARKS)
set(UMPIRE_BENCHMARKS_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/benchmarks)
add_subdirectory(benchmarks)
endif ()
if (ENABLE_EXAMPLES)
set(UMPIRE_EXAMPLES_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/examples)
add_subdirectory(examples)
endif ()
if (ENABLE_TOOLS)
set(UMPIRE_TOOLS_OUTPUT_DIR ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tools)
add_subdirectory(tools)
endif ()
if (ENABLE_DOCS)
add_subdirectory(docs)
endif ()