mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
Target specific optimization control.
This allows one to set a semi-colon separated list of regular expressions in the environment variable PX4_NO_OPTIMIZATION to control which (cmake generated) targets should be compiled without optimization. Suppressing optimization can be necessary for debugging in a debugger, especially when trying to step through the code or needing to print variables that otherwise are optimized out. EXAMPLE export PX4_NO_OPTIMIZATION="px4;^modules__uORB;^modules__systemlib$" will result in the following messages during cmake configuration: [...] -- Disabling optimization for target 'platforms__posix__px4_layer' because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'modules__systemlib' because it matches the regexp '^modules__systemlib$' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'modules__uORB' because it matches the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'examples__px4_simple_app' because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'modules__uORB__uORB_tests' because it matches the regexp '^modules__uORB' in env var PX4_NO_OPTIMIZATION -- Disabling optimization for target 'px4' because it matches the regexp 'px4' in env var PX4_NO_OPTIMIZATION Note that a list of all (currently used) target names can be printed with the following command line from within the required build directory: find . -wholename '*/CMakeFiles/*.dir/flags.make' | xargs dirname | xargs basename -a | sort -u | sed -e 's/.dir$//'
This commit is contained in:
@@ -318,14 +318,15 @@ px4_os_add_flags(
|
||||
BOARD ${BOARD}
|
||||
C_FLAGS c_flags
|
||||
CXX_FLAGS cxx_flags
|
||||
OPTIMIZATION_FLAGS optimization_flags
|
||||
EXE_LINKER_FLAGS exe_linker_flags
|
||||
INCLUDE_DIRS include_dirs
|
||||
LINK_DIRS link_dirs
|
||||
DEFINITIONS definitions)
|
||||
|
||||
px4_join(OUT CMAKE_EXE_LINKER_FLAGS LIST "${exe_linker_flags}" GLUE " ")
|
||||
px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags}" GLUE " ")
|
||||
px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags}" GLUE " ")
|
||||
px4_join(OUT CMAKE_C_FLAGS LIST "${c_flags};${optimization_flags}" GLUE " ")
|
||||
px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags};${optimization_flags}" GLUE " ")
|
||||
|
||||
include_directories(${include_dirs})
|
||||
#message("INCLUDE_DIRS=${include_dirs}")
|
||||
|
||||
Reference in New Issue
Block a user