From 541c8a06ca176836b182e7716c74aefaee3bbf70 Mon Sep 17 00:00:00 2001 From: Carlo Wood Date: Thu, 1 Sep 2016 23:15:32 +0200 Subject: [PATCH] Partly cleanup and simplify cmake/configs/posix_sitl_* config files. While the config_sitl_rcS_dir is used more extensively (and actually only depending on the base cmake target), the variables config_sitl_viewer and config_sitl_debugger are just used to be passed on for the run_config target; config_sitl_debugger is even *always* 'disable'. Hence, they don't really need to be cached (INTERNAL or not). Before this patch FILEPATH was used instead of INTERNAL, but I doubt very much that that was intended. That only makes sense when cmake-gui would be used and then would pop-up a file browser to let the user pick a file (while really they need to pick a directory, so it's wrong either way). The ONLY reason caching would be used is when a developer edits the build_posix_sitl_*/CMakeCache.txt files, changes these values and then runs cmake in the build directory again, now overriding the values intended here. Nevertheless, I left in the caching. The main change in this commit (that theoretically has no real effect) is that I removed the duplicated maintenance of posix_sitl_broadcast.cmake. When that file was added, it was an exact copy of posix_sitl_default.cmake and is since not always maintained to remain the same. I don't think that difference is in anyway relevant for the broadcasting part though. Note that I think that something like that also holds for the posix_sitl_replay.cmake; it would be a lot better - maintenance-wise - when it was just derived from (or the same as) posix_sitl_default, I think. --- cmake/configs/posix_sitl_broadcast.cmake | 93 +----------------------- cmake/configs/posix_sitl_default.cmake | 5 +- cmake/configs/posix_sitl_ekf2.cmake | 2 +- cmake/configs/posix_sitl_lpe.cmake | 3 +- cmake/configs/posix_sitl_replay.cmake | 1 + 5 files changed, 10 insertions(+), 94 deletions(-) diff --git a/cmake/configs/posix_sitl_broadcast.cmake b/cmake/configs/posix_sitl_broadcast.cmake index 35ca4885f3..1dd45e0d56 100644 --- a/cmake/configs/posix_sitl_broadcast.cmake +++ b/cmake/configs/posix_sitl_broadcast.cmake @@ -1,92 +1,3 @@ -include(posix/px4_impl_posix) +include(cmake/configs/posix_sitl_default.cmake) -set(CMAKE_TOOLCHAIN_FILE ${PX4_SOURCE_DIR}/cmake/toolchains/Toolchain-native.cmake) - -set(config_module_list - drivers/device - drivers/boards/sitl - drivers/pwm_out_sim - platforms/common - platforms/posix/px4_layer - platforms/posix/work_queue - platforms/posix/drivers/adcsim - platforms/posix/drivers/gpssim - drivers/gps - platforms/posix/drivers/tonealrmsim - platforms/posix/drivers/accelsim - platforms/posix/drivers/airspeedsim - platforms/posix/drivers/barosim - platforms/posix/drivers/gyrosim - platforms/posix/drivers/rgbledsim - platforms/posix/drivers/ledsim - systemcmds/param - systemcmds/mixer - systemcmds/ver - systemcmds/esc_calib - systemcmds/reboot - systemcmds/topic_listener - systemcmds/perf - modules/uORB - modules/param - modules/systemlib - modules/systemlib/mixer - modules/sensors - modules/simulator - modules/mavlink - modules/attitude_estimator_q - modules/position_estimator_inav - modules/local_position_estimator - modules/ekf2 - modules/position_estimator_inav - modules/navigator - modules/vtol_att_control - modules/mc_pos_control - modules/mc_att_control - modules/mc_pos_control_multiplatform - modules/mc_att_control_multiplatform - modules/land_detector - modules/fw_att_control - modules/fw_pos_control_l1 - modules/dataman - modules/sdlog2 - modules/logger - modules/commander - lib/controllib - lib/mathlib - lib/mathlib/math/filter - lib/conversion - lib/ecl - lib/external_lgpl - lib/geo - lib/geo_lookup - lib/launchdetection - lib/terrain_estimation - lib/runway_takeoff - lib/tailsitter_recovery - lib/DriverFramework/framework - examples/px4_simple_app - ) - -set(config_extra_builtin_cmds - serdis - sercon - ) - -set(config_sitl_rcS_dir - posix-configs/SITL/init/ - CACHE FILEPATH "init script for sitl" - ) - -set(config_sitl_viewer - jmavsim - CACHE STRING "viewer for sitl" - ) -set_property(CACHE config_sitl_viewer - PROPERTY STRINGS "jmavsim;none") - -set(config_sitl_debugger - disable - CACHE STRING "debugger for sitl" - ) -set_property(CACHE config_sitl_debugger - PROPERTY STRINGS "disable;gdb;lldb") +# This config is just the same as posix_sitl_default. diff --git a/cmake/configs/posix_sitl_default.cmake b/cmake/configs/posix_sitl_default.cmake index ac215ea12a..ec40efff9b 100644 --- a/cmake/configs/posix_sitl_default.cmake +++ b/cmake/configs/posix_sitl_default.cmake @@ -97,9 +97,12 @@ set(config_extra_builtin_cmds sercon ) +# Default config_sitl_rcS_dir (posix_sitl_default), this is overwritten later +# for the config posix_sitl_efk2 and set again, explicitly, for posix_sitl_lpe, +# which are based on posix_sitl_default. set(config_sitl_rcS_dir posix-configs/SITL/init/lpe - CACHE FILEPATH "init script dir for sitl" + CACHE INTERNAL "init script dir for sitl" ) set(config_sitl_viewer diff --git a/cmake/configs/posix_sitl_ekf2.cmake b/cmake/configs/posix_sitl_ekf2.cmake index 13c2d4591e..ae6191e508 100644 --- a/cmake/configs/posix_sitl_ekf2.cmake +++ b/cmake/configs/posix_sitl_ekf2.cmake @@ -1,5 +1,5 @@ include(cmake/configs/posix_sitl_default.cmake) set(config_sitl_rcS_dir - posix-configs/SITL/init/ekf2/ + posix-configs/SITL/init/ekf2 ) diff --git a/cmake/configs/posix_sitl_lpe.cmake b/cmake/configs/posix_sitl_lpe.cmake index 41d020048e..2dd53f2469 100644 --- a/cmake/configs/posix_sitl_lpe.cmake +++ b/cmake/configs/posix_sitl_lpe.cmake @@ -1,5 +1,6 @@ include(cmake/configs/posix_sitl_default.cmake) +# This is already the default, but lets explicitly set it again to lpe. set(config_sitl_rcS_dir - posix-configs/SITL/init/lpe/ + posix-configs/SITL/init/lpe ) diff --git a/cmake/configs/posix_sitl_replay.cmake b/cmake/configs/posix_sitl_replay.cmake index 28576424bf..3c359b279d 100644 --- a/cmake/configs/posix_sitl_replay.cmake +++ b/cmake/configs/posix_sitl_replay.cmake @@ -36,6 +36,7 @@ set(config_extra_builtin_cmds set(config_sitl_rcS_dir posix-configs/SITL/init/replay + CACHE INTERNAL "init script dir for sitl" ) set(config_sitl_viewer