-
Notifications
You must be signed in to change notification settings - Fork 368
/
CMakeLists.txt
114 lines (95 loc) · 3.53 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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
if (COMPILER_CLANG)
set (CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} --ld-path=${LLD_WRAPPER}")
endif ()
option(ENABLE_LOCAL_FORMATS "Use ORC/Parquet input formats defined in utils/local-engine/, notice that it is not stable and has some known issues. We suggest setting it to OFF in production environment." OFF)
if (ENABLE_LOCAL_FORMATS)
add_definitions(-DENABLE_LOCAL_FORMATS=1)
else()
add_definitions(-DENABLE_LOCAL_FORMATS=0)
endif()
set(THRIFT_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/thrift/lib/cpp/src")
# Find java/jni
include(FindJava)
include(UseJava)
include(FindJNI)
#set(JNI_NATIVE_SOURCES local_engine_jni.cpp)
set(LOCALENGINE_SHARED_LIB ch)
set (ENABLE_CURL_BUILD OFF)
add_subdirectory(proto)
add_headers_and_sources(builder Builder)
add_headers_and_sources(parser Parser)
add_headers_and_sources(storages Storages)
add_headers_and_sources(storages Storages/Output)
add_headers_and_sources(common Common)
add_headers_and_sources(external External)
add_headers_and_sources(shuffle Shuffle)
add_headers_and_sources(operator Operator)
add_headers_and_sources(jni jni)
add_headers_and_sources(aggregate_functions AggregateFunctions)
include_directories(
${JNI_INCLUDE_DIRS}
${CMAKE_CURRENT_BINARY_DIR}/proto
${THRIFT_INCLUDE_DIR}
${CMAKE_BINARY_DIR}/contrib/thrift-cmake
${CMAKE_CURRENT_SOURCE_DIR}
${ClickHouse_SOURCE_DIR}/src
${ClickHouse_SOURCE_DIR}/base
${ClickHouse_SOURCE_DIR}/contrib/orc/c++/include
${CMAKE_BINARY_DIR}/contrib/orc/c++/include
${ClickHouse_SOURCE_DIR}/contrib/azure/sdk/storage/azure-storage-blobs/inc
${ClickHouse_SOURCE_DIR}/contrib/azure/sdk/core/azure-core/inc
${ClickHouse_SOURCE_DIR}/contrib/azure/sdk/storage/azure-storage-common/inc
)
if (ENABLE_LOCAL_FORMATS)
add_subdirectory(Storages/ch_parquet)
endif()
add_subdirectory(Storages/SubstraitSource)
add_subdirectory(Functions)
add_library(gluten_clickhouse_backend_libs
${builder_sources}
${parser_sources}
${storages_sources}
${common_sources}
${external_sources}
${shuffle_sources}
${operator_sources}
${aggregate_functions_sources})
target_link_libraries(gluten_clickhouse_backend_libs PUBLIC
substait_source # compile options from substait_source
clickhouse_aggregate_functions
clickhouse_functions
gluten_spark_functions
ch_contrib::xxHash
)
add_library(${LOCALENGINE_SHARED_LIB} SHARED
${jni_sources}
local_engine_jni.cpp
$<TARGET_OBJECTS:clickhouse_malloc>) # why add clickhouse_malloc? check clickhouse PR-8046
target_compile_options(${LOCALENGINE_SHARED_LIB} PUBLIC -fPIC
-Wno-shorten-64-to-32)
target_link_libraries(${LOCALENGINE_SHARED_LIB}
PUBLIC
clickhouse_new_delete
clickhouse_common_config
clickhouse_common_io
clickhouse_parsers
clickhouse_storages_system
loggers
gluten_clickhouse_backend_libs
ch_contrib::protobuf
PRIVATE
substrait
)
if (ENABLE_LOCAL_FORMATS)
target_link_libraries(${LOCALENGINE_SHARED_LIB} PUBLIC ch_parquet)
endif ()
if (ENABLE_JEMALLOC)
target_link_options(${LOCALENGINE_SHARED_LIB} PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libch.map -Wl,-Bsymbolic-functions)
else()
target_link_options(${LOCALENGINE_SHARED_LIB} PRIVATE
-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/libch-hide-jemalloc.map)
endif()
if (ENABLE_TESTS)
add_subdirectory(tests)
endif ()