-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
128 lines (114 loc) · 4.33 KB
/
Copy pathCMakeLists.txt
File metadata and controls
128 lines (114 loc) · 4.33 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
126
127
128
cmake_minimum_required(VERSION 3.20)
project(columnar_engine LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
option(COLUMNAR_BUILD_TESTS "Build tests" ON)
option(COLUMNAR_ENABLE_NATIVE "Build engine code with -march=native when supported" ON)
option(COLUMNAR_ENABLE_IPO "Enable interprocedural optimization/LTO when supported" ON)
set(COLUMNAR_ALLOCATOR "auto" CACHE STRING "Allocator to link into executables: auto, none, mimalloc, jemalloc")
set_property(CACHE COLUMNAR_ALLOCATOR PROPERTY STRINGS auto none mimalloc jemalloc)
include(cmake/deps.cmake)
add_library(columnar_lib
src/core/column.cpp
src/core/encoding/auto_select.cpp
src/core/encoding/dictionary.cpp
src/core/encoding/rle.cpp
src/util/buffered_file.cpp
src/util/memory_mapped_file.cpp
src/util/compression.cpp
src/util/date_time.cpp
src/util/string_arena.cpp
src/csv/csv_batch_reader.cpp
src/csv/csv_batch_writer.cpp
src/csv/csv_row_reader.cpp
src/csv/schema_manager.cpp
src/bruh/bruh_batch_reader.cpp
src/bruh/bruh_batch_writer.cpp
src/exec/agg_state_buffer.cpp
src/exec/aggregation.cpp
src/exec/clickbench.cpp
src/exec/group_key_table.cpp
src/exec/group_key_table/composite.cpp
src/exec/group_key_table/int64.cpp
src/exec/group_key_table/int64_int64_string.cpp
src/exec/group_key_table/int64_pair.cpp
src/exec/group_key_table/int64_string.cpp
src/exec/group_key_table/string.cpp
src/exec/expression.cpp
src/exec/filter_operator.cpp
src/exec/global_aggregate_operator.cpp
src/exec/hash_aggregate_operator.cpp
src/exec/late_materialize_operator.cpp
src/exec/kernel/core.cpp
src/exec/kernel/arithm.cpp
src/exec/kernel/compare.cpp
src/exec/kernel/reduce.cpp
src/exec/kernel/string.cpp
src/exec/kernel/temporal.cpp
src/exec/metadata_pruning.cpp
src/exec/operator.cpp
src/exec/project_operator.cpp
src/exec/topn_operator.cpp
)
target_include_directories(columnar_lib PUBLIC ${PROJECT_SOURCE_DIR}/include)
target_include_directories(columnar_lib PRIVATE
${lz4_SOURCE_DIR}/lib
${zstd_SOURCE_DIR}/lib
)
target_link_libraries(columnar_lib
PUBLIC re2::re2
PRIVATE lz4_static libzstd_static absl::flat_hash_map)
target_compile_options(columnar_lib PRIVATE -Wall -Wextra -Wpedantic)
if(COLUMNAR_ENABLE_NATIVE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
target_compile_options(columnar_lib PRIVATE -march=native)
endif()
if(COLUMNAR_ENABLE_IPO)
include(CheckIPOSupported)
check_ipo_supported(RESULT COLUMNAR_IPO_SUPPORTED OUTPUT COLUMNAR_IPO_ERROR LANGUAGES CXX)
if(COLUMNAR_IPO_SUPPORTED)
set_property(TARGET columnar_lib PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
else()
message(STATUS "IPO/LTO not supported: ${COLUMNAR_IPO_ERROR}")
endif()
endif()
set(COLUMNAR_ALLOCATOR_LIBRARY "")
if(NOT COLUMNAR_ALLOCATOR STREQUAL "none")
if(COLUMNAR_ALLOCATOR STREQUAL "mimalloc" OR COLUMNAR_ALLOCATOR STREQUAL "auto")
find_library(COLUMNAR_MIMALLOC_LIBRARY NAMES mimalloc)
if(COLUMNAR_MIMALLOC_LIBRARY)
set(COLUMNAR_ALLOCATOR_LIBRARY "${COLUMNAR_MIMALLOC_LIBRARY}")
elseif(COLUMNAR_ALLOCATOR STREQUAL "mimalloc")
message(FATAL_ERROR "COLUMNAR_ALLOCATOR=mimalloc requested, but mimalloc was not found")
endif()
endif()
if(NOT COLUMNAR_ALLOCATOR_LIBRARY AND
(COLUMNAR_ALLOCATOR STREQUAL "jemalloc" OR COLUMNAR_ALLOCATOR STREQUAL "auto"))
find_library(COLUMNAR_JEMALLOC_LIBRARY NAMES jemalloc)
if(COLUMNAR_JEMALLOC_LIBRARY)
set(COLUMNAR_ALLOCATOR_LIBRARY "${COLUMNAR_JEMALLOC_LIBRARY}")
elseif(COLUMNAR_ALLOCATOR STREQUAL "jemalloc")
message(FATAL_ERROR "COLUMNAR_ALLOCATOR=jemalloc requested, but jemalloc was not found")
endif()
endif()
endif()
function(columnar_tune_executable target)
if(TARGET ${target})
if(COLUMNAR_ENABLE_IPO AND COLUMNAR_IPO_SUPPORTED)
set_property(TARGET ${target} PROPERTY INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE)
endif()
if(COLUMNAR_ALLOCATOR_LIBRARY)
target_link_libraries(${target} PRIVATE "${COLUMNAR_ALLOCATOR_LIBRARY}")
endif()
endif()
endfunction()
add_subdirectory(apps/converter)
add_subdirectory(apps/clickbench)
columnar_tune_executable(converter)
columnar_tune_executable(clickbench_runner)
if(COLUMNAR_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
columnar_tune_executable(columnar_tests)
endif()