Simplified config handling.

This commit is contained in:
James Goppert 2015-09-10 23:53:25 -04:00
parent 3d52582dd7
commit ec209f13f0
7 changed files with 211 additions and 253 deletions

View File

@ -73,8 +73,8 @@
# ---------------------------------------------------------------------------
#
# * Never set global variables in an included cmake file,
# you may only define functions. This excludes Toolchain files. This
# makes it clear to the user when variables are being set or targets
# you may only define functions. This excludes config and Toolchain files.
# This makes it clear to the user when variables are being set or targets
# are being created.
#
# * Setting a global variable in a CMakeLists.txt file is ok, because
@ -133,7 +133,7 @@ set(px4_required_config
)
foreach(conf ${px4_required_config})
if(NOT DEFINED ${conf})
message(FATAL_ERROR "${config_module} must define ${conf}")
message(FATAL_ERROR "cmake/${config_module} must define ${conf}")
endif()
endforeach()

View File

@ -1,160 +1,135 @@
include(nuttx/px4_impl_nuttx)
function(px4_get_config)
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-arm-none-eabi.cmake)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
set(config_module_list
#
# Board support modules
#
drivers/device
drivers/stm32
drivers/stm32/adc
drivers/stm32/tone_alarm
drivers/led
drivers/px4fmu
drivers/px4io
drivers/boards/px4fmu-v2
drivers/rgbled
drivers/mpu6000
drivers/mpu9250
drivers/lsm303d
drivers/l3gd20
drivers/hmc5883
drivers/ms5611
drivers/mb12xx
drivers/sf0x
drivers/ll40ls
drivers/trone
drivers/gps
drivers/pwm_out_sim
drivers/hott
drivers/hott/hott_telemetry
drivers/hott/hott_sensors
drivers/blinkm
drivers/airspeed
drivers/ets_airspeed
drivers/meas_airspeed
drivers/frsky_telemetry
modules/sensors
drivers/mkblctrl
drivers/px4flow
drivers/oreoled
drivers/gimbal
drivers/pwm_input
drivers/camera_trigger
#
# Board support modules
#
drivers/device
drivers/stm32
drivers/stm32/adc
drivers/stm32/tone_alarm
drivers/led
drivers/px4fmu
drivers/px4io
drivers/boards/px4fmu-v2
drivers/rgbled
drivers/mpu6000
drivers/mpu9250
drivers/lsm303d
drivers/l3gd20
drivers/hmc5883
drivers/ms5611
drivers/mb12xx
drivers/sf0x
drivers/ll40ls
drivers/trone
drivers/gps
drivers/pwm_out_sim
drivers/hott
drivers/hott/hott_telemetry
drivers/hott/hott_sensors
drivers/blinkm
drivers/airspeed
drivers/ets_airspeed
drivers/meas_airspeed
drivers/frsky_telemetry
modules/sensors
drivers/mkblctrl
drivers/px4flow
drivers/oreoled
drivers/gimbal
drivers/pwm_input
drivers/camera_trigger
#
# System commands
#
systemcmds/bl_update
systemcmds/mixer
systemcmds/param
systemcmds/perf
systemcmds/pwm
systemcmds/esc_calib
systemcmds/reboot
systemcmds/top
systemcmds/config
systemcmds/nshterm
systemcmds/mtd
systemcmds/dumpfile
systemcmds/ver
#
# System commands
#
systemcmds/bl_update
systemcmds/mixer
systemcmds/param
systemcmds/perf
systemcmds/pwm
systemcmds/esc_calib
systemcmds/reboot
systemcmds/top
systemcmds/config
systemcmds/nshterm
systemcmds/mtd
systemcmds/dumpfile
systemcmds/ver
#
# Logging
#
modules/sdlog2
#
# Logging
#
modules/sdlog2
#
# Library modules
#
modules/systemlib
modules/systemlib/mixer
modules/controllib
modules/uORB
modules/dataman
#
# Library modules
#
modules/systemlib
modules/systemlib/mixer
modules/controllib
modules/uORB
modules/dataman
#
# Libraries
#
#lib/mathlib/CMSIS
lib/mathlib
lib/mathlib/math/filter
lib/ecl
lib/external_lgpl
lib/geo
lib/geo_lookup
lib/conversion
lib/launchdetection
platforms/nuttx
#
# Libraries
#
#lib/mathlib/CMSIS
lib/mathlib
lib/mathlib/math/filter
lib/ecl
lib/external_lgpl
lib/geo
lib/geo_lookup
lib/conversion
lib/launchdetection
platforms/nuttx
# had to add for cmake, not sure why wasn't in original config
platforms/common
platforms/nuttx/px4_layer
# had to add for cmake, not sure why wasn't in original config
platforms/common
platforms/nuttx/px4_layer
#
# Demo apps
#
#examples/math_demo
# Tutorial code from
# https://px4.io/dev/px4_simple_app
examples/px4_simple_app
#
# Demo apps
#
#examples/math_demo
# Tutorial code from
# https://px4.io/dev/px4_simple_app
examples/px4_simple_app
# Tutorial code from
# https://px4.io/dev/daemon
examples/px4_daemon_app
# Tutorial code from
# https://px4.io/dev/daemon
examples/px4_daemon_app
# Tutorial code from
# https://px4.io/dev/debug_values
examples/px4_mavlink_debug
# Tutorial code from
# https://px4.io/dev/debug_values
examples/px4_mavlink_debug
# Tutorial code from
# https://px4.io/dev/example_fixedwing_control
examples/fixedwing_control
# Tutorial code from
# https://px4.io/dev/example_fixedwing_control
examples/fixedwing_control
# Hardware test
examples/hwtest
)
# Hardware test
examples/hwtest
set(config_firmware_options
PARAM_XML # generate param xml
)
set(firmware_options
PARAM_XML # generate param xml
)
set(config_extra_builtin_cmds
serdis_main
sercon_main
)
set(extra_cmds serdis_main sercon_main)
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")
# output
if(OUT_MODULES)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endif()
if (OUT_FW_OPTS)
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
endif()
endfunction()
function(px4_add_extra_builtin_cmds)
px4_parse_function_args(
NAME px4_add_extra_builtin_cmds
ONE_VALUE OUT
REQUIRED OUT
ARGN ${ARGN})
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")
add_custom_target(serdis)
set_target_properties(serdis PROPERTIES
MAIN "serdis" STACK "2048")
set(${OUT} sercon serdis PARENT_SCOPE)
endfunction()
add_custom_target(serdis)
set_target_properties(serdis PROPERTIES
MAIN "serdis" STACK "2048")

View File

@ -2,27 +2,35 @@ include(nuttx/px4_impl_nuttx)
message(WARNING "this is a work in progress and doesn't build yet")
function(px4_get_config)
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
platforms/nuttx
platforms/nuttx/px4_layer
platforms/common
drivers/led
drivers/device
modules/systemlib
modules/uORB
examples/px4_simple_app
lib/mathlib/math/filter
lib/conversion
)
set(config_module_list
platforms/nuttx
platforms/nuttx/px4_layer
platforms/common
drivers/led
drivers/device
modules/systemlib
modules/uORB
examples/px4_simple_app
lib/mathlib/math/filter
lib/conversion
)
set(config_firmware_options
PARAM_XML # generate param xml
)
set(${out_module_list} ${config_module_list} PARENT_SCOPE)
set(config_extra_builtin_cmds
serdis_main
sercon_main
)
endfunction()
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")
add_custom_target(serdis)
set_target_properties(serdis PROPERTIES
MAIN "serdis" STACK "2048")

View File

@ -1,98 +1,73 @@
include(posix/px4_impl_posix)
set(USE_TOOLCHAIN Toolchain-native)
function(px4_get_config)
set(CMAKE_TOOLCHAIN_FILE cmake/toolchains/Toolchain-native.cmake)
px4_parse_function_args(
NAME px4_set_config_modules
ONE_VALUE OUT_MODULES OUT_FW_OPTS OUT_EXTRA_CMDS
ARGN ${ARGN})
set(config_module_list
drivers/led
drivers/device
drivers/boards/sitl
platforms/common
platforms/posix/px4_layer
platforms/posix/work_queue
platforms/posix/drivers/adcsim
platforms/posix/drivers/gpssim
platforms/posix/drivers/tonealrmsim
platforms/posix/drivers/accelsim
platforms/posix/drivers/airspeedsim
platforms/posix/drivers/barosim
platforms/posix/drivers/gyrosim
systemcmds/param
systemcmds/mixer
systemcmds/ver
systemcmds/esc_calib
systemcmds/reboot
systemcmds/topic_listener
modules/uORB
modules/systemlib
modules/systemlib/mixer
modules/sensors
modules/simulator
modules/mavlink
modules/attitude_estimator_ekf
modules/attitude_estimator_q
modules/ekf_att_pos_estimator
modules/position_estimator_inav
modules/navigator
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/commander
modules/controllib
lib/mathlib
lib/mathlib/math/filter
lib/conversion
lib/ecl
lib/external_lgpl
lib/geo
lib/geo_lookup
lib/launchdetection
)
set(config_module_list
drivers/led
drivers/device
drivers/boards/sitl
platforms/common
platforms/posix/px4_layer
platforms/posix/work_queue
platforms/posix/drivers/adcsim
platforms/posix/drivers/gpssim
platforms/posix/drivers/tonealrmsim
platforms/posix/drivers/accelsim
platforms/posix/drivers/airspeedsim
platforms/posix/drivers/barosim
platforms/posix/drivers/gyrosim
systemcmds/param
systemcmds/mixer
systemcmds/ver
systemcmds/esc_calib
systemcmds/reboot
systemcmds/topic_listener
modules/uORB
modules/systemlib
modules/systemlib/mixer
modules/sensors
modules/simulator
modules/mavlink
modules/attitude_estimator_ekf
modules/attitude_estimator_q
modules/ekf_att_pos_estimator
modules/position_estimator_inav
modules/navigator
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/commander
modules/controllib
lib/mathlib
lib/mathlib/math/filter
lib/conversion
lib/ecl
lib/external_lgpl
lib/geo
lib/geo_lookup
lib/launchdetection
)
set(firmware_options
PARAM_XML # generate param xml
)
set(config_firmware_options
PARAM_XML # generate param xml
)
set(extra_cmds serdis_main sercon_main)
set(config_extra_builtin_cmds
serdis_main
sercon_main
)
# output
if(OUT_MODULES)
set(${OUT_MODULES} ${config_module_list} PARENT_SCOPE)
endif()
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")
if (OUT_FW_OPTS)
set(${OUT_FW_OPTS} ${fw_opts} PARENT_SCOPE)
endif()
endfunction()
function(px4_add_extra_builtin_cmds)
px4_parse_function_args(
NAME px4_add_extra_builtin_cmds
ONE_VALUE OUT
REQUIRED OUT
ARGN ${ARGN})
add_custom_target(sercon)
set_target_properties(sercon PROPERTIES
MAIN "sercon" STACK "2048")
add_custom_target(serdis)
set_target_properties(serdis PROPERTIES
MAIN "serdis" STACK "2048")
set(${OUT} sercon serdis PARENT_SCOPE)
endfunction()
add_custom_target(serdis)
set_target_properties(serdis PROPERTIES
MAIN "serdis" STACK "2048")