mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
NuttX upgrade cmake wrapper (#7873)
* NuttX cmake * px4_macros:Pass the stringified predicate as second arg to static assert CC_ASSERT mapes to the c++ static_assert or provides the same funtionality for c via the other macros. The c++ static assert takes 2 argumants the prdicate and a message. This fixes the lacking second argument. * Updated nuttx and apps submodule to upstream nuttx 7.21+==master This is the latest uptake of upstream nuttx and apps. * ROMFS generate with xxd instead of objcopy * delete nuttx-patches * NuttX update submodules to latest px4_nuttx-master * fix nuttx apps and board dependency * docker_run update to latest container 2017-08-29 * cmake ROMFS portable sed usage * NuttX update submodules to latest px4_nuttx-master
This commit is contained in:
@@ -99,14 +99,8 @@
|
||||
#
|
||||
#=============================================================================
|
||||
|
||||
if (${CMAKE_VERSION} VERSION_LESS 3.1.0)
|
||||
message("Not a valid CMake version")
|
||||
message("On Ubuntu >= 16.04, install or upgrade via:")
|
||||
message(" sudo apt-get install cmake")
|
||||
message("")
|
||||
message("Official website: https://cmake.org/download/")
|
||||
message(FATAL_ERROR "Update CMake and try again" )
|
||||
endif()
|
||||
# check submodules before we do anything
|
||||
execute_process(COMMAND Tools/check_submodules.sh WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
# Warning: Changing this modifies CMake's internal workings
|
||||
# and leads to wrong toolchain detection
|
||||
@@ -115,15 +109,18 @@ cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
|
||||
set(PX4_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
set(PX4_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
|
||||
execute_process(
|
||||
COMMAND Tools/check_submodules.sh
|
||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
||||
)
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PX4_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PX4_BINARY_DIR})
|
||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PX4_BINARY_DIR})
|
||||
|
||||
define_property(GLOBAL PROPERTY PX4_LIBRARIES
|
||||
BRIEF_DOCS "PX4 libs"
|
||||
FULL_DOCS "List of all PX4 module libraries"
|
||||
)
|
||||
|
||||
#=============================================================================
|
||||
# configuration
|
||||
#
|
||||
# must come before project to set toolchain
|
||||
|
||||
set(CONFIG "posix_sitl_default" CACHE STRING "desired configuration")
|
||||
|
||||
@@ -145,7 +142,6 @@ if (NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/cmake")
|
||||
message(STATUS "CMAKE_MODULE_PATH: ${CMAKE_MODULE_PATH}")
|
||||
set(config_module "configs/${CONFIG}")
|
||||
include(${config_module})
|
||||
|
||||
@@ -176,16 +172,17 @@ message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
|
||||
#
|
||||
include(common/px4_git)
|
||||
|
||||
# version info from git
|
||||
execute_process(
|
||||
COMMAND git describe --always --tags
|
||||
OUTPUT_VARIABLE git_tag
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
COMMAND Tools/tag_to_version.py --root ${PX4_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE version
|
||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
||||
)
|
||||
|
||||
execute_process(
|
||||
COMMAND Tools/tag_to_version.py --root ${PX4_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE git_version
|
||||
COMMAND git describe --always --tags
|
||||
OUTPUT_VARIABLE git_tag
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
|
||||
)
|
||||
|
||||
@@ -202,12 +199,10 @@ px4_add_git_submodule(TARGET git_jmavsim PATH "Tools/jMAVSim")
|
||||
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
|
||||
px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0")
|
||||
px4_add_git_submodule(TARGET git_mavlink2 PATH "mavlink/include/mavlink/v2.0")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "platforms/nuttx/NuttX")
|
||||
px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan")
|
||||
px4_add_git_submodule(TARGET git_micro_cdr PATH "src/lib/micro-CDR")
|
||||
|
||||
px4_create_git_hash_header()
|
||||
|
||||
#=============================================================================
|
||||
|
||||
message(STATUS "PX4 VERSION: ${git_tag}")
|
||||
@@ -225,18 +220,12 @@ add_definitions(-DBUILD_URI=${BUILD_URI})
|
||||
# Define GNU standard installation directories
|
||||
include(GNUInstallDirs)
|
||||
|
||||
# Add support for external project building
|
||||
include(ExternalProject)
|
||||
|
||||
# Setup install paths
|
||||
if (NOT CMAKE_INSTALL_PREFIX)
|
||||
if (${OS} STREQUAL "posix")
|
||||
if (${OS} STREQUAL "posix")
|
||||
if (NOT CMAKE_INSTALL_PREFIX)
|
||||
set(CMAKE_INSTALL_PREFIX "/usr" CACHE PATH "Install path prefix" FORCE)
|
||||
endif()
|
||||
endif()
|
||||
if (CMAKE_INSTALL_PREFIX)
|
||||
message(STATUS "CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# require px4 module interface
|
||||
@@ -361,12 +350,11 @@ px4_os_add_flags(
|
||||
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};${optimization_flags}" GLUE " ")
|
||||
px4_join(OUT CMAKE_CXX_FLAGS LIST "${cxx_flags};${optimization_flags}" GLUE " ")
|
||||
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_directories(${include_dirs})
|
||||
#message("INCLUDE_DIRS=${include_dirs}")
|
||||
link_directories(${link_dirs})
|
||||
add_definitions(${definitions})
|
||||
|
||||
@@ -381,10 +369,8 @@ px4_generate_messages(TARGET msg_gen
|
||||
MSG_FILES ${msg_files}
|
||||
OS ${OS}
|
||||
INCLUDES ${msg_include_paths}
|
||||
DEPENDS git_genmsg git_gencpp git_micro_cdr prebuild_targets
|
||||
DEPENDS prebuild_targets
|
||||
)
|
||||
include_directories("${PX4_SOURCE_DIR}/src/lib/micro-CDR/include"
|
||||
"${PX4_BINARY_DIR}/src/lib/micro-CDR/include/microcdr")
|
||||
|
||||
px4_generate_airframes_xml(BOARD ${BOARD})
|
||||
|
||||
@@ -439,7 +425,6 @@ endif()
|
||||
#=============================================================================
|
||||
# subdirectories
|
||||
#
|
||||
set(module_libraries)
|
||||
foreach(module ${config_module_list})
|
||||
string(REGEX MATCH "^[./]" external_module ${module})
|
||||
if (external_module)
|
||||
@@ -449,19 +434,10 @@ foreach(module ${config_module_list})
|
||||
else()
|
||||
add_subdirectory(src/${module})
|
||||
endif()
|
||||
px4_mangle_name(${module} mangled_name)
|
||||
list(APPEND module_libraries ${mangled_name})
|
||||
endforeach()
|
||||
|
||||
# Keep track of external shared libs required for modules
|
||||
set(module_external_libraries "${module_external_libraries}" CACHE INTERNAL "module_external_libraries")
|
||||
|
||||
add_subdirectory(src/firmware/${OS})
|
||||
|
||||
if (config_io_board)
|
||||
add_subdirectory(src/modules/px4iofirmware)
|
||||
endif()
|
||||
|
||||
#=============================================================================
|
||||
# generate custom target to print for all executable and module cmake targets
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user