forked from georgia-tech-db/buzzdb-snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
91 lines (69 loc) · 3.29 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
80
81
82
83
84
85
86
87
88
89
90
91
# ---------------------------------------------------------------------------
# BUZZDB
# ---------------------------------------------------------------------------
cmake_minimum_required(VERSION 3.10)
# ---------------------------------------------------------------------------
# Environment
# ---------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 17) # C++17
set(CMAKE_CXX_STANDARD_REQUIRED ON) # C++17 support
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Clang-tidy.
set(BUILD_SHARED_LIBS ON)
project(BuzzDB
VERSION 2020
DESCRIPTION "BuzzDB Database Management System (Educational)"
LANGUAGES C CXX
)
# ---------------------------------------------------------------------------
# Platform
# ---------------------------------------------------------------------------
if(UNIX)
else()
message(SEND_ERROR "Unsupported platform")
endif()
# ---------------------------------------------------------------------------
# Dependencies
# ---------------------------------------------------------------------------
find_package(Threads REQUIRED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wextra -Werror -march=native -Wno-strict-aliasing")
# ---------------------------------------------------------------------------
# BISON/FLEX
# ---------------------------------------------------------------------------
find_package(BISON REQUIRED)
find_package(FLEX REQUIRED)
BISON_TARGET(mc_parser
mc_parser.yy
${CMAKE_CURRENT_BINARY_DIR}/mc_parser.tab.cc)
FLEX_TARGET(mc_lexer
mc_lexer.l
${CMAKE_CURRENT_BINARY_DIR}/mc_lexer.yy.cc)
ADD_FLEX_BISON_DEPENDENCY(mc_lexer mc_parser)
# ---------------------------------------------------------------------------
# Scripts
# ---------------------------------------------------------------------------
set(SCRIPT_DIR "${CMAKE_SOURCE_DIR}/script")
include("${SCRIPT_DIR}/clang-format.cmake")
include("${SCRIPT_DIR}/valgrind.cmake")
# ---------------------------------------------------------------------------
# Sources
# ---------------------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/src/CMakeLists.txt")
# ---------------------------------------------------------------------------
# Test
# ---------------------------------------------------------------------------
include("${CMAKE_SOURCE_DIR}/test/CMakeLists.txt")
# ---------------------------------------------------------------------------
# Configuration
# ---------------------------------------------------------------------------
message(STATUS "BuzzDB settings")
message(STATUS " GFLAGS_INCLUDE_DIR = ${GFLAGS_INCLUDE_DIR}")
message(STATUS " GFLAGS_LIBRARY_PATH = ${GFLAGS_LIBRARY_PATH}")
message(STATUS "[TEST] settings")
message(STATUS " GTEST_INCLUDE_DIR = ${GTEST_INCLUDE_DIR}")
message(STATUS " GTEST_LIBRARY_PATH = ${GTEST_LIBRARY_PATH}")
message(STATUS " VALGRIND_BIN = ${VALGRIND_BIN}")
message(STATUS " VALGRIND_SUPPRESSIONS_FILE = ${VALGRIND_SUPPRESSIONS_FILE}")
message(STATUS " CLANG_FORMAT_BIN = ${CLANG_FORMAT_BIN}")