diff --git a/src/xrt/ipc/CMakeLists.txt b/src/xrt/ipc/CMakeLists.txt index 140eee378..babb29497 100644 --- a/src/xrt/ipc/CMakeLists.txt +++ b/src/xrt/ipc/CMakeLists.txt @@ -28,6 +28,23 @@ foreach( ) endforeach() +# Generate IPC structures list in the build root +add_custom_command( + OUTPUT "${CMAKE_BINARY_DIR}/ipc-structs.txt" + COMMAND + ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py + ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json + "${CMAKE_BINARY_DIR}/ipc-structs.txt" + VERBATIM + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.py + ${CMAKE_CURRENT_SOURCE_DIR}/shared/ipcproto/common.py + ${CMAKE_CURRENT_SOURCE_DIR}/shared/proto.json + COMMENT "Generating ipc-structs.txt from protocol JSON description" + ) + +add_custom_target(ipc_structs_list ALL DEPENDS "${CMAKE_BINARY_DIR}/ipc-structs.txt") + set(IPC_COMMON_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/ipc_protocol_generated.h shared/ipc_message_channel.h diff --git a/src/xrt/ipc/shared/proto.py b/src/xrt/ipc/shared/proto.py index 7d9721c64..04c66fc2d 100755 --- a/src/xrt/ipc/shared/proto.py +++ b/src/xrt/ipc/shared/proto.py @@ -520,7 +520,7 @@ def main(): generate_server_c(output, p) if output.endswith("ipc_server_generated.h"): generate_server_header(output, p) - if output.endswith("structs.txt"): + if output.endswith("structs.txt") or output.endswith("ipc-structs.txt"): generate_struct_names(output, p)