-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
79 lines (64 loc) · 2.87 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
# SPDX-FileCopyrightText: 2024 Baptiste Legouix
# SPDX-License-Identifier: GPL-3.0-or-later
cmake_minimum_required(VERSION 3.22)
project(SimiLie VERSION 0.0.0 LANGUAGES CXX)
set_property(GLOBAL PROPERTY GLOBAL_DEPENDS_NO_CYCLES ON)
set(CMAKE_CXX_STANDARD 23 CACHE INTERNAL "The C++ standard whose features are requested to build this project.")
# List of options
option(SIMILIE_BUILD_DOCUMENTATION "Build DDC documentation/website" OFF)
# Set default DDC options when included
option(DDC_BUILD_BENCHMARKS "Build DDC benchmarks." OFF)
option(DDC_BUILD_DOCUMENTATION "Build DDC documentation/website" OFF)
option(DDC_BUILD_EXAMPLES "Build DDC examples" OFF)
option(DDC_BUILD_TESTS "Build DDC tests if BUILD_TESTING is enabled" OFF)
# Custom variables
if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/irreps_dict.bin)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/irreps_dict.bin "")
endif()
add_compile_definitions("IRREPS_DICT_PATH=\"${CMAKE_CURRENT_BINARY_DIR}/irreps_dict.bin\"")
# Dependencies
## Use CTest for running tests
include(CTest)
## if tests are enabled, use googletest from `vendor/`
### we use it to write unit tests
if("${BUILD_TESTING}")
set(SIMILIE_GTest_DEPENDENCY_POLICY "AUTO" CACHE STRING "Policy to find the `GTest` package. Options: ${SIMILIE_DEPENDENCY_POLICIES}")
set_property(CACHE SIMILIE_GTest_DEPENDENCY_POLICY PROPERTY STRINGS ${SIMILIE_DEPENDENCY_POLICIES})
if("${SIMILIE_GTest_DEPENDENCY_POLICY}" STREQUAL "AUTO")
find_package(GTest "1.15" QUIET)
if(NOT "${GTest_FOUND}")
add_subdirectory("vendor/googletest/" "googletest") # SYSTEM)
endif()
elseif("${SIMILIE_GTest_DEPENDENCY_POLICY}" STREQUAL "EMBEDDED")
add_subdirectory("vendor/googletest/" "googletest") # SYSTEM)
elseif("${SIMILIE_GTest_DEPENDENCY_POLICY}" STREQUAL "INSTALLED")
find_package(GTest "1.15" REQUIRED)
endif()
endif()
## Use the discrete domain computation library (ddc) from `vendor/`
add_subdirectory("vendor/ddc/" "ddc") # SYSTEM)
## Doxygen
if("${SIMILIE_BUILD_DOCUMENTATION}")
find_package(Doxygen 1.8.13 REQUIRED OPTIONAL_COMPONENTS dot)
endif()
###############################################################################################
# Build libraries and executables
###############################################################################################
# Our project code
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
add_library(similie INTERFACE)
add_library(sil::sil ALIAS similie)
target_compile_features(similie INTERFACE cxx_std_23)
target_include_directories(
similie
INTERFACE
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:include>"
)
target_link_libraries(similie INTERFACE DDC)
add_subdirectory(include/similie)
add_subdirectory(tests)
add_subdirectory(examples)
if("${SIMILIE_BUILD_DOCUMENTATION}")
add_subdirectory(docs/)
endif()