mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-23 22:58:10 +08:00
list_vmd_make_targets and list_cmake_targets
* This allows one to run 'make posix list_vmd_make_targets' and get output like >make posix list_vmd_make_targets [...] -- Build files have been written to: /usr/src/debian/px4/Firmware/Firmware.git/build_posix_sitl_default PX4 CONFIG: /usr/src/debian/px4/Firmware/Firmware.git/build_posix_sitl_default Scanning dependencies of target list_vmd_make_targets [100%] List of acceptable 'posix_sitl_default' <viewer_model_debugger> targets: none none_iris none_iris_opt_flow none_tailsitter [...] replay_solo_valgrind replay_typhoon_h480_valgrind [100%] Built target list_vmd_make_targets Or, run 'make list_vmd_make_targets' from the build_posix_* directory. * This adds the list_cmake_targets make target to print all cmake targets that one can match with PX4_NO_OPTIMIZATION. PX4_NO_OPTIMIZATION is ignored (do optimization as normal) when the CONFIG isn't posix_sitl_*. * Add comment in Makefile on how/where to find all targets.
This commit is contained in:
@@ -402,6 +402,19 @@ if (config_io_board)
|
||||
add_subdirectory(src/modules/px4iofirmware)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# generate custom target to print for all executable and module cmake targets
|
||||
#
|
||||
if(all_posix_cmake_targets)
|
||||
list(SORT all_posix_cmake_targets)
|
||||
px4_join(OUT posix_cmake_target_list LIST ${all_posix_cmake_targets} GLUE "\\n")
|
||||
add_custom_target(list_cmake_targets
|
||||
COMMAND sh -c "printf \"${posix_cmake_target_list}\\n\""
|
||||
COMMENT "List of cmake targets that can be matched by PX4_NO_OPTIMIZATION:"
|
||||
VERBATIM
|
||||
)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# generate git version
|
||||
#
|
||||
|
||||
@@ -148,6 +148,9 @@ endef
|
||||
# --------------------------------------------------------------------
|
||||
# Do not put any spaces between function arguments.
|
||||
|
||||
# For a list of all config targets, please look in cmake/configs,
|
||||
# For example: ls cmake/configs | sed -e 's/\.cmake$//'
|
||||
|
||||
# All nuttx, posix and qurt targets.
|
||||
nuttx_% posix_% qurt_%:
|
||||
$(call cmake-build,$@)
|
||||
@@ -288,7 +291,7 @@ viewers = gazebo jmavsim replay
|
||||
sitl_vmd_triplet_masks = $(foreach viewer,$(viewers),$(viewer) $(viewer)_%)
|
||||
# targets handled by PX4_MAKE
|
||||
make_targets = install test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak \
|
||||
run_cmake_config config $(sitl_vmd_triplet_masks)
|
||||
run_cmake_config config list_vmd_make_targets list_cmake_targets $(sitl_vmd_triplet_masks)
|
||||
$(foreach targ,$(make_targets),$(eval $(call make-targ,$(targ))))
|
||||
|
||||
.PHONY: clean
|
||||
|
||||
@@ -1061,14 +1061,21 @@ endfunction()
|
||||
#
|
||||
# px4_add_optimization_flags_for_target
|
||||
#
|
||||
set(all_posix_cmake_targets "" CACHE INTERNAL "All cmake targets for which optimization can be suppressed")
|
||||
function(px4_add_optimization_flags_for_target target)
|
||||
set(_no_optimization_for_target FALSE)
|
||||
foreach(_regexp $ENV{PX4_NO_OPTIMIZATION})
|
||||
if("${target}" MATCHES "${_regexp}")
|
||||
set(_no_optimization_for_target TRUE)
|
||||
set(_matched_regexp "${_regexp}")
|
||||
endif()
|
||||
endforeach()
|
||||
# If the current CONFIG is posix_sitl_* then suppress optimization for certain targets.
|
||||
if(CONFIG MATCHES "^posix_sitl_")
|
||||
foreach(_regexp $ENV{PX4_NO_OPTIMIZATION})
|
||||
if("${target}" MATCHES "${_regexp}")
|
||||
set(_no_optimization_for_target TRUE)
|
||||
set(_matched_regexp "${_regexp}")
|
||||
endif()
|
||||
endforeach()
|
||||
# Create a full list of targets that optimization can be suppressed for.
|
||||
list(APPEND all_posix_cmake_targets ${target})
|
||||
set(all_posix_cmake_targets ${all_posix_cmake_targets} CACHE INTERNAL "All cmake targets for which optimization can be suppressed")
|
||||
endif()
|
||||
if(NOT ${_no_optimization_for_target})
|
||||
target_compile_options(${target} PRIVATE ${optimization_flags})
|
||||
else()
|
||||
|
||||
@@ -152,6 +152,7 @@ set_target_properties(sitl_gazebo PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||
set(viewers none jmavsim gazebo replay)
|
||||
set(debuggers none gdb lldb ddd valgrind)
|
||||
set(models none iris iris_opt_flow tailsitter standard_vtol plane solo typhoon_h480)
|
||||
set(all_posix_vmd_make_targets)
|
||||
foreach(viewer ${viewers})
|
||||
foreach(debugger ${debuggers})
|
||||
foreach(model ${models})
|
||||
@@ -180,6 +181,7 @@ foreach(viewer ${viewers})
|
||||
WORKING_DIRECTORY ${SITL_WORKING_DIR}
|
||||
USES_TERMINAL
|
||||
)
|
||||
list(APPEND all_posix_vmd_make_targets ${_targ_name})
|
||||
if (viewer STREQUAL "gazebo")
|
||||
add_dependencies(${_targ_name} sitl_gazebo)
|
||||
endif()
|
||||
@@ -187,6 +189,13 @@ foreach(viewer ${viewers})
|
||||
endforeach()
|
||||
endforeach()
|
||||
|
||||
px4_join(OUT posix_vmd_make_target_list LIST ${all_posix_vmd_make_targets} GLUE "\\n")
|
||||
add_custom_target(list_vmd_make_targets
|
||||
COMMAND sh -c "printf \"${posix_vmd_make_target_list}\\n\""
|
||||
COMMENT "List of acceptable '${CONFIG}' <viewer_model_debugger> targets:"
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# install
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user