-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
81 lines (62 loc) · 2.55 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
###################################################################################################
# Copyright (c) 2021, Lawrence Livermore National Security, LLC and LvArray contributors.
# All rights reserved.
# See the LICENSE file for details.
# SPDX-License-Identifier: (BSD-3-Clause)
###################################################################################################
cmake_minimum_required( VERSION 3.23.1 )
# Set version number
set( SHIVA_VERSION_MAJOR 0 )
set( SHIVA_VERSION_MINOR 1 )
set( SHIVA_VERSION_PATCHLEVEL 0 )
# check if Shiva is build as a submodule or a separate project
get_directory_property( parent_dir PARENT_DIRECTORY )
if(parent_dir)
set( is_submodule ON )
else()
set( is_submodule OFF )
endif()
if( NOT is_submodule )
message( "not a submodule")
project( Shiva LANGUAGES CXX C )
set( BLT_CXX_STD "c++17" CACHE STRING "Version of C++ standard" FORCE )
set( ENABLE_WARNINGS_AS_ERRORS "ON" CACHE PATH "" )
option( SHIVA_ENABLE_UNIT_TESTS "Builds tests" ON )
option( SHIVA_ENABLE_EXAMPLES "Builds examples" ON )
option( SHIVA_ENABLE_BENCHMARKS "Builds benchmarks" ON )
option( SHIVA_ENABLE_DOCS "Builds documentation" ON )
option( ENABLE_CUDA "Build with CUDA" OFF )
option( ENABLE_HIP "Build with HIP" OFF )
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}/cmake/blt CACHE PATH "" )
if( NOT EXISTS ${BLT_SOURCE_DIR}/SetupBLT.cmake )
message( FATAL_ERROR "The BLT submodule is not present. If in git repository run the following two commands:\n \
git submodule init\n \
git submodule update" )
endif ()
endif ()
include( ${BLT_SOURCE_DIR}/SetupBLT.cmake )
endif()
include( cmake/CMakeBasics.cmake )
#include( cmake/SetupTPL.cmake )
else()
if( NOT BLT_LOADED )
message( FATAL_ERROR "When using Shiva as a submodule you must have already loaded BLT." )
endif()
include( cmake/CMakeBasics.cmake )
endif()
include( cmake/Macros.cmake )
include( cmake/Config.cmake )
add_subdirectory( src )
add_subdirectory( tpl/camp )
target_compile_options( camp PRIVATE "-Wno-shadow")
configure_file(tpl/camp/include/camp/config.in.hpp
${PROJECT_BINARY_DIR}/include/camp/config.hpp)
if( SHIVA_ENABLE_DOCS )
add_subdirectory( docs )
endif()