mirror of
https://github.com/mudita/MuditaOS.git
synced 2026-07-20 13:04:21 -04:00
[BH-357] Move protobuf to third-party dir
* Use the CMakeLists.txt from lib authors. * Disable building libprotobuf in the all target. * Disable warnings in the libprotobuf-lite target.
This commit is contained in:
committed by
Artur Śleszyński
parent
e6e9a79fa5
commit
fbb820c284
2
.gitmodules
vendored
2
.gitmodules
vendored
@@ -17,7 +17,7 @@
|
||||
branch = rt1051
|
||||
shallow = true
|
||||
[submodule "module-utils/protobuf"]
|
||||
path = module-utils/protobuf
|
||||
path = third-party/protobuf/src
|
||||
url = ../protobuf.git
|
||||
branch = rt1051
|
||||
shallow = true
|
||||
|
||||
@@ -19,6 +19,7 @@ if(COVERAGE_ENABLE)
|
||||
.*/test/.*
|
||||
.*/tests/.*
|
||||
.*/thirdparty/.*
|
||||
.*/third-party/.*
|
||||
board/linux/libiosyscalls/.*
|
||||
host-tools/.*
|
||||
module-audio/Audio/decoder/dr_flac.h
|
||||
@@ -30,7 +31,6 @@ if(COVERAGE_ENABLE)
|
||||
module-utils/gsl/.*
|
||||
module-utils/json/.*
|
||||
module-utils/libphonenumber/.*
|
||||
module-utils/protobuf/.*
|
||||
module-utils/re2/.*
|
||||
module-utils/segger/.*
|
||||
module-utils/taglib/.*
|
||||
|
||||
@@ -887,12 +887,9 @@ RECURSIVE = YES
|
||||
|
||||
EXCLUDE = @PROJECT_SOURCE_DIR@/module-bluetooth/lib \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/tinyfsm \
|
||||
@PROJECT_SOURCE_DIR@/third-party/microtar \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/segger \
|
||||
@PROJECT_SOURCE_DIR@/third-party/crc32 \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/sbini \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/re2 \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/protobuf \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/libphonenumber \
|
||||
@PROJECT_SOURCE_DIR@/module-utils/test \
|
||||
@PROJECT_SOURCE_DIR@/module-db/tests \
|
||||
@@ -906,7 +903,8 @@ EXCLUDE = @PROJECT_SOURCE_DIR@/module-bluetooth/lib \
|
||||
@PROJECT_SOURCE_DIR@/module-vfs/tests \
|
||||
@PROJECT_SOURCE_DIR@/module-vfs/board \
|
||||
@PROJECT_SOURCE_DIR@/module-bsp/board/rt1051/common \
|
||||
@PROJECT_SOURCE_DIR@/module-audio/Audio/decoder/taglib
|
||||
@PROJECT_SOURCE_DIR@/module-audio/Audio/decoder/taglib \
|
||||
@PROJECT_SOURCE_DIR@/third-party
|
||||
|
||||
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
|
||||
# directories that are symbolic links (a Unix file system feature) are excluded
|
||||
|
||||
@@ -50,7 +50,6 @@ include(segger/rtt/CMakeLists.txt)
|
||||
|
||||
# add third party libs
|
||||
include(third-party/re2.cmake)
|
||||
include(third-party/protobuf-lite.cmake)
|
||||
include(third-party/libphonenumber.cmake)
|
||||
|
||||
# link against libphonenumber
|
||||
|
||||
Submodule module-utils/protobuf deleted from 1733c4f163
@@ -67,11 +67,7 @@ if (NOT RE2_TARGET)
|
||||
endif ()
|
||||
target_link_libraries (${LIBPHONENUMBER_TARGET} PUBLIC ${RE2_TARGET})
|
||||
|
||||
# protobuf dependency
|
||||
if (NOT PROTOBUF_TARGET)
|
||||
message (FATAL_ERROR "Protobuf is required for libphonenumber")
|
||||
endif()
|
||||
target_link_libraries (${LIBPHONENUMBER_TARGET} PUBLIC ${PROTOBUF_TARGET})
|
||||
target_link_libraries (${LIBPHONENUMBER_TARGET} PUBLIC protobuf::libprotobuf-lite)
|
||||
|
||||
# turn on optimization in debug
|
||||
third_party_source_optimization (${LIBPHONENUMBER_SOURCES})
|
||||
|
||||
64
module-utils/third-party/protobuf-lite.cmake
vendored
64
module-utils/third-party/protobuf-lite.cmake
vendored
@@ -1,64 +0,0 @@
|
||||
include (thirdparty)
|
||||
|
||||
# add sources
|
||||
set (PROTOBUF_SRCDIR ${CMAKE_CURRENT_SOURCE_DIR}/protobuf/src)
|
||||
set (PROTOBUF ${PROTOBUF_SRCDIR}/google/protobuf)
|
||||
set (PROTOBUF_SOURCES
|
||||
${PROTOBUF}/any_lite.cc
|
||||
${PROTOBUF}/arena.cc
|
||||
${PROTOBUF}/extension_set.cc
|
||||
${PROTOBUF}/generated_enum_util.cc
|
||||
${PROTOBUF}/generated_message_table_driven_lite.cc
|
||||
${PROTOBUF}/generated_message_util.cc
|
||||
${PROTOBUF}/implicit_weak_message.cc
|
||||
${PROTOBUF}/io/coded_stream.cc
|
||||
${PROTOBUF}/io/io_win32.cc
|
||||
${PROTOBUF}/io/strtod.cc
|
||||
${PROTOBUF}/io/zero_copy_stream.cc
|
||||
${PROTOBUF}/io/zero_copy_stream_impl.cc
|
||||
${PROTOBUF}/io/zero_copy_stream_impl_lite.cc
|
||||
${PROTOBUF}/message_lite.cc
|
||||
${PROTOBUF}/parse_context.cc
|
||||
${PROTOBUF}/repeated_field.cc
|
||||
${PROTOBUF}/stubs/bytestream.cc
|
||||
${PROTOBUF}/stubs/common.cc
|
||||
${PROTOBUF}/stubs/int128.cc
|
||||
${PROTOBUF}/stubs/status.cc
|
||||
${PROTOBUF}/stubs/statusor.cc
|
||||
${PROTOBUF}/stubs/stringpiece.cc
|
||||
${PROTOBUF}/stubs/stringprintf.cc
|
||||
${PROTOBUF}/stubs/structurally_valid.cc
|
||||
${PROTOBUF}/stubs/strutil.cc
|
||||
${PROTOBUF}/stubs/time.cc
|
||||
${PROTOBUF}/wire_format_lite.cc
|
||||
)
|
||||
|
||||
# create static library for the third party
|
||||
set (PROTOBUF_TARGET protobuf)
|
||||
add_library (${PROTOBUF_TARGET} STATIC ${PROTOBUF_SOURCES})
|
||||
|
||||
# setup flags for the third party
|
||||
third_party_target_setup (${PROTOBUF_TARGET})
|
||||
|
||||
# set compile definitions for third party libraries
|
||||
target_compile_definitions (${PROTOBUF_TARGET} PUBLIC GOOGLE_PROTOBUF_NO_THREADS)
|
||||
|
||||
# supress warnings for protobuf
|
||||
set_source_files_properties (${PROTOBUF_SOURCES}
|
||||
PROPERTIES COMPILE_FLAGS
|
||||
"-Wno-stringop-truncation \
|
||||
-Wno-stringop-overflow \
|
||||
-Wno-sign-compare \
|
||||
-Wno-type-limits \
|
||||
-Wno-redundant-move \
|
||||
-Wno-maybe-uninitialized"
|
||||
)
|
||||
|
||||
# add include dir
|
||||
target_include_directories (${PROTOBUF_TARGET} PUBLIC ${PROTOBUF_SRCDIR})
|
||||
|
||||
# module-os dependency (locking support)
|
||||
target_link_libraries (${RE2_TARGET} PUBLIC module-os)
|
||||
|
||||
# turn on optimization in debug
|
||||
third_party_source_optimization (${PROTOBUF_SOURCES})
|
||||
3
third-party/CMakeLists.txt
vendored
3
third-party/CMakeLists.txt
vendored
@@ -1,4 +1,4 @@
|
||||
add_subdirectory(crc32)
|
||||
add_subdirectory(crc32)
|
||||
add_subdirectory(magic_enum)
|
||||
add_subdirectory(microtar)
|
||||
add_subdirectory(date)
|
||||
@@ -7,3 +7,4 @@ add_subdirectory(sml)
|
||||
add_subdirectory(minimp3)
|
||||
add_subdirectory(tinyexpr)
|
||||
add_subdirectory(parallel-hashmap)
|
||||
add_subdirectory(protobuf)
|
||||
|
||||
3
third-party/protobuf/CMakeLists.txt
vendored
Normal file
3
third-party/protobuf/CMakeLists.txt
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
add_subdirectory(src/cmake)
|
||||
set_target_properties(libprotobuf PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)
|
||||
target_compile_options(libprotobuf-lite PRIVATE -w)
|
||||
1
third-party/protobuf/src
vendored
Submodule
1
third-party/protobuf/src
vendored
Submodule
Submodule third-party/protobuf/src added at 2555e35fc6
Reference in New Issue
Block a user