CMakeLists.txt 1.1 KB

1234567891011121314151617181920
  1. idf_component_register(SRC_DIRS .
  2. INCLUDE_DIRS "."
  3. REQUIRES tools platform_config unity )
  4. # target_compile_options(__idf_platform_config PRIVATE --coverage)
  5. target_include_directories(${COMPONENT_LIB} PUBLIC SYSTEM ${CMAKE_SOURCE_DIR}/test_main)
  6. message(STATUS "** PLATFORM PROTOBUF")
  7. include(../../../tools/protoc_utils/protobuf_utils.cmake)
  8. configure_env()
  9. file(GLOB PROTO_FILES *.proto)
  10. set(NANOPB_OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}" "-I${PROJECT_ROOT_DIR}/protobuf/proto")
  11. nanopb_generate_cpp(PROTO_SRCS PROTO_HDRS RELPATH ${CMAKE_CURRENT_SOURCE_DIR} ${PROTO_FILES})
  12. # Create a custom target to generate the proto files
  13. set_source_files_properties(${PROTO_SRCS} ${PROTO_HDRS} PROPERTIES GENERATED TRUE)
  14. add_custom_target(generate_test_proto ALL DEPENDS ${PROTO_SRCS} ${PROTO_HDRS})
  15. target_sources(${COMPONENT_LIB} PRIVATE ${PROTO_SRCS})
  16. add_dependencies(${COMPONENT_LIB} generate_test_proto)
  17. target_include_directories(${COMPONENT_LIB} PUBLIC "include" ${CMAKE_CURRENT_BINARY_DIR} ${NANOPB_INCLUDE_DIRS} ${EXTRA_INCLUDES})