forked from celeritas-project/celeritas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
132 lines (115 loc) · 3.5 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
#----------------------------------*-CMake-*----------------------------------#
# Copyright 2022-2024 UT-Battelle, LLC, and other Celeritas developers.
# See the top-level COPYRIGHT file for details.
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
#-----------------------------------------------------------------------------#
set(SOURCES)
set(PRIVATE_DEPS)
set(PUBLIC_DEPS)
#-----------------------------------------------------------------------------#
# Main code
#-----------------------------------------------------------------------------#
list(APPEND SOURCES
Assert.cc
data/Copier.cc
data/DeviceAllocation.cc
data/PinnedAllocator.cc
io/BuildOutput.cc
io/ColorUtils.cc
io/ExceptionOutput.cc
io/Label.cc
io/LogContextException.cc
io/Logger.cc
io/LoggerTypes.cc
io/OutputInterface.cc
io/OutputRegistry.cc
io/ScopedStreamRedirect.cc
io/ScopedTimeAndRedirect.cc
io/StringUtils.cc
io/detail/EnumStringMapperImpl.cc
io/detail/LoggerMessage.cc
io/detail/ReprImpl.cc
sys/Device.cc
sys/Environment.cc
sys/KernelRegistry.cc
sys/MemRegistry.cc
sys/ScopedMem.cc
sys/MpiCommunicator.cc
sys/MultiExceptionHandler.cc
sys/ScopedMpiInit.cc
sys/ScopedSignalHandler.cc
sys/Stream.cc
sys/TypeDemangler.cc
sys/Version.cc
)
#-----------------------------------------------------------------------------#
# Configuration-dependent code/dependencies
#-----------------------------------------------------------------------------#
list(APPEND PRIVATE_DEPS Celeritas::DeviceToolkit)
if(CELERITAS_USE_CUDA OR CELERITAS_USE_HIP)
list(APPEND SOURCES
data/detail/Filler.cu
sys/KernelParamCalculator.device.cc
)
endif()
if(CELERITAS_USE_CUDA)
# we currently depend on CUDA install including the nvtx header
list(APPEND SOURCES
sys/ScopedLimitSaver.cuda.cc
sys/ScopedProfiling.cuda.cc
)
endif()
if(CELERITAS_USE_HIP)
list(APPEND SOURCES
sys/ScopedProfiling.hip.cc
)
endif()
if(CELERITAS_USE_JSON)
list(APPEND SOURCES
AssertIO.json.cc
io/JsonUtils.json.cc
sys/DeviceIO.json.cc
sys/KernelRegistryIO.json.cc
sys/MemRegistryIO.json.cc
)
list(APPEND PRIVATE_DEPS nlohmann_json::nlohmann_json)
endif()
if(CELERITAS_USE_MPI)
list(APPEND PUBLIC_DEPS MPI::MPI_CXX)
endif()
if(CELERITAS_USE_OpenMP)
list(APPEND PRIVATE_DEPS OpenMP::OpenMP_CXX)
endif()
#-----------------------------------------------------------------------------#
# Create library
#-----------------------------------------------------------------------------#
celeritas_add_library(corecel ${SOURCES})
# Require at least C++17
target_compile_features(corecel PUBLIC cxx_std_17)
if(CELERITAS_USE_CUDA)
target_compile_features(corecel PUBLIC cuda_std_17)
endif()
if(WIN32)
target_compile_definitions(corecel PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:NOMINMAX NOGDI>
)
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# __cplusplus: use standard-compliant C++ version macro
# preprocessor: use standard-compliant preprocessor
# EHsc: enable standard C++ exception handling
target_compile_options(corecel PUBLIC
$<$<COMPILE_LANGUAGE:CXX>:/Zc:__cplusplus /Zc:preprocessor /EHsc>
)
endif()
endif()
celeritas_target_include_directories(corecel
PUBLIC
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>"
"$<BUILD_INTERFACE:${CELERITAS_HEADER_CONFIG_DIRECTORY}>"
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>"
)
celeritas_target_link_libraries(corecel
PRIVATE ${PRIVATE_DEPS}
PUBLIC ${PUBLIC_DEPS}
)
#-----------------------------------------------------------------------------#