2023-05-31 16:47:26 +00:00
|
|
|
option(ENABLE_PROTOBUF "Enable protobuf" ${ENABLE_LIBRARIES})
|
|
|
|
|
|
|
|
if(NOT ENABLE_PROTOBUF)
|
|
|
|
message(STATUS "Not using protobuf")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(Protobuf_INCLUDE_DIR "${ClickHouse_SOURCE_DIR}/contrib/google-protobuf/src")
|
|
|
|
if(OS_FREEBSD AND SANITIZE STREQUAL "address")
|
|
|
|
# ../contrib/protobuf/src/google/protobuf/arena_impl.h:45:10: fatal error: 'sanitizer/asan_interface.h' file not found
|
|
|
|
# #include <sanitizer/asan_interface.h>
|
|
|
|
if(LLVM_INCLUDE_DIRS)
|
|
|
|
set(Protobuf_INCLUDE_DIR "${Protobuf_INCLUDE_DIR}" ${LLVM_INCLUDE_DIRS})
|
|
|
|
else()
|
|
|
|
message(${RECONFIGURE_MESSAGE_LEVEL} "Can't use protobuf on FreeBSD with address sanitizer without LLVM")
|
|
|
|
return()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(protobuf_source_dir "${ClickHouse_SOURCE_DIR}/contrib/google-protobuf")
|
|
|
|
set(protobuf_binary_dir "${ClickHouse_BINARY_DIR}/contrib/google-protobuf")
|
|
|
|
|
|
|
|
add_definitions(-DGOOGLE_PROTOBUF_CMAKE_BUILD)
|
|
|
|
|
|
|
|
add_definitions(-DHAVE_PTHREAD)
|
|
|
|
add_definitions(-DHAVE_ZLIB)
|
|
|
|
|
|
|
|
include_directories(
|
|
|
|
${protobuf_binary_dir}
|
|
|
|
${protobuf_source_dir}/src)
|
|
|
|
|
2023-11-12 14:41:19 +00:00
|
|
|
add_library(utf8_range
|
|
|
|
${protobuf_source_dir}/third_party/utf8_range/naive.c
|
|
|
|
${protobuf_source_dir}/third_party/utf8_range/range2-neon.c
|
|
|
|
${protobuf_source_dir}/third_party/utf8_range/range2-sse.c
|
|
|
|
)
|
|
|
|
include_directories(${protobuf_source_dir}/third_party/utf8_range)
|
|
|
|
|
|
|
|
add_library(utf8_validity
|
|
|
|
${protobuf_source_dir}/third_party/utf8_range/utf8_validity.cc
|
|
|
|
)
|
|
|
|
target_link_libraries(utf8_validity PUBLIC absl::strings)
|
|
|
|
|
|
|
|
set(protobuf_absl_used_targets
|
|
|
|
absl::absl_check
|
|
|
|
absl::absl_log
|
|
|
|
absl::algorithm
|
|
|
|
absl::base
|
|
|
|
absl::bind_front
|
|
|
|
absl::bits
|
|
|
|
absl::btree
|
|
|
|
absl::cleanup
|
|
|
|
absl::cord
|
|
|
|
absl::core_headers
|
|
|
|
absl::debugging
|
|
|
|
absl::die_if_null
|
|
|
|
absl::dynamic_annotations
|
|
|
|
absl::flags
|
|
|
|
absl::flat_hash_map
|
|
|
|
absl::flat_hash_set
|
|
|
|
absl::function_ref
|
|
|
|
absl::hash
|
|
|
|
absl::layout
|
|
|
|
absl::log_initialize
|
|
|
|
absl::log_severity
|
|
|
|
absl::memory
|
|
|
|
absl::node_hash_map
|
|
|
|
absl::node_hash_set
|
|
|
|
absl::optional
|
|
|
|
absl::span
|
|
|
|
absl::status
|
|
|
|
absl::statusor
|
|
|
|
absl::strings
|
|
|
|
absl::synchronization
|
|
|
|
absl::time
|
|
|
|
absl::type_traits
|
|
|
|
absl::utility
|
|
|
|
absl::variant
|
|
|
|
)
|
|
|
|
|
2023-05-31 16:47:26 +00:00
|
|
|
set(libprotobuf_lite_files
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/any_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/arena.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/arena_align.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/arenastring.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/arenaz_sampler.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/map.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/message_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/parse_context.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(_libprotobuf-lite ${libprotobuf_lite_files})
|
2023-11-12 14:41:19 +00:00
|
|
|
target_link_libraries(_libprotobuf-lite
|
|
|
|
pthread
|
|
|
|
utf8_validity)
|
2023-05-31 16:47:26 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
|
|
|
target_link_libraries(_libprotobuf-lite log)
|
|
|
|
endif()
|
|
|
|
target_include_directories(_libprotobuf-lite SYSTEM PUBLIC ${protobuf_source_dir}/src)
|
|
|
|
add_library(protobuf::libprotobuf-lite ALIAS _libprotobuf-lite)
|
|
|
|
|
|
|
|
|
|
|
|
set(libprotobuf_files
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/any.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/api.pb.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/duration.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/empty.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/field_mask.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/source_context.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/struct.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/timestamp.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/type.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/wrappers.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/any.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/any_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/arena.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/arena_align.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/arenastring.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/arenaz_sampler.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/importer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/parser.cc
|
2023-11-16 11:39:36 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/cpp_features.pb.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/descriptor.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/descriptor.pb.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/descriptor_database.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/dynamic_message.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/extension_set.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/extension_set_heavy.cc
|
2023-11-16 11:39:36 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/feature_resolver.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_enum_util.cc
|
2023-05-31 17:26:31 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_bases.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_reflection.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_full.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_gen.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_tctable_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/implicit_weak_message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/inlined_string_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/gzip_stream.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/io_win32.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/printer.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/strtod.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/tokenizer.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_sink.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/lexer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/message_path.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/parser.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/unparser.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/untyped_message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/writer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/internal/zero_copy_buffered_stream.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/json/json.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/map.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/map_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/message.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/message_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/parse_context.cc
|
2023-11-15 10:47:10 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/port.cc
|
2023-11-16 11:39:36 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/raw_ptr.cc
|
2023-11-15 10:47:10 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/reflection_mode.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/reflection_ops.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc
|
2023-10-24 09:58:42 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/repeated_ptr_field.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/service.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/text_format.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/unknown_field_set.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/util/delimited_message_util.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/util/field_comparator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/util/field_mask_util.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/util/message_differencer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/util/time_util.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/util/type_resolver_util.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/wire_format.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
add_library(_libprotobuf ${libprotobuf_lite_files} ${libprotobuf_files})
|
|
|
|
if (ENABLE_FUZZING)
|
|
|
|
target_compile_options(_libprotobuf PRIVATE "-fsanitize-recover=all")
|
|
|
|
endif()
|
2023-11-12 14:41:19 +00:00
|
|
|
target_link_libraries(_libprotobuf
|
|
|
|
pthread
|
|
|
|
ch_contrib::zlib
|
|
|
|
utf8_validity
|
|
|
|
${protobuf_absl_used_targets})
|
2023-05-31 16:47:26 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} STREQUAL "Android")
|
|
|
|
target_link_libraries(_libprotobuf log)
|
|
|
|
endif()
|
|
|
|
target_include_directories(_libprotobuf SYSTEM PUBLIC ${protobuf_source_dir}/src)
|
|
|
|
add_library(protobuf::libprotobuf ALIAS _libprotobuf)
|
|
|
|
|
|
|
|
|
|
|
|
set(libprotoc_files
|
2023-11-16 11:39:36 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/allowlists/editions.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/code_generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/command_line_interface.cc
|
2023-10-25 11:56:29 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/enum.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/extension.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field.cc
|
2023-11-15 10:47:10 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field_generators/cord_field.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field_generators/enum_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field_generators/map_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field_generators/message_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field_generators/primitive_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/field_generators/string_field.cc
|
2023-10-25 11:56:29 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/file.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/helpers.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/padding_optimizer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/parse_function_generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/service.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/cpp/tracker.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_doc_comment.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_enum_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_field_base.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_helpers.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_map_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_message_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_primitive_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_reflection_class.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_enum_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_message_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_repeated_primitive_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_source_generator_base.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/csharp_wrapper_field.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/csharp/names.cc
|
2023-10-25 11:56:29 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/context.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/doc_comment.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/enum.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/enum_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/enum_field_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/enum_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/extension.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/extension_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/file.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/generator_factory.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/helpers.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/kotlin_generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/map_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/map_field_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message_builder.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message_builder_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message_field_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message_lite.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/message_serialization.cc
|
2023-10-25 11:56:29 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/name_resolver.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/names.cc
|
2023-10-25 11:56:29 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/primitive_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/primitive_field_lite.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/service.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/shared_code_generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/string_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/java/string_field_lite.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/enum.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/enum_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/extension.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/file.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/helpers.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/import_writer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/line_consumer.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/map_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/message_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/names.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/oneof.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/primitive_field.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/objectivec/text_format_decode_data.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/php/names.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/php/php_generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/plugin.pb.cc
|
2023-10-25 11:56:29 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/python/generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/python/helpers.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/python/pyi_generator.cc
|
2023-11-12 14:41:19 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/retention.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/ruby/ruby_generator.cc
|
2023-11-15 10:47:10 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/accessors.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/singular_bytes.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/accessors/singular_scalar.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/context.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/generator.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/message.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/rust/naming.cc
|
2023-05-31 16:47:26 +00:00
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/subprocess.cc
|
|
|
|
${protobuf_source_dir}/src/google/protobuf/compiler/zip_writer.cc
|
|
|
|
)
|
|
|
|
|
|
|
|
add_library(_libprotoc ${libprotoc_files})
|
2023-11-12 14:41:19 +00:00
|
|
|
target_link_libraries(_libprotoc
|
|
|
|
_libprotobuf
|
|
|
|
${protobuf_absl_used_targets})
|
2023-05-31 16:47:26 +00:00
|
|
|
add_library(protobuf::libprotoc ALIAS _libprotoc)
|
|
|
|
|
|
|
|
set(protoc_files ${protobuf_source_dir}/src/google/protobuf/compiler/main.cc)
|
|
|
|
|
|
|
|
if (CMAKE_HOST_SYSTEM_NAME STREQUAL CMAKE_SYSTEM_NAME
|
|
|
|
AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL CMAKE_SYSTEM_PROCESSOR)
|
|
|
|
|
|
|
|
add_executable(protoc ${protoc_files})
|
2023-11-12 14:41:19 +00:00
|
|
|
target_link_libraries(protoc _libprotoc
|
|
|
|
_libprotobuf
|
|
|
|
pthread
|
|
|
|
utf8_validity
|
|
|
|
${protobuf_absl_used_targets})
|
2023-05-31 16:47:26 +00:00
|
|
|
add_executable(protobuf::protoc ALIAS protoc)
|
|
|
|
|
|
|
|
if (ENABLE_FUZZING)
|
|
|
|
# `protoc` will be built with sanitizer and it could fail during ClickHouse build
|
|
|
|
# It easily reproduces in oss-fuzz building pipeline
|
|
|
|
# To avoid this we can try to build `protoc` without any sanitizer with option `-fno-sanitize=all`, but
|
|
|
|
# it this case we will face with linker errors, because libcxx still will be built with sanitizer
|
|
|
|
# So, we can simply suppress all of these failures with a combination this flag and an environment variable
|
|
|
|
# export MSAN_OPTIONS=exit_code=0
|
|
|
|
target_compile_options(protoc PRIVATE "-fsanitize-recover=all")
|
|
|
|
endif()
|
|
|
|
else ()
|
|
|
|
# Build 'protoc' for host arch
|
|
|
|
set (PROTOC_BUILD_DIR "${protobuf_binary_dir}/build")
|
|
|
|
|
|
|
|
if (NOT EXISTS "${PROTOC_BUILD_DIR}/protoc")
|
|
|
|
|
|
|
|
# This is quite ugly but I cannot make dependencies work propery.
|
|
|
|
|
2023-11-14 15:13:37 +00:00
|
|
|
set(abseil_source_dir "${ClickHouse_SOURCE_DIR}/contrib/abseil-cpp")
|
|
|
|
|
2023-05-31 16:47:26 +00:00
|
|
|
execute_process(
|
|
|
|
COMMAND mkdir -p ${PROTOC_BUILD_DIR}
|
|
|
|
COMMAND_ECHO STDOUT)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
"-G${CMAKE_GENERATOR}"
|
|
|
|
"-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}"
|
|
|
|
"-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}"
|
|
|
|
"-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}"
|
|
|
|
"-Dprotobuf_BUILD_TESTS=0"
|
|
|
|
"-Dprotobuf_BUILD_CONFORMANCE=0"
|
|
|
|
"-Dprotobuf_BUILD_EXAMPLES=0"
|
|
|
|
"-Dprotobuf_BUILD_PROTOC_BINARIES=1"
|
2023-11-14 15:13:37 +00:00
|
|
|
"-DABSL_ROOT_DIR=${abseil_source_dir}"
|
|
|
|
"-DABSL_ENABLE_INSTALL=0"
|
2023-11-16 14:46:57 +00:00
|
|
|
"${protobuf_source_dir}"
|
2023-05-31 16:47:26 +00:00
|
|
|
WORKING_DIRECTORY "${PROTOC_BUILD_DIR}"
|
|
|
|
COMMAND_ECHO STDOUT)
|
|
|
|
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} --build "${PROTOC_BUILD_DIR}"
|
|
|
|
COMMAND_ECHO STDOUT)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
add_executable(protoc IMPORTED GLOBAL)
|
|
|
|
set_target_properties (protoc PROPERTIES IMPORTED_LOCATION "${PROTOC_BUILD_DIR}/protoc")
|
|
|
|
add_dependencies(protoc "${PROTOC_BUILD_DIR}/protoc")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
include("${ClickHouse_SOURCE_DIR}/contrib/google-protobuf-cmake/protobuf_generate.cmake")
|
|
|
|
|
|
|
|
add_library(_protobuf INTERFACE)
|
|
|
|
target_link_libraries(_protobuf INTERFACE _libprotobuf)
|
|
|
|
target_include_directories(_protobuf INTERFACE "${Protobuf_INCLUDE_DIR}")
|
|
|
|
add_library(ch_contrib::protobuf ALIAS _protobuf)
|
|
|
|
|
|
|
|
add_library(_protoc INTERFACE)
|
|
|
|
target_link_libraries(_protoc INTERFACE _libprotoc _libprotobuf)
|
|
|
|
target_include_directories(_protoc INTERFACE "${Protobuf_INCLUDE_DIR}")
|
|
|
|
add_library(ch_contrib::protoc ALIAS _protoc)
|