mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-28 19:32:36 +08:00
component_information: merge extra component_information_header target
With Makefile build, generate_component_general.py was called twice during
build, which did not happen with the ninja build.
This created a race condition with the following error in rare cases:
Traceback (most recent call last):
File "/__w/PX4-Autopilot/PX4-Autopilot/src/lib/component_information/generate_component_general.py", line 79, in <module>
save_compressed(filename)
File "/__w/PX4-Autopilot/PX4-Autopilot/src/lib/component_information/generate_component_general.py", line 33, in save_compressed
with open(filename, 'r') as content_file:
FileNotFoundError: [Errno 2] No such file or directory: '/__w/PX4-Autopilot/PX4-Autopilot/build/px4_sitl_default/component_general.json'
make[3]: *** [src/lib/component_information/CMakeFiles/component_information_header.dir/build.make:68: component_general.json] Error 1
Merging the targets avoids the duplicate execution.
This commit is contained in:
@@ -68,12 +68,16 @@ endif()
|
||||
list(APPEND comp_metadata_types "--type" "4,${PX4_BINARY_DIR}/events/all_events.json.xz,${comp_metadata_events_uri},${comp_metadata_events_uri_fallback},")
|
||||
|
||||
set(component_general_json ${PX4_BINARY_DIR}/component_general.json)
|
||||
add_custom_command(OUTPUT ${component_general_json} ${component_general_json}.xz
|
||||
set(component_information_header ${CMAKE_CURRENT_BINARY_DIR}/checksums.h)
|
||||
add_custom_command(OUTPUT ${component_general_json} ${component_general_json}.xz ${component_information_header}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_component_general.py
|
||||
${component_general_json}
|
||||
--compress
|
||||
${comp_metadata_types}
|
||||
--version-file ${PX4_BINARY_DIR}/src/lib/version/build_git_version.h
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_crc.py
|
||||
${component_general_json}
|
||||
--output ${component_information_header}
|
||||
DEPENDS
|
||||
generate_component_general.py
|
||||
${PX4_BINARY_DIR}/parameters.json.xz
|
||||
@@ -81,21 +85,10 @@ add_custom_command(OUTPUT ${component_general_json} ${component_general_json}.xz
|
||||
${PX4_BINARY_DIR}/events/all_events.json.xz
|
||||
events_json
|
||||
ver_gen
|
||||
COMMENT "Generating component_general.json"
|
||||
generate_crc.py
|
||||
COMMENT "Generating component_general.json and checksums.h"
|
||||
)
|
||||
add_custom_target(component_general_json DEPENDS ${component_general_json})
|
||||
|
||||
|
||||
set(component_information_header ${CMAKE_CURRENT_BINARY_DIR}/checksums.h)
|
||||
add_custom_command(OUTPUT ${component_information_header}
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/generate_crc.py
|
||||
${component_general_json}
|
||||
--output ${component_information_header}
|
||||
DEPENDS
|
||||
generate_crc.py
|
||||
${component_general_json}
|
||||
COMMENT "Generating component_information/checksums.h"
|
||||
)
|
||||
add_custom_target(component_information_header DEPENDS ${component_information_header})
|
||||
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ px4_add_module(
|
||||
module.yaml
|
||||
DEPENDS
|
||||
airspeed
|
||||
component_information_header
|
||||
component_general_json # for checksums.h
|
||||
drivers_accelerometer
|
||||
drivers_barometer
|
||||
drivers_gyroscope
|
||||
|
||||
Reference in New Issue
Block a user