-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
125 lines (97 loc) · 3.28 KB
/
CMakeLists.txt
File metadata and controls
125 lines (97 loc) · 3.28 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
cmake_minimum_required(VERSION 3.16)
project(SigmodContest)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
Include(FetchContent)
FetchContent_Declare(
Catch2
URL https://github.com/catchorg/Catch2/archive/refs/tags/v3.8.0.tar.gz
)
FetchContent_MakeAvailable(Catch2)
FetchContent_Declare(
abseil
URL https://github.com/abseil/abseil-cpp/releases/download/20240722.1/abseil-cpp-20240722.1.tar.gz
)
set(ABSL_PROPAGATE_CXX_STD ON)
set(ABSL_ENABLE_INSTALL ON)
FetchContent_MakeAvailable(abseil)
FetchContent_Declare(
re2
URL https://github.com/google/re2/releases/download/2024-07-02/re2-2024-07-02.tar.gz
)
FetchContent_MakeAvailable(re2)
FetchContent_Declare(
json
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz
)
FetchContent_MakeAvailable(json)
FetchContent_Declare(
sql-parser
URL https://github.com/a858438680/sql-parser/archive/refs/tags/win-port-2.tar.gz
)
set(HSQL_ENABLE_WERROR OFF)
FetchContent_MakeAvailable(sql-parser)
FetchContent_Declare(
range-v3
URL https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz
)
FetchContent_MakeAvailable(range-v3)
FetchContent_Declare(
fmtlib
URL https://github.com/fmtlib/fmt/releases/download/11.1.3/fmt-11.1.3.zip
)
FetchContent_MakeAvailable(fmtlib)
FetchContent_Declare(
duckdb
URL https://github.com/duckdb/duckdb/archive/refs/tags/v1.2.0.tar.gz
)
set(ENABLE_SANITIZER OFF)
set(ENABLE_UBSAN OFF)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc|powerpc|ppc64|ppc64le")
message("Disabling jemalloc extension of DuckDB on Power.")
set(SKIP_EXTENSIONS jemalloc)
endif()
FetchContent_MakeAvailable(duckdb)
# Include all sources from /src directory. CONFIGURE_DEPENDS can be unreliable.
# Try re-running cmake in case changes are not recognized.
file(GLOB SIGMODPC_SRC
CONFIGURE_DEPENDS
"src/*.cpp"
)
add_executable(
run
${SIGMODPC_SRC}
tests/read_sql.cpp
)
target_include_directories(run PRIVATE include)
target_link_libraries(run PRIVATE re2 fmt range-v3 nlohmann_json::nlohmann_json sqlparser duckdb)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(run PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
# Enable server-specific compiler optimizations.
# Use march=native for all but Power servers, which results in the following error:
# clang++-18: error: unsupported option '-march=' for target 'powerpc64le-unknown-linux-gnu'
# This flag works on other Power systems, but for now, we disable march=native on all Power machines.
if(NOT CMAKE_SYSTEM_PROCESSOR MATCHES "ppc|powerpc|ppc64|ppc64le")
add_compile_options(-march=native)
endif()
add_executable(
build_database
tests/build_database.cpp
)
target_include_directories(build_database PRIVATE include)
target_link_libraries(build_database PRIVATE fmt duckdb)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(build_database PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()
add_executable(
unit_tests
${SIGMODPC_SRC}
tests/unit_tests.cpp
)
target_include_directories(unit_tests PRIVATE include)
target_link_libraries(unit_tests PRIVATE range-v3 fmt Catch2::Catch2WithMain duckdb)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
target_compile_definitions(unit_tests PRIVATE _CRT_SECURE_NO_WARNINGS)
endif()