Index: lib/MsgUtils/CMakeLists.txt =================================================================== diff -u -rfa691c15183dfe8596de699ef8c3a7fcdb90edab -r0bbdafc836463652c41d839ba652e77775a43bec --- lib/MsgUtils/CMakeLists.txt (.../CMakeLists.txt) (revision fa691c15183dfe8596de699ef8c3a7fcdb90edab) +++ lib/MsgUtils/CMakeLists.txt (.../CMakeLists.txt) (revision 0bbdafc836463652c41d839ba652e77775a43bec) @@ -12,14 +12,24 @@ endif() find_package(Protobuf COMPONENTS REQUIRED) +find_package(Python3 REQUIRED COMPONENTS Interpreter) find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Network SerialBus) set(MSGUTILS_SCRIPTS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/scripts) include(cmake/MsgUtils.cmake) -# set(DENALI_MSG_CSV ${CMAKE_CURRENT_SOURCE_DIR}/../../data/FW_Messages_List.csv) +# install the Python package in editable mode so that the generated protobuf files can be imported by the Python scripts +# without needing to be copied to the Python package directory +execute_process( + COMMAND ${Python3_EXECUTABLE} -m pip install -e ${MSGUTILS_SCRIPTS_DIR} --quiet + RESULT_VARIABLE _pip_result +) +if(NOT _pip_result EQUAL 0) + message(FATAL_ERROR "Failed to install msgutils Python package (pip returned ${_pip_result})") +endif() +# set(DENALI_MSG_CSV ${CMAKE_CURRENT_SOURCE_DIR}/../../data/FW_Messages_List.csv) set(LEAHI_MSG_CSV ${CMAKE_CURRENT_SOURCE_DIR}/../../data/Leahi_Staging_FW_Messages_List.csv) set(LEAHI_MSG_CONF ${CMAKE_CURRENT_SOURCE_DIR}/../../data/Unhandled.conf)