forked from apache/incubator-gluten
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
27 lines (22 loc) · 1.23 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
file(GLOB protobuf_files
substrait/*.proto
substrait/extensions/*.proto
)
FOREACH(FIL ${protobuf_files})
file(RELATIVE_PATH FIL_RELATIVE ${ClickHouse_SOURCE_DIR}/utils/extern-local-engine/proto/ ${FIL})
string(REGEX REPLACE "\\.proto" "" FILE_NAME ${FIL_RELATIVE})
LIST(APPEND SUBSTRAIT_SRCS "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.pb.cc")
LIST(APPEND SUBSTRAIT_HEADERS "${CMAKE_CURRENT_BINARY_DIR}/${FILE_NAME}.pb.h")
ENDFOREACH()
add_custom_target(
generate_substrait
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/../../../contrib/google-protobuf-cmake/protoc -I${CMAKE_CURRENT_SOURCE_DIR} -I${ClickHouse_SOURCE_DIR}/contrib/google-protobuf/src --cpp_out=${CMAKE_CURRENT_BINARY_DIR}/ ${protobuf_files}
DEPENDS protoc
COMMENT "Running cpp protocol buffer compiler"
VERBATIM )
set_source_files_properties(${SUBSTRAIT_SRCS} PROPERTIES GENERATED TRUE)
add_library(substrait ${SUBSTRAIT_SRCS})
add_dependencies(substrait generate_substrait)
target_compile_options(substrait PUBLIC -fPIC -Wno-reserved-identifier -Wno-deprecated -Wno-shadow-field)
target_include_directories(substrait SYSTEM BEFORE PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(substrait ch_contrib::protobuf)