Browse Source
Fix using full version of protobuf fix issue with lora config defaults fix a few things in cmake files fix cmake flags minor protobuf build fixesregular-protobuf
Alex Mikhalev
6 years ago
8 changed files with 127 additions and 60 deletions
@ -0,0 +1,35 @@
@@ -0,0 +1,35 @@
|
||||
set(protobuf_source_dir ${CMAKE_CURRENT_LIST_DIR}/protobuf) |
||||
|
||||
set(libprotobuf_lite_files |
||||
${protobuf_source_dir}/src/google/protobuf/arena.cc |
||||
${protobuf_source_dir}/src/google/protobuf/arenastring.cc |
||||
${protobuf_source_dir}/src/google/protobuf/extension_set.cc |
||||
${protobuf_source_dir}/src/google/protobuf/generated_message_util.cc |
||||
${protobuf_source_dir}/src/google/protobuf/io/coded_stream.cc |
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream.cc |
||||
${protobuf_source_dir}/src/google/protobuf/io/zero_copy_stream_impl_lite.cc |
||||
${protobuf_source_dir}/src/google/protobuf/message_lite.cc |
||||
${protobuf_source_dir}/src/google/protobuf/repeated_field.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_gcc.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/atomicops_internals_x86_msvc.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/bytestream.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/common.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/int128.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/once.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/status.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/statusor.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringpiece.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/stringprintf.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/structurally_valid.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/strutil.cc |
||||
${protobuf_source_dir}/src/google/protobuf/stubs/time.cc |
||||
${protobuf_source_dir}/src/google/protobuf/wire_format_lite.cc |
||||
) |
||||
|
||||
set(COMPONENT_SRCS ${libprotobuf_lite_files}) |
||||
set(COMPONENT_ADD_INCLUDEDIRS ${protobuf_source_dir}/src) |
||||
|
||||
register_component() |
||||
|
||||
component_compile_options(PUBLIC -DGOOGLE_PROTOBUF_NO_RTTI -Wno-error=maybe-uninitialized |
||||
PRIVATE -DHAVE_PTHREAD) |
@ -0,0 +1,22 @@
@@ -0,0 +1,22 @@
|
||||
find_program(PROTOC protoc) |
||||
|
||||
function(proto_generate_cpp PROTO_FILE PB_OUT HDR_VAR SRC_VAR) |
||||
get_filename_component(PROTO_FILE_NAME ${PROTO_FILE} NAME_WE) |
||||
get_filename_component(PROTO_FILE_PATH ${PROTO_FILE} ABSOLUTE BASE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) |
||||
get_filename_component(PROTO_FILE_DIR ${PROTO_FILE_PATH} DIRECTORY) |
||||
set(PROTO_HDR "${PB_OUT}/${PROTO_FILE_NAME}.pb.h") |
||||
set(PROTO_SRC "${PB_OUT}/${PROTO_FILE_NAME}.pb.cc") |
||||
set(${HDR_VAR} ${${HDR_VAR}} ${PROTO_HDR} PARENT_SCOPE) |
||||
set(${SRC_VAR} ${${SRC_VAR}} ${PROTO_SRC} PARENT_SCOPE) |
||||
if(NOT CMAKE_SCRIPT_MODE_FILE) |
||||
add_custom_command(OUTPUT ${PROTO_HDR} ${PROTO_SRC} |
||||
COMMAND ${PROTOC} |
||||
--cpp_out=${PB_OUT} |
||||
--proto_path ${PROTO_FILE_DIR} |
||||
${PROTO_FILE_PATH} |
||||
DEPENDS ${PROTO_FILE_PATH} |
||||
COMMENT "Generating nanopb sources for ${PROTO_FILE}") |
||||
set_property(SOURCE ${PROTO_HDR} ${PROTO_SRC} PROPERTY GENERATED TRUE) |
||||
set_property(DIRECTORY . APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${PROTO_HDR} ${PROTO_SRC}) |
||||
endif() |
||||
endfunction() |
@ -1,21 +1,25 @@
@@ -1,21 +1,25 @@
|
||||
include(${CMAKE_CURRENT_LIST_DIR}/../components/nanopb/functions.cmake) |
||||
include(${CMAKE_CURRENT_LIST_DIR}/../components/protobuf/functions.cmake) |
||||
|
||||
set(PB_OUT ${CMAKE_CURRENT_SOURCE_DIR}/pb_out) |
||||
|
||||
make_directory(${PB_OUT}) |
||||
nanopb_generate(messages.proto ${PB_OUT} PROTO_HDRS PROTO_SRCS) |
||||
|
||||
list(APPEND COMPONENT_SRCS "ugv_main.cc" |
||||
"ugv_comms.c" |
||||
set(COMPONENT_SRCS |
||||
"ugv_main.cc" |
||||
"ugv_comms.cc" |
||||
"ugv_io.cc" |
||||
"ugv_io_gps.cc" |
||||
"ugv_io_mpu.cc" |
||||
"u8g2_esp32_hal.c" |
||||
"Print.cpp" |
||||
${PROTO_SRCS}) |
||||
) |
||||
set(COMPONENT_PRIV_INCLUDEDIRS "." ${PB_OUT}) |
||||
set(COMPONENT_REQUIRES "u8g2" "sx127x_driver" "nanopb" "MPU-driver" "minmea") |
||||
set(COMPONENT_REQUIRES "u8g2" "sx127x_driver" "protobuf" "MPU-driver" "minmea") |
||||
|
||||
proto_generate_cpp(messages.proto ${PB_OUT} PROTO_HDRS PROTO_SRCS) |
||||
list(APPEND COMPONENT_SRCS ${PROTO_SRCS} ${PROTO_HDRS}) |
||||
|
||||
register_component() |
||||
|
||||
make_directory(${PB_OUT}) |
||||
|
||||
component_compile_options("-Werror=incompatible-pointer-types") |
||||
component_compile_options(-I${PB_OUT}) |
||||
|
Loading…
Reference in new issue