mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-09-28 01:18:55 +08:00
cmake: ensure generated source files exist before extracting events
Only needed for Makefile-based builds: gmake[3]: *** No rule to make target 'src/modules/flight_mode_manager/FlightTasks_generated.hpp', needed by 'events/px4.json'. Stop.
This commit is contained in:
@@ -34,6 +34,8 @@
|
|||||||
# Support IN_LIST if() operator
|
# Support IN_LIST if() operator
|
||||||
cmake_policy(SET CMP0057 NEW)
|
cmake_policy(SET CMP0057 NEW)
|
||||||
|
|
||||||
|
include(px4_list_make_absolute)
|
||||||
|
|
||||||
set(msg_files
|
set(msg_files
|
||||||
actuator_armed.msg
|
actuator_armed.msg
|
||||||
actuator_controls.msg
|
actuator_controls.msg
|
||||||
@@ -230,6 +232,8 @@ if(invalid_msgs)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
px4_list_make_absolute(msg_files ${CMAKE_CURRENT_SOURCE_DIR} ${msg_files})
|
||||||
|
|
||||||
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
|
if(NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
|
||||||
# Check that the msg directory and the CMakeLists.txt file exists
|
# Check that the msg directory and the CMakeLists.txt file exists
|
||||||
if(EXISTS ${EXTERNAL_MODULES_LOCATION}/msg/CMakeLists.txt)
|
if(EXISTS ${EXTERNAL_MODULES_LOCATION}/msg/CMakeLists.txt)
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ add_custom_command(OUTPUT ${generated_events_px4_file}
|
|||||||
${PX4_SOURCE_DIR}/Tools/px4events/jsonout.py
|
${PX4_SOURCE_DIR}/Tools/px4events/jsonout.py
|
||||||
${PX4_SOURCE_DIR}/Tools/px4events/srcparser.py
|
${PX4_SOURCE_DIR}/Tools/px4events/srcparser.py
|
||||||
${PX4_SOURCE_DIR}/Tools/px4events/srcscanner.py
|
${PX4_SOURCE_DIR}/Tools/px4events/srcscanner.py
|
||||||
|
prebuild_targets # ensure all generated source files exist
|
||||||
COMMENT "Generating px4 event json file from source"
|
COMMENT "Generating px4 event json file from source"
|
||||||
)
|
)
|
||||||
add_custom_target(events_px4_json DEPENDS ${generated_events_px4_file})
|
add_custom_target(events_px4_json DEPENDS ${generated_events_px4_file})
|
||||||
|
|||||||
@@ -99,6 +99,9 @@ add_custom_command(
|
|||||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
add_custom_target(flighttasks_generated
|
||||||
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/FlightTasks_generated.cpp)
|
||||||
|
add_dependencies(prebuild_targets flighttasks_generated)
|
||||||
|
|
||||||
add_compile_options(
|
add_compile_options(
|
||||||
-Wno-cast-align
|
-Wno-cast-align
|
||||||
@@ -123,6 +126,7 @@ px4_add_module(
|
|||||||
DEPENDS
|
DEPENDS
|
||||||
px4_work_queue
|
px4_work_queue
|
||||||
WeatherVane
|
WeatherVane
|
||||||
|
flighttasks_generated
|
||||||
)
|
)
|
||||||
|
|
||||||
# add all flight task dependencies
|
# add all flight task dependencies
|
||||||
|
|||||||
@@ -33,15 +33,15 @@
|
|||||||
|
|
||||||
add_custom_command(OUTPUT listener_generated.cpp
|
add_custom_command(OUTPUT listener_generated.cpp
|
||||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_listener.py ${PX4_SOURCE_DIR} ${msg_files} > listener_generated.cpp
|
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_listener.py ${PX4_SOURCE_DIR} ${msg_files} > listener_generated.cpp
|
||||||
DEPENDS generate_listener.py uorb_msgs
|
DEPENDS generate_listener.py ${msg_files}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(generate_topic_listener
|
add_custom_target(generate_topic_listener
|
||||||
DEPENDS
|
DEPENDS
|
||||||
listener_generated.cpp
|
listener_generated.cpp
|
||||||
generate_listener.py
|
generate_listener.py
|
||||||
uorb_msgs
|
|
||||||
)
|
)
|
||||||
|
add_dependencies(prebuild_targets generate_topic_listener)
|
||||||
|
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE systemcmds__topic_listener
|
MODULE systemcmds__topic_listener
|
||||||
@@ -56,5 +56,6 @@ px4_add_module(
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}/listener_generated.cpp
|
${CMAKE_CURRENT_BINARY_DIR}/listener_generated.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
generate_topic_listener
|
generate_topic_listener
|
||||||
|
uorb_msgs
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user