-
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
132 lines (109 loc) · 3.46 KB
/
CMakeLists.txt
File metadata and controls
132 lines (109 loc) · 3.46 KB
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_minimum_required(VERSION 3.16)
project(blaze VERSION 0.0.1 LANGUAGES CXX
DESCRIPTION "The ultra high-performance JSON Schema evaluator"
HOMEPAGE_URL "https://github.com/sourcemeta/blaze")
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Options
option(BLAZE_COMPILER "Build the Blaze compiler library" ON)
option(BLAZE_EVALUATOR "Build the Blaze evaluator library" ON)
option(BLAZE_OUTPUT "Build the Blaze output formats library" ON)
option(BLAZE_LINTER "Build the Blaze linter rule library" ON)
option(BLAZE_TEST "Build the Blaze test runner library" ON)
option(BLAZE_CONFIGURATION "Build the Blaze configuration file library" ON)
option(BLAZE_TESTS "Build the Blaze tests" OFF)
option(BLAZE_BENCHMARK "Build the Blaze benchmarks" OFF)
option(BLAZE_CONTRIB "Build the Blaze contrib programs" OFF)
option(BLAZE_DOCS "Build the Blaze docs" OFF)
option(BLAZE_INSTALL "Install the Blaze library" ON)
option(BLAZE_ADDRESS_SANITIZER "Build Blaze with an address sanitizer" OFF)
option(BLAZE_UNDEFINED_SANITIZER "Build Blaze with an undefined behavior sanitizer" OFF)
if(BLAZE_INSTALL)
include(GNUInstallDirs)
include(CMakePackageConfigHelpers)
configure_package_config_file(
config.cmake.in
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}")
write_basic_package_version_file(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
COMPATIBILITY SameMajorVersion)
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}"
COMPONENT sourcemeta_blaze_dev)
endif()
find_package(Core REQUIRED)
# Don't force downstream consumers on it
if(PROJECT_IS_TOP_LEVEL)
sourcemeta_enable_simd()
endif()
if(BLAZE_COMPILER)
add_subdirectory(src/compiler)
endif()
if(BLAZE_EVALUATOR)
add_subdirectory(src/evaluator)
endif()
if(BLAZE_OUTPUT)
add_subdirectory(src/output)
endif()
if(BLAZE_LINTER)
add_subdirectory(src/linter)
endif()
if(BLAZE_TEST)
add_subdirectory(src/test)
endif()
if(BLAZE_CONFIGURATION)
add_subdirectory(src/configuration)
endif()
if(BLAZE_CONTRIB)
add_subdirectory(contrib)
endif()
if(BLAZE_ADDRESS_SANITIZER)
sourcemeta_sanitizer(TYPE address)
elseif(BLAZE_UNDEFINED_SANITIZER)
sourcemeta_sanitizer(TYPE undefined)
endif()
if(BLAZE_DOCS)
sourcemeta_target_doxygen(CONFIG "${PROJECT_SOURCE_DIR}/doxygen/Doxyfile.in"
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/website")
endif()
if(PROJECT_IS_TOP_LEVEL)
sourcemeta_target_clang_format(SOURCES
contrib/*.cc
src/*.h src/*.cc
benchmark/*.h benchmark/*.cc
test/*.h test/*.cc)
endif()
# Testing
if(BLAZE_TESTS)
enable_testing()
if(BLAZE_COMPILER)
add_subdirectory(test/compiler)
endif()
if(BLAZE_EVALUATOR)
add_subdirectory(test/evaluator)
endif()
if(BLAZE_OUTPUT)
add_subdirectory(test/output)
endif()
if(BLAZE_LINTER)
add_subdirectory(test/linter)
endif()
if(BLAZE_TEST)
add_subdirectory(test/test)
endif()
if(BLAZE_CONFIGURATION)
add_subdirectory(test/configuration)
endif()
if(PROJECT_IS_TOP_LEVEL)
# Otherwise we need the child project to link
# against the sanitizers too.
if(NOT BLAZE_ADDRESS_SANITIZER AND NOT BLAZE_UNDEFINED_SANITIZER)
add_subdirectory(test/packaging)
endif()
endif()
if(BLAZE_BENCHMARK)
add_subdirectory(benchmark)
endif()
endif()