From 9d4e3b764292bffa852e336bdb123a58c1b6d99b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1nos=20Benjamin=20Antal?= Date: Wed, 15 Nov 2023 11:18:53 +0000 Subject: [PATCH] Install well-known protobuf types --- contrib/google-protobuf-cmake/CMakeLists.txt | 16 ++++++++++++++++ packages/clickhouse-common-static.yaml | 2 ++ programs/CMakeLists.txt | 7 +++++++ 3 files changed, 25 insertions(+) diff --git a/contrib/google-protobuf-cmake/CMakeLists.txt b/contrib/google-protobuf-cmake/CMakeLists.txt index b585b06b0600..be636536ff8a 100644 --- a/contrib/google-protobuf-cmake/CMakeLists.txt +++ b/contrib/google-protobuf-cmake/CMakeLists.txt @@ -320,9 +320,25 @@ endif () include("${ClickHouse_SOURCE_DIR}/contrib/google-protobuf-cmake/protobuf_generate.cmake") +# These files needs to be installed to make it possible that users can use well-known protobuf types +set(google_proto_files + ${protobuf_source_dir}/src/google/protobuf/any.proto + ${protobuf_source_dir}/src/google/protobuf/api.proto + ${protobuf_source_dir}/src/google/protobuf/descriptor.proto + ${protobuf_source_dir}/src/google/protobuf/duration.proto + ${protobuf_source_dir}/src/google/protobuf/empty.proto + ${protobuf_source_dir}/src/google/protobuf/field_mask.proto + ${protobuf_source_dir}/src/google/protobuf/source_context.proto + ${protobuf_source_dir}/src/google/protobuf/struct.proto + ${protobuf_source_dir}/src/google/protobuf/timestamp.proto + ${protobuf_source_dir}/src/google/protobuf/type.proto + ${protobuf_source_dir}/src/google/protobuf/wrappers.proto +) + add_library(_protobuf INTERFACE) target_link_libraries(_protobuf INTERFACE _libprotobuf) target_include_directories(_protobuf INTERFACE "${Protobuf_INCLUDE_DIR}") +set_target_properties(_protobuf PROPERTIES google_proto_files "${google_proto_files}") add_library(ch_contrib::protobuf ALIAS _protobuf) add_library(_protoc INTERFACE) diff --git a/packages/clickhouse-common-static.yaml b/packages/clickhouse-common-static.yaml index 95532726d945..238126f95fda 100644 --- a/packages/clickhouse-common-static.yaml +++ b/packages/clickhouse-common-static.yaml @@ -44,6 +44,8 @@ contents: dst: /usr/bin/clickhouse-odbc-bridge - src: root/usr/share/bash-completion/completions dst: /usr/share/bash-completion/completions +- src: root/usr/share/clickhouse + dst: /usr/share/clickhouse # docs - src: ../AUTHORS dst: /usr/share/doc/clickhouse-common-static/AUTHORS diff --git a/programs/CMakeLists.txt b/programs/CMakeLists.txt index c8c5b5bb7c94..3b62ed72768b 100644 --- a/programs/CMakeLists.txt +++ b/programs/CMakeLists.txt @@ -460,3 +460,10 @@ endif() if (ENABLE_FUZZING) add_compile_definitions(FUZZING_MODE=1) endif () + +if (TARGET ch_contrib::protobuf) + get_property(google_proto_files TARGET ch_contrib::protobuf PROPERTY INTERFACE_google_proto_files) + foreach (proto_file IN LISTS google_proto_files) + install(FILES ${proto_file} DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/clickhouse/proto/google/protobuf) + endforeach() +endif ()