tool to send fw with usb using protbuf
This commit is contained in:
20
tools/CMakeLists.txt
Normal file
20
tools/CMakeLists.txt
Normal file
@@ -0,0 +1,20 @@
|
||||
|
||||
# Specify the .proto file
|
||||
set(PROTO_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../proto)
|
||||
set(PROTO_FILE ${PROTO_SRC_DIR}/firmware.proto)
|
||||
|
||||
# Specify where you want to generate the python code
|
||||
set(PYTHON_OUT_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Specify the include directory
|
||||
set(PROTO_INC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../lib/nanopb/generator/proto)
|
||||
|
||||
# Add the command to generate the python code
|
||||
add_custom_command(
|
||||
OUTPUT ${PYTHON_OUT_DIR}/firmware_pb2.py
|
||||
COMMAND protoc --python_out=${PYTHON_OUT_DIR} --proto_path=${PROTO_SRC_DIR}:${PROTO_INC_DIR} ${PROTO_FILE} ${PROTO_INC_DIR}/nanopb.proto
|
||||
DEPENDS ${PROTO_FILE}
|
||||
)
|
||||
|
||||
# Add the generated python code to a custom target
|
||||
add_custom_target(GeneratePythonProtobufCode ALL DEPENDS ${PYTHON_OUT_DIR}/firmware_pb2.py)
|
||||
Reference in New Issue
Block a user