Index: LeahiRt/CMakeLists.txt =================================================================== diff -u -rdfe875a4159529de072df08b6c500707e9312d96 -rb3c378d491270fcffbd8aba0effe2a950ced1a22 --- LeahiRt/CMakeLists.txt (.../CMakeLists.txt) (revision dfe875a4159529de072df08b6c500707e9312d96) +++ LeahiRt/CMakeLists.txt (.../CMakeLists.txt) (revision b3c378d491270fcffbd8aba0effe2a950ced1a22) @@ -16,6 +16,8 @@ find_package(Comms HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../lib/Comms REQUIRED) find_package(MsgUtils HINTS ${CMAKE_CURRENT_SOURCE_DIR}/../lib/MsgUtils REQUIRED) +set(LEAHI_MSG_CONF ${CMAKE_CURRENT_SOURCE_DIR}/../data/LeahiUnhandled.conf) + set(INCLUDES LeahiRtController.h ) @@ -25,6 +27,8 @@ main.cpp ) +generate_message_ini(LEAHI_MSG_CONF ${CMAKE_CURRENT_SOURCE_DIR}/config/LeahiRtMessage.ini generate_message_ini) + add_executable(${PROJECT_NAME}) target_sources(${PROJECT_NAME} PRIVATE ${INCLUDES} ${SRCS}) Index: lib/MsgUtils/cmake/MsgUtils.cmake =================================================================== diff -u -ra52c25b8231e90a9de0421db171cde2336007733 -rb3c378d491270fcffbd8aba0effe2a950ced1a22 --- lib/MsgUtils/cmake/MsgUtils.cmake (.../MsgUtils.cmake) (revision a52c25b8231e90a9de0421db171cde2336007733) +++ lib/MsgUtils/cmake/MsgUtils.cmake (.../MsgUtils.cmake) (revision b3c378d491270fcffbd8aba0effe2a950ced1a22) @@ -57,6 +57,34 @@ ) endfunction() +# \brief This function custom command to generate/update a message handling INI. +# \param[in] _input_confs list of message conf files to use to generate the INI +# \param[in] _output_ini path to the INI file to create or update +# \param[in] _target_name name of the custom target to add +function(generate_message_ini _input_confs _output_ini _target_name) + find_package(Python3 COMPONENTS Interpreter Development REQUIRED) + + # cmake >= 3.20: cmake_path(ABSOLUTE_PATH _output_ini) + get_filename_component(_output_ini ${_output_ini} ABSOLUTE) # cmake < 3.20 + + # generate a pretty string containing a list of the absolute paths of all conf files + foreach(_path ${${_input_confs}}) + # cmake >= 3.20: cmake_path(ABSOLUTE_PATH _path) + get_filename_component(_path ${_path} ABSOLUTE) + list(APPEND _files ${_path}) + endforeach() + list(JOIN _files ", " _file_list) + + add_custom_target(${_target_name} + COMMAND + ${PROJECT_PYTHON} ${MSGUTILS_SCRIPTS_DIR}/GenerateMsgIni.py + ${${_input_confs}} + ${_output_ini} + COMMENT "Generating/updating LeahiRt message INI ${_output_ini} from input ${_file_list}" + VERBATIM + ) +endfunction() + # \brief This function adds a custom command to generate a Protobuf file from inputted message conf files # \param[in] _input_confs list of message conf files to use to generate the header # \param[in] _protobuf_filename name of the generated protobuf file Fisheye: Tag ccc40a7e73e9ee5d2a5fb56f3f2bea4f8294900f refers to a dead (removed) revision in file `scripts/MsgUtils/GenerateMsgIni.py'. Fisheye: No comparison available. Pass `N' to diff? Fisheye: Tag ccc40a7e73e9ee5d2a5fb56f3f2bea4f8294900f refers to a dead (removed) revision in file `scripts/MsgUtils/msgutils/MsgIni.py'. Fisheye: No comparison available. Pass `N' to diff? Index: scripts/MsgUtils/msgutils/__init__.py =================================================================== diff -u -rfd9c43b00259567ff49a3d9b31b98df75b47bc52 -rb3c378d491270fcffbd8aba0effe2a950ced1a22 --- scripts/MsgUtils/msgutils/__init__.py (.../__init__.py) (revision fd9c43b00259567ff49a3d9b31b98df75b47bc52) +++ scripts/MsgUtils/msgutils/__init__.py (.../__init__.py) (revision b3c378d491270fcffbd8aba0effe2a950ced1a22) @@ -1,3 +1,4 @@ from .MsgData import MsgData from .MsgCpp import MsgCpp from .MsgProtobuf import MsgProtobuf +from .MsgIni import MsgIni Index: scripts/MsgUtils/pyproject.toml =================================================================== diff -u -r808df723cf9d1b0097796815e5229abfa18f2d8f -rb3c378d491270fcffbd8aba0effe2a950ced1a22 --- scripts/MsgUtils/pyproject.toml (.../pyproject.toml) (revision 808df723cf9d1b0097796815e5229abfa18f2d8f) +++ scripts/MsgUtils/pyproject.toml (.../pyproject.toml) (revision b3c378d491270fcffbd8aba0effe2a950ced1a22) @@ -12,6 +12,7 @@ [project.scripts] GenerateMsgDefsCpp = "GenerateMsgDefsCpp:main" GenerateProtobuf = "GenerateProtobuf:main" +GenerateMsgIni = "GenerateMsgIni:main" [tool.setuptools.packages.find] exclude = ["test*"]