forked from odygrd/logger_benchmarks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
68 lines (60 loc) · 2.54 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
cmake_minimum_required(VERSION 3.1.0)
project(logger_benchmarks)
set(CMAKE_CXX_FLAGS "-m64 -std=c++17 -march=native" CACHE STRING "" FORCE)
set(BUILD_SHARED_LIBS "OFF")
option(ENABLE_LTO "Enable link-time optimisation" ON)
if (ENABLE_LTO)
# CMake's INTERPROCEDURAL_OPTIMIZATION feature isn't used as it does not
# use gcc-ranlib and gcc-ar (as recommended by
# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html).
add_compile_options(-flto)
add_link_options(-flto)
if (CMAKE_CXX_COMPILER_ID MATCHES ".*GNU")
find_program(GCC_AR gcc-ar)
if (GCC_AR)
set(CMAKE_AR ${GCC_AR})
endif()
find_program(GCC_RANLIB gcc-ranlib)
if (GCC_RANLIB)
set(CMAKE_RANLIB ${GCC_RANLIB})
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")
find_program(LLVM_AR llvm-ar)
if (LLVM_AR)
set(CMAKE_AR ${LLVM_AR})
endif()
find_program(LLVM_RANLIB llvm-ranlib)
if (LLVM_RANLIB)
set(CMAKE_RANLIB ${LLVM_RANLIB})
endif()
endif()
endif()
#-------------------------------------------------------------------------------------------------------
# Set default build to release
#-------------------------------------------------------------------------------------------------------
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build" FORCE)
endif ()
#---------------------------------------------------------------------------------------
# Compiler config
#---------------------------------------------------------------------------------------
if (NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
endif ()
#-------------------------------------------------------------------------------------------------------
# Required Packages
#-------------------------------------------------------------------------------------------------------
find_package(Threads REQUIRED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -march=native")
#---------------------------------------------------------------------------------------
# Subdirectories
#-------------------------------------------------------------------------------------------------------
add_subdirectory(third_party/quill)
add_subdirectory(third_party/iyengar_nanolog)
add_subdirectory(third_party/reckless)
add_subdirectory(third_party/platformlab_nanolog)
add_subdirectory(third_party/g3log)
add_subdirectory(third_party/ms_binlog)
add_subdirectory(third_party/xtr)
add_subdirectory(benchmarks)