forked from microsoft/ALEX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
67 lines (52 loc) · 2.3 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
cmake_minimum_required(VERSION 3.14)
include(FetchContent)
project(alex)
set(CMAKE_CXX_STANDARD 17)
# Install boost
add_subdirectory(boost-cmake)
# Define the macro ‘DEBUG' in the debug mode
if(CMAKE_BUILD_TYPE STREQUAL Debug)
ADD_DEFINITIONS(-DDEBUG)
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/O2 /arch:AVX2 /W1 /EHsc")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Intel")
set(CMAKE_CXX_FLAGS "-O3 -xHost")
else()
# clang and gcc
set(CMAKE_CXX_FLAGS "-O3 -march=native -Wall -Wextra")
endif()
include_directories(src/core)
add_executable(example src/examples/main.cpp)
target_link_libraries(example PUBLIC Boost::serialization)
target_link_libraries(example PUBLIC Boost::iostreams)
add_executable(boost_demo src/examples/boost_demo.cpp)
target_link_libraries(boost_demo PUBLIC Boost::serialization)
target_link_libraries(boost_demo PUBLIC Boost::iostreams)
add_executable(alex_serde_demo src/examples/alex_serde_demo.cpp)
target_link_libraries(alex_serde_demo PUBLIC Boost::serialization)
target_link_libraries(alex_serde_demo PUBLIC Boost::iostreams)
add_executable(benchmark src/benchmark/main.cpp)
target_link_libraries(benchmark PUBLIC Boost::serialization)
target_link_libraries(benchmark PUBLIC Boost::iostreams)
add_executable(kv_build src/benchmark/kv_build.cpp)
target_link_libraries(kv_build PUBLIC Boost::serialization)
target_link_libraries(kv_build PUBLIC Boost::iostreams)
add_executable(kv_benchmark src/benchmark/kv_benchmark.cpp)
target_link_libraries(kv_benchmark PUBLIC Boost::serialization)
target_link_libraries(kv_benchmark PUBLIC Boost::iostreams)
add_executable(kv_benchmark_rw src/benchmark/kv_benchmark_rw.cpp)
target_link_libraries(kv_benchmark_rw PUBLIC Boost::serialization)
target_link_libraries(kv_benchmark_rw PUBLIC Boost::iostreams)
set(DOCTEST_DOWNLOAD_DIR ${CMAKE_CURRENT_BINARY_DIR}/doctest)
file(DOWNLOAD
https://raw.githubusercontent.com/onqtam/doctest/2.4.6/doctest/doctest.h
${DOCTEST_DOWNLOAD_DIR}/doctest.h
EXPECTED_HASH SHA1=40728d2bed7f074e80cb095844820114e7d16ce0
)
add_executable(test_alex test/unittest_main.cpp)
target_include_directories(test_alex PRIVATE ${DOCTEST_DOWNLOAD_DIR})
target_link_libraries(test_alex PUBLIC Boost::serialization)
target_link_libraries(test_alex PUBLIC Boost::iostreams)
enable_testing()
add_test(test_alex test_alex)