diff --git a/patch_board_config.cmake b/patch_board_config.cmake index 499e2cd8a..3960f5339 100644 --- a/patch_board_config.cmake +++ b/patch_board_config.cmake @@ -8,13 +8,20 @@ function (patch_board_config) set(VENV_BIN_DIR ${VENV}/bin) endif() + set(PROTO_OUTPUT_DIR ${CMAKE_CURRENT_BINARY_DIR}/proto) + add_custom_target( PatchBoardConfig ALL DEPENDS ${PROJECT_NAME} WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + # something in the protobuf compiler doesn't like the multiple paths, + # so we'll copy all the .proto files into one location + COMMAND ${CMAKE_COMMAND} -E make_directory ${PROTO_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/lib/nanopb/generator/proto/nanopb.proto ${PROTO_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/proto/enums.proto ${PROTO_OUTPUT_DIR} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/proto/config.proto ${PROTO_OUTPUT_DIR} COMMAND ${VENV_BIN_DIR}/concatenate - -P ./proto - -P ./lib/nanopb/generator/proto + -P ${PROTO_OUTPUT_DIR} ./build/${PROJECT_NAME}_${CMAKE_PROJECT_VERSION}_${GP2040_BOARDCONFIG}.bin --json-board-config-filename ./configs/${GP2040_BOARDCONFIG}/board-config.json --backup