Skip to content
Snippets Groups Projects
Commit 3e0a3559 authored by Daniel Agar's avatar Daniel Agar Committed by David Sidrane
Browse files

cmake use standard mechanisms for settings flags

parent 11be2b88
No related branches found
No related tags found
No related merge requests found
Showing
with 59 additions and 63 deletions
......@@ -213,7 +213,7 @@ endif()
message(STATUS "PX4 config file: ${PX4_CONFIG_FILE}")
include(px4_add_board)
include(${PX4_CONFIG_FILE})
message(STATUS "PX4 config: ${PX4_BOARD_VENDOR}_${PX4_BOARD_MODEL}_${PX4_BOARD_LABEL}")
message(STATUS "PX4 config: ${PX4_CONFIG}")
message(STATUS "PX4 platform: ${PX4_PLATFORM}")
# external modules
......@@ -272,6 +272,11 @@ endif()
# Setup install paths
if (${PX4_PLATFORM} STREQUAL "posix")
# This makes it possible to dynamically load code which depends on symbols
# inside the px4 executable.
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_ENABLE_EXPORTS ON)
include(coverage)
include(sanitizers)
......@@ -287,19 +292,6 @@ if (${PX4_PLATFORM} STREQUAL "posix")
include(CTest)
endif()
#=============================================================================
# require px4 module interface
set(px4_required_interface
px4_os_prebuild_targets
px4_os_add_flags
px4_add_board
)
foreach(cmd ${px4_required_interface})
if (NOT COMMAND ${cmd})
message(FATAL_ERROR "${CONFIG} must implement ${cmd}")
endif()
endforeach()
#=============================================================================
# ccache
#
......@@ -349,19 +341,9 @@ endif()
#=============================================================================
# build flags
#
px4_os_add_flags(
BOARD ${PX4_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 "${CMAKE_EXE_LINKER_FLAGS};${exe_linker_flags}" GLUE " ")
px4_join(OUT CMAKE_C_FLAGS LIST "${CMAKE_C_FLAGS};${c_flags};${optimization_flags}" GLUE " ")
px4_join(OUT CMAKE_CXX_FLAGS LIST "${CMAKE_CXX_FLAGS};${cxx_flags};${optimization_flags}" GLUE " ")
include(px4_add_common_flags)
px4_add_common_flags()
px4_os_add_flags()
#=============================================================================
# message, and airframe generation
......@@ -546,14 +528,14 @@ add_custom_target(all_metadata
#
# Important to having packaging at end of cmake file.
#
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}-${CONFIG})
set(CPACK_PACKAGE_NAME ${PROJECT_NAME}-${PX4_CONFIG})
set(CPACK_PACKAGE_VERSION ${PX4_GIT_TAG})
set(CPACK_PACKAGE_CONTACT ${package-contact})
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS OFF) # TODO: review packaging for linux boards
set(CPACK_DEBIAN_PACKAGE_SECTION "devel")
set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional")
set(CPACK_DEBIAN_PACKAGE_DESCRIPTION "The PX4 Pro autopilot.")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${CONFIG}-${PX4_GIT_TAG}")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PX4_CONFIG}-${PX4_GIT_TAG}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PX4_GIT_TAG}")
set(CPACK_SOURCE_GENERATOR "ZIP;TBZ2")
set(CPACK_PACKAGING_INSTALL_PREFIX "")
......
......@@ -4,7 +4,7 @@ px4_add_board(
MODEL ocpoc
LABEL ubuntu
PLATFORM posix
PROCESSOR cortex-a9
ARCHITECTURE cortex-a9
TOOLCHAIN arm-linux-gnueabihf
TESTING
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR airmind
MODEL mindpx-v2
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
TESTING
UAVCAN_INTERFACES 1
......
......@@ -25,16 +25,24 @@ set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
set(CONFIG_SHMEM "1")
add_definitions(-DORB_COMMUNICATOR)
# This definition allows to differentiate if this just the usual POSIX build
# or if it is for the Snapdragon.
add_definitions(-D__PX4_POSIX_EAGLE)
# atlflight toolchain doesn't properly set the compiler, so these aren't set automatically
add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=gnu99>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>)
add_definitions(
-D__PX4_POSIX_EAGLE
-D__PX4_LINUX
# For DriverFramework
-D__DF_LINUX
)
px4_add_board(
PLATFORM posix
VENDOR atlflight
MODEL eagle
LABEL default
TESTING
#TESTING
TOOLCHAIN arm-linux-gnueabihf
DRIVERS
......@@ -100,18 +108,18 @@ px4_add_board(
reboot
sd_bench
shutdown
tests # tests and test runner
#tests # tests and test runner
top
topic_listener
tune_control
ver
EXAMPLES
bottle_drop # OBC challenge
fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control
#bottle_drop # OBC challenge
#fixedwing_control # Tutorial code from https://px4.io/dev/example_fixedwing_control
#hwtest # Hardware test
px4_mavlink_debug # Tutorial code from https://px4.io/dev/debug_values
px4_simple_app # Tutorial code from https://px4.io/dev/px4_simple_app
rover_steering_control # Rover example app
segway
#px4_mavlink_debug # Tutorial code from https://px4.io/dev/debug_values
#px4_simple_app # Tutorial code from https://px4.io/dev/px4_simple_app
#rover_steering_control # Rover example app
#segway
)
......@@ -47,8 +47,6 @@
#define BOARD_NUMBER_BRICKS 0
#define CONFIG_ARCH_BOARD_SITL 1
/*
* I2C busses
*/
......
......@@ -25,9 +25,17 @@ set(DISABLE_PARAMS_MODULE_SCOPING TRUE)
set(CONFIG_SHMEM "1")
add_definitions(-DORB_COMMUNICATOR)
# This definition allows to differentiate if this just the usual POSIX build
# or if it is for the Snapdragon.
add_definitions(-D__PX4_POSIX_EXCELSIOR)
# atlflight toolchain doesn't properly set the compiler, so these aren't set automatically
add_compile_options($<$<COMPILE_LANGUAGE:C>:-std=gnu99>)
add_compile_options($<$<COMPILE_LANGUAGE:CXX>:-std=gnu++11>)
add_definitions(
-D__PX4_POSIX_EXCELSIOR
-D__PX4_LINUX
# For DriverFramework
-D__DF_LINUX
)
px4_add_board(
PLATFORM posix
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR atmel
MODEL same70xplained
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m7
ARCHITECTURE cortex-m7
ROMFSROOT px4fmu_common
TESTING
#UAVCAN_INTERFACES 1
......
......@@ -41,7 +41,7 @@ px4_add_board(
VENDOR auav
MODEL esc35-v1
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
DRIVERS
bootloaders
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR auav
MODEL x21
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
IO px4_io-v2_default
TESTING
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR av
MODEL x-v1
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m7
ARCHITECTURE cortex-m7
ROMFSROOT px4fmu_common
TESTING
UAVCAN_INTERFACES 2
......
......@@ -4,7 +4,7 @@ px4_add_board(
MODEL blue
LABEL cross
PLATFORM posix
PROCESSOR cortex-a8
ARCHITECTURE cortex-a8
TOOLCHAIN arm-linux-gnueabihf
TESTING
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR bitcraze
MODEL crazyflie
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
DRIVERS
......
......@@ -4,7 +4,7 @@ px4_add_board(
MODEL navio2
LABEL cross
PLATFORM posix
PROCESSOR cortex-a53
ARCHITECTURE cortex-a53
TOOLCHAIN arm-linux-gnueabihf
TESTING
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR gumstix
MODEL aerocore2
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
UAVCAN_INTERFACES 1
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR intel
MODEL aerofc-v1
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
SERIAL_PORTS
......
......@@ -5,7 +5,7 @@ px4_add_board(
MODEL aerofc-v1
LABEL rtsp
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
SERIAL_PORTS
......
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR nxp
MODEL hlite-v3
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
TESTING
UAVCAN_INTERFACES 2
......
......@@ -3,7 +3,7 @@
# see misc/tools/kconfig-language.txt.
#
if ARCH_BOARD_NXPHLITE_V3
if ARCH_BOARD_NXP_HLITE_V3
config NXPHLITE_SDHC_AUTOMOUNT
bool "SDHC automounter"
default n
......
......@@ -35,8 +35,8 @@
*
************************************************************************************/
#ifndef __CONFIG_NXPHLITE_V3_INCLUDE_BOARD_H
#define __CONFIG_NXPHLITE_V3_INCLUDE_BOARD_H
#ifndef __CONFIG_NXP_HLITE_V3_INCLUDE_BOARD_H
#define __CONFIG_NXP_HLITE_V3_INCLUDE_BOARD_H
/************************************************************************************
* Included Files
......@@ -556,4 +556,4 @@ void kinetis_boardinitialize(void);
#endif
#endif /* __ASSEMBLY__ */
#endif /* __CONFIG_NXPHLITE_V23_INCLUDE_BOARD_H */
#endif /* __CONFIG_NXP_HLITE_V3_INCLUDE_BOARD_H */
......@@ -4,7 +4,7 @@ px4_add_board(
VENDOR omnibus
MODEL f4sd
TOOLCHAIN arm-none-eabi
PROCESSOR cortex-m4
ARCHITECTURE cortex-m4
ROMFSROOT px4fmu_common
SERIAL_PORTS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment