-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathCMakeLists.txt
58 lines (50 loc) · 1.79 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
cmake_minimum_required(VERSION 3.10)
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
project(experimental_json_builder
VERSION 0.0.1
DESCRIPTION "Serializing gigabytes of JSON per second"
HOMEPAGE_URL "https://simdjson.org/"
LANGUAGES CXX
)
option(SIMDJSON_SERIALIZER_SANITIZE_MEMORY "Sanitize memory" OFF)
if(SIMDJSON_SERIALIZER_SANITIZE_MEMORY)
message(STATUS "Setting the memory sanitizer.")
add_compile_options(
-fsanitize=memory -fno-sanitize-recover=all
)
link_libraries(
-fsanitize=memory -fno-sanitize-recover=all
)
endif()
if(NOT CMAKE_BUILD_TYPE)
if(SIMDJSON_SANITIZE OR SIMDJSON_SANITIZE_UNDEFINED)
message(STATUS "No build type selected and you have enabled the sanitizer, \
default to Debug. Consider setting CMAKE_BUILD_TYPE.")
message(STATUS "Setting debug optimization flag to -O1 to help sanitizer.")
set(CMAKE_CXX_FLAGS_DEBUG "-O1" CACHE STRING "" FORCE)
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE)
else()
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
endif()
add_library(simdjson_serialization INTERFACE)
add_library(simdjson::serialization ALIAS simdjson_serialization)
target_compile_options(simdjson_serialization INTERFACE -freflection -stdlib=libc++ -std=c++26)
target_include_directories(
simdjson_serialization
INTERFACE
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
include(cmake/CPM.cmake)
CPMAddPackage(
NAME simdjson
GITHUB_REPOSITORY simdjson/simdjson
GIT_TAG builder_development_branch
) # include simdjson
add_subdirectory(examples)
add_subdirectory(benchmarks)
enable_testing()
add_subdirectory(tests)