mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
cmake split px4_base into px4_add_module, px4_add_library, px4_add_common_flags
This commit is contained in:
committed by
David Sidrane
parent
36ec1a7914
commit
11be2b8873
@@ -134,6 +134,7 @@ define_property(GLOBAL PROPERTY PX4_MODULE_PATHS
|
||||
|
||||
set(CONFIG "px4_sitl_default" CACHE STRING "desired configuration")
|
||||
|
||||
include(px4_add_module)
|
||||
set(config_module_list)
|
||||
set(config_df_driver_list)
|
||||
|
||||
@@ -421,7 +422,10 @@ endif()
|
||||
# subdirectories
|
||||
#
|
||||
add_library(parameters_interface INTERFACE)
|
||||
|
||||
include(px4_add_library)
|
||||
add_subdirectory(src/lib EXCLUDE_FROM_ALL)
|
||||
|
||||
add_subdirectory(src/platforms/common EXCLUDE_FROM_ALL)
|
||||
add_subdirectory(src/modules/systemlib EXCLUDE_FROM_ALL) # TODO: split into libraries in platform layer
|
||||
add_subdirectory(src/modules/uORB EXCLUDE_FROM_ALL) # TODO: platform layer
|
||||
|
||||
255
cmake/px4_add_common_flags.cmake
Normal file
255
cmake/px4_add_common_flags.cmake
Normal file
@@ -0,0 +1,255 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2018 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include(px4_base)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_common_flags
|
||||
#
|
||||
# Set the default build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_add_common_flags(
|
||||
# BOARD <in-string>
|
||||
# C_FLAGS <inout-variable>
|
||||
# CXX_FLAGS <inout-variable>
|
||||
# OPTIMIZATION_FLAGS <inout-variable>
|
||||
# EXE_LINKER_FLAGS <inout-variable>
|
||||
# INCLUDE_DIRS <inout-variable>
|
||||
# LINK_DIRS <inout-variable>
|
||||
# DEFINITIONS <inout-variable>)
|
||||
#
|
||||
# Input:
|
||||
# BOARD : board
|
||||
#
|
||||
# Input/Output: (appends to existing variable)
|
||||
# C_FLAGS : c compile flags variable
|
||||
# CXX_FLAGS : c++ compile flags variable
|
||||
# OPTIMIZATION_FLAGS : optimization compile flags variable
|
||||
# EXE_LINKER_FLAGS : executable linker flags variable
|
||||
# INCLUDE_DIRS : include directories
|
||||
# LINK_DIRS : link directories
|
||||
# DEFINITIONS : definitions
|
||||
#
|
||||
# Example:
|
||||
# px4_add_common_flags(
|
||||
# BOARD px4_fmu-v2
|
||||
# C_FLAGS CMAKE_C_FLAGS
|
||||
# CXX_FLAGS CMAKE_CXX_FLAGS
|
||||
# OPTIMIZATION_FLAGS optimization_flags
|
||||
# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS
|
||||
# INCLUDES <list>)
|
||||
#
|
||||
function(px4_add_common_flags)
|
||||
|
||||
set(inout_vars
|
||||
C_FLAGS CXX_FLAGS OPTIMIZATION_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_common_flags
|
||||
ONE_VALUE ${inout_vars} BOARD
|
||||
REQUIRED ${inout_vars}
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(warnings
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
|
||||
-Warray-bounds
|
||||
-Wdisabled-optimization
|
||||
-Wdouble-promotion
|
||||
-Wfatal-errors
|
||||
-Wfloat-equal
|
||||
-Wformat-security
|
||||
-Winit-self
|
||||
-Wlogical-op
|
||||
-Wmissing-declarations
|
||||
-Wpointer-arith
|
||||
-Wshadow
|
||||
-Wuninitialized
|
||||
-Wunknown-pragmas
|
||||
-Wunused-variable
|
||||
|
||||
-Wno-implicit-fallthrough # set appropriate level and update
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-missing-include-dirs # TODO: fix and enable
|
||||
-Wno-unused-parameter
|
||||
)
|
||||
|
||||
if (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
|
||||
# QuRT 6.4.X compiler identifies as Clang but does not support this option
|
||||
if (NOT ${PX4_PLATFORM} STREQUAL "qurt")
|
||||
list(APPEND warnings
|
||||
-Qunused-arguments
|
||||
-Wno-unused-const-variable
|
||||
-Wno-varargs
|
||||
-Wno-address-of-packed-member
|
||||
-Wno-unknown-warning-option
|
||||
-Wunused-but-set-variable
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND warnings
|
||||
-Wunused-but-set-variable
|
||||
-Wformat=1
|
||||
)
|
||||
endif()
|
||||
|
||||
set(_optimization_flags
|
||||
-fno-strict-aliasing
|
||||
-fomit-frame-pointer
|
||||
|
||||
-fno-math-errno
|
||||
-funsafe-math-optimizations
|
||||
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
)
|
||||
|
||||
set(c_warnings
|
||||
-Wbad-function-cast
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
)
|
||||
|
||||
set(c_compile_flags
|
||||
-g
|
||||
-std=gnu99
|
||||
-fno-common
|
||||
)
|
||||
|
||||
set(cxx_warnings
|
||||
-Wno-overloaded-virtual # TODO: fix and remove
|
||||
-Wreorder
|
||||
)
|
||||
|
||||
set(cxx_compile_flags
|
||||
-g
|
||||
-fno-exceptions
|
||||
-fno-rtti
|
||||
-std=gnu++11
|
||||
-fno-threadsafe-statics
|
||||
-DCONFIG_WCHAR_BUILTIN
|
||||
-D__CUSTOM_FILE_IO__
|
||||
)
|
||||
|
||||
# regular Clang or AppleClang
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# force color for clang (needed for clang + ccache)
|
||||
list(APPEND _optimization_flags
|
||||
-fcolor-diagnostics
|
||||
)
|
||||
else()
|
||||
list(APPEND _optimization_flags
|
||||
-fno-strength-reduce
|
||||
-fno-builtin-printf
|
||||
)
|
||||
|
||||
# -fcheck-new is a no-op for Clang in general
|
||||
# and has no effect, but can generate a compile
|
||||
# error for some OS
|
||||
list(APPEND cxx_compile_flags
|
||||
-fcheck-new
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9)
|
||||
# force color for gcc > 4.9
|
||||
list(APPEND _optimization_flags
|
||||
-fdiagnostics-color=always
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND cxx_warnings
|
||||
-Wno-format-truncation # TODO: fix
|
||||
)
|
||||
endif()
|
||||
|
||||
set(visibility_flags
|
||||
-fvisibility=hidden
|
||||
-include visibility.h
|
||||
)
|
||||
|
||||
set(added_c_flags
|
||||
${c_compile_flags}
|
||||
${warnings}
|
||||
${c_warnings}
|
||||
${visibility_flags}
|
||||
)
|
||||
|
||||
set(added_cxx_flags
|
||||
${cxx_compile_flags}
|
||||
${warnings}
|
||||
${cxx_warnings}
|
||||
${visibility_flags}
|
||||
)
|
||||
|
||||
set(added_optimization_flags
|
||||
${_optimization_flags}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PX4_BINARY_DIR}
|
||||
${PX4_BINARY_DIR}/src
|
||||
${PX4_BINARY_DIR}/src/lib
|
||||
${PX4_BINARY_DIR}/src/modules
|
||||
|
||||
${PX4_SOURCE_DIR}/src
|
||||
${PX4_SOURCE_DIR}/src/include
|
||||
${PX4_SOURCE_DIR}/src/lib
|
||||
${PX4_SOURCE_DIR}/src/lib/DriverFramework/framework/include
|
||||
${PX4_SOURCE_DIR}/src/lib/matrix
|
||||
${PX4_SOURCE_DIR}/src/modules
|
||||
${PX4_SOURCE_DIR}/src/platforms
|
||||
)
|
||||
|
||||
string(TOUPPER ${PX4_BOARD} board_upper)
|
||||
string(REPLACE "-" "_" board_config ${board_upper})
|
||||
|
||||
add_definitions(
|
||||
-DCONFIG_ARCH_BOARD_${board_config}
|
||||
-D__STDC_FORMAT_MACROS
|
||||
)
|
||||
|
||||
# output
|
||||
foreach(var ${inout_vars})
|
||||
string(TOLOWER ${var} lower_var)
|
||||
set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)
|
||||
#message(STATUS "set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)")
|
||||
endforeach()
|
||||
|
||||
endfunction()
|
||||
61
cmake/px4_add_library.cmake
Normal file
61
cmake/px4_add_library.cmake
Normal file
@@ -0,0 +1,61 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2018 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include(px4_base)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_library
|
||||
#
|
||||
# Like add_library but with PX4 platform dependencies
|
||||
#
|
||||
function(px4_add_library target)
|
||||
add_library(${target} ${ARGN})
|
||||
|
||||
target_compile_definitions(${target} PRIVATE MODULE_NAME="${target}")
|
||||
|
||||
# all PX4 libraries have access to parameters and uORB
|
||||
add_dependencies(${target} uorb_headers)
|
||||
target_link_libraries(${target} PRIVATE prebuild_targets parameters_interface uorb_msgs)
|
||||
|
||||
# TODO: move to platform layer
|
||||
if ("${PX4_PLATFORM}" MATCHES "nuttx")
|
||||
target_link_libraries(${target} PRIVATE m nuttx_c)
|
||||
endif()
|
||||
|
||||
# Pass variable to the parent px4_add_module.
|
||||
set(_no_optimization_for_target ${_no_optimization_for_target} PARENT_SCOPE)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_LIBRARIES ${target})
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_PATHS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endfunction()
|
||||
233
cmake/px4_add_module.cmake
Normal file
233
cmake/px4_add_module.cmake
Normal file
@@ -0,0 +1,233 @@
|
||||
############################################################################
|
||||
#
|
||||
# Copyright (c) 2018 PX4 Development Team. All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
# are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in
|
||||
# the documentation and/or other materials provided with the
|
||||
# distribution.
|
||||
# 3. Neither the name PX4 nor the names of its contributors may be
|
||||
# used to endorse or promote products derived from this software
|
||||
# without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
# OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
# AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include(px4_base)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_module
|
||||
#
|
||||
# This function builds a static library from a module description.
|
||||
#
|
||||
# Usage:
|
||||
# px4_add_module(MODULE <string>
|
||||
# MAIN <string>
|
||||
# [ STACK <string> ] !!!!!DEPRECATED, USE STACK_MAIN INSTEAD!!!!!!!!!
|
||||
# [ STACK_MAIN <string> ]
|
||||
# [ STACK_MAX <string> ]
|
||||
# [ COMPILE_FLAGS <list> ]
|
||||
# [ INCLUDES <list> ]
|
||||
# [ DEPENDS <string> ]
|
||||
# [ SRCS <list> ]
|
||||
# [ MODULE_CONFIG <list> ]
|
||||
# [ EXTERNAL ]
|
||||
# [ DYNAMIC ]
|
||||
# )
|
||||
#
|
||||
# Input:
|
||||
# MODULE : unique name of module
|
||||
# MAIN : entry point
|
||||
# STACK : deprecated use stack main instead
|
||||
# STACK_MAIN : size of stack for main function
|
||||
# STACK_MAX : maximum stack size of any frame
|
||||
# COMPILE_FLAGS : compile flags
|
||||
# LINK_FLAGS : link flags
|
||||
# SRCS : source files
|
||||
# MODULE_CONFIG : yaml config file(s)
|
||||
# INCLUDES : include directories
|
||||
# DEPENDS : targets which this module depends on
|
||||
# EXTERNAL : flag to indicate that this module is out-of-tree
|
||||
# DYNAMIC : don't compile into the px4 binary, but build a separate dynamically loadable module (posix)
|
||||
# UNITY_BUILD : merge all source files and build this module as a single compilation unit
|
||||
#
|
||||
# Output:
|
||||
# Static library with name matching MODULE.
|
||||
# (Or a shared library when DYNAMIC is specified.)
|
||||
#
|
||||
# Example:
|
||||
# px4_add_module(MODULE test
|
||||
# SRCS
|
||||
# file.cpp
|
||||
# STACK_MAIN 1024
|
||||
# DEPENDS
|
||||
# git_nuttx
|
||||
# )
|
||||
#
|
||||
function(px4_add_module)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_module
|
||||
ONE_VALUE MODULE MAIN STACK STACK_MAIN STACK_MAX PRIORITY
|
||||
MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS MODULE_CONFIG
|
||||
OPTIONS EXTERNAL DYNAMIC UNITY_BUILD
|
||||
REQUIRED MODULE MAIN
|
||||
ARGN ${ARGN})
|
||||
|
||||
if(UNITY_BUILD AND (${PX4_PLATFORM} STREQUAL "nuttx"))
|
||||
# build standalone test library to catch compilation errors and provide sane output
|
||||
add_library(${MODULE}_original STATIC EXCLUDE_FROM_ALL ${SRCS})
|
||||
if(DEPENDS)
|
||||
add_dependencies(${MODULE}_original ${DEPENDS})
|
||||
endif()
|
||||
|
||||
if(INCLUDES)
|
||||
target_include_directories(${MODULE}_original PRIVATE ${INCLUDES})
|
||||
endif()
|
||||
target_compile_definitions(${MODULE}_original PRIVATE PX4_MAIN=${MAIN}_app_main)
|
||||
target_compile_definitions(${MODULE}_original PRIVATE MODULE_NAME="${MAIN}_original")
|
||||
|
||||
# unity build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
|
||||
COMMAND cat ${SRCS} > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
|
||||
DEPENDS ${MODULE}_original ${DEPENDS} ${SRCS}
|
||||
COMMENT "${MODULE} merging source"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp PROPERTIES GENERATED true)
|
||||
|
||||
add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp)
|
||||
target_include_directories(${MODULE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(DEPENDS)
|
||||
# using target_link_libraries for dependencies provides linking
|
||||
# as well as interface include and libraries
|
||||
foreach(dep ${DEPENDS})
|
||||
get_target_property(dep_type ${dep} TYPE)
|
||||
if (${dep_type} STREQUAL "STATIC_LIBRARY")
|
||||
target_link_libraries(${MODULE}_original PRIVATE ${dep})
|
||||
else()
|
||||
add_dependencies(${MODULE}_original ${dep})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
elseif(DYNAMIC AND MAIN AND (${OS} STREQUAL "posix"))
|
||||
add_library(${MODULE} SHARED ${SRCS})
|
||||
target_compile_definitions(${MODULE} PRIVATE ${MAIN}_main=px4_module_main)
|
||||
set_target_properties(${MODULE} PROPERTIES
|
||||
PREFIX ""
|
||||
SUFFIX ".px4mod"
|
||||
)
|
||||
target_link_libraries(${MODULE} PRIVATE px4)
|
||||
if(APPLE)
|
||||
# Postpone resolving symbols until loading time, which is the default on most systems, but not Mac.
|
||||
set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
|
||||
else()
|
||||
add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS})
|
||||
endif()
|
||||
|
||||
# all modules can potentially use parameters and uORB
|
||||
add_dependencies(${MODULE} uorb_headers)
|
||||
|
||||
if(NOT DYNAMIC)
|
||||
target_link_libraries(${MODULE} PRIVATE prebuild_targets parameters_interface platforms__common px4_layer systemlib)
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_LIBRARIES ${MODULE})
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_PATHS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Pass variable to the parent px4_add_module.
|
||||
set(_no_optimization_for_target ${_no_optimization_for_target} PARENT_SCOPE)
|
||||
|
||||
# set defaults if not set
|
||||
set(MAIN_DEFAULT MAIN-NOTFOUND)
|
||||
set(STACK_MAIN_DEFAULT 1024)
|
||||
set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT)
|
||||
|
||||
foreach(property MAIN STACK_MAIN PRIORITY)
|
||||
if(NOT ${property})
|
||||
set(${property} ${${property}_DEFAULT})
|
||||
endif()
|
||||
set_target_properties(${MODULE} PROPERTIES ${property} ${${property}})
|
||||
endforeach()
|
||||
|
||||
# default stack max to stack main
|
||||
if(NOT STACK_MAX)
|
||||
set(STACK_MAX ${STACK_MAIN})
|
||||
endif()
|
||||
set_target_properties(${MODULE} PROPERTIES STACK_MAX ${STACK_MAX})
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "qurt")
|
||||
set_property(TARGET ${MODULE} PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||
elseif(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
target_compile_options(${MODULE} PRIVATE -Wframe-larger-than=${STACK_MAX})
|
||||
endif()
|
||||
|
||||
if(MAIN)
|
||||
target_compile_definitions(${MODULE} PRIVATE PX4_MAIN=${MAIN}_app_main)
|
||||
target_compile_definitions(${MODULE} PRIVATE MODULE_NAME="${MAIN}")
|
||||
else()
|
||||
target_compile_definitions(${MODULE} PRIVATE MODULE_NAME="${MODULE}")
|
||||
endif()
|
||||
|
||||
if(COMPILE_FLAGS)
|
||||
target_compile_options(${MODULE} PRIVATE ${COMPILE_FLAGS})
|
||||
endif()
|
||||
|
||||
if(INCLUDES)
|
||||
target_include_directories(${MODULE} PRIVATE ${INCLUDES})
|
||||
endif()
|
||||
|
||||
if(DEPENDS)
|
||||
# using target_link_libraries for dependencies provides linking
|
||||
# as well as interface include and libraries
|
||||
foreach(dep ${DEPENDS})
|
||||
get_target_property(dep_type ${dep} TYPE)
|
||||
if (${dep_type} STREQUAL "STATIC_LIBRARY")
|
||||
target_link_libraries(${MODULE} PRIVATE ${dep})
|
||||
else()
|
||||
add_dependencies(${MODULE} ${dep})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# join list variables to get ready to send to compiler
|
||||
foreach(prop LINK_FLAGS)
|
||||
if(${prop})
|
||||
px4_join(OUT ${prop} LIST ${${prop}} GLUE " ")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach (prop LINK_FLAGS STACK_MAIN MAIN PRIORITY)
|
||||
if (${prop})
|
||||
set_target_properties(${MODULE} PROPERTIES ${prop} ${${prop}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(MODULE_CONFIG)
|
||||
foreach(module_config ${MODULE_CONFIG})
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_CONFIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${module_config})
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
@@ -39,9 +39,6 @@
|
||||
#
|
||||
# * px4_parse_function_args
|
||||
# * px4_join
|
||||
# * px4_add_module
|
||||
# * px4_add_common_flags
|
||||
# * px4_add_library
|
||||
#
|
||||
|
||||
include(CMakeParseArguments)
|
||||
@@ -116,6 +113,7 @@ function(px4_parse_function_args)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_join
|
||||
@@ -149,451 +147,6 @@ function(px4_join)
|
||||
set(${OUT} ${_TMP_STR} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_module
|
||||
#
|
||||
# This function builds a static library from a module description.
|
||||
#
|
||||
# Usage:
|
||||
# px4_add_module(MODULE <string>
|
||||
# MAIN <string>
|
||||
# [ STACK <string> ] !!!!!DEPRECATED, USE STACK_MAIN INSTEAD!!!!!!!!!
|
||||
# [ STACK_MAIN <string> ]
|
||||
# [ STACK_MAX <string> ]
|
||||
# [ COMPILE_FLAGS <list> ]
|
||||
# [ INCLUDES <list> ]
|
||||
# [ DEPENDS <string> ]
|
||||
# [ SRCS <list> ]
|
||||
# [ MODULE_CONFIG <list> ]
|
||||
# [ EXTERNAL ]
|
||||
# [ DYNAMIC ]
|
||||
# )
|
||||
#
|
||||
# Input:
|
||||
# MODULE : unique name of module
|
||||
# MAIN : entry point
|
||||
# STACK : deprecated use stack main instead
|
||||
# STACK_MAIN : size of stack for main function
|
||||
# STACK_MAX : maximum stack size of any frame
|
||||
# COMPILE_FLAGS : compile flags
|
||||
# LINK_FLAGS : link flags
|
||||
# SRCS : source files
|
||||
# MODULE_CONFIG : yaml config file(s)
|
||||
# INCLUDES : include directories
|
||||
# DEPENDS : targets which this module depends on
|
||||
# EXTERNAL : flag to indicate that this module is out-of-tree
|
||||
# DYNAMIC : don't compile into the px4 binary, but build a separate dynamically loadable module (posix)
|
||||
# UNITY_BUILD : merge all source files and build this module as a single compilation unit
|
||||
#
|
||||
# Output:
|
||||
# Static library with name matching MODULE.
|
||||
# (Or a shared library when DYNAMIC is specified.)
|
||||
#
|
||||
# Example:
|
||||
# px4_add_module(MODULE test
|
||||
# SRCS
|
||||
# file.cpp
|
||||
# STACK_MAIN 1024
|
||||
# DEPENDS
|
||||
# git_nuttx
|
||||
# )
|
||||
#
|
||||
function(px4_add_module)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_module
|
||||
ONE_VALUE MODULE MAIN STACK STACK_MAIN STACK_MAX PRIORITY
|
||||
MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS MODULE_CONFIG
|
||||
OPTIONS EXTERNAL DYNAMIC UNITY_BUILD
|
||||
REQUIRED MODULE MAIN
|
||||
ARGN ${ARGN})
|
||||
|
||||
if(UNITY_BUILD AND (${PX4_PLATFORM} STREQUAL "nuttx"))
|
||||
# build standalone test library to catch compilation errors and provide sane output
|
||||
add_library(${MODULE}_original STATIC EXCLUDE_FROM_ALL ${SRCS})
|
||||
if(DEPENDS)
|
||||
add_dependencies(${MODULE}_original ${DEPENDS})
|
||||
endif()
|
||||
|
||||
if(INCLUDES)
|
||||
target_include_directories(${MODULE}_original PRIVATE ${INCLUDES})
|
||||
endif()
|
||||
target_compile_definitions(${MODULE}_original PRIVATE PX4_MAIN=${MAIN}_app_main)
|
||||
target_compile_definitions(${MODULE}_original PRIVATE MODULE_NAME="${MAIN}_original")
|
||||
|
||||
# unity build
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
|
||||
COMMAND cat ${SRCS} > ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp
|
||||
DEPENDS ${MODULE}_original ${DEPENDS} ${SRCS}
|
||||
COMMENT "${MODULE} merging source"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
)
|
||||
set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp PROPERTIES GENERATED true)
|
||||
|
||||
add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${CMAKE_CURRENT_BINARY_DIR}/${MODULE}_unity.cpp)
|
||||
target_include_directories(${MODULE} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
|
||||
if(DEPENDS)
|
||||
# using target_link_libraries for dependencies provides linking
|
||||
# as well as interface include and libraries
|
||||
foreach(dep ${DEPENDS})
|
||||
get_target_property(dep_type ${dep} TYPE)
|
||||
if (${dep_type} STREQUAL "STATIC_LIBRARY")
|
||||
target_link_libraries(${MODULE}_original PRIVATE ${dep})
|
||||
else()
|
||||
add_dependencies(${MODULE}_original ${dep})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
elseif(DYNAMIC AND MAIN AND (${OS} STREQUAL "posix"))
|
||||
add_library(${MODULE} SHARED ${SRCS})
|
||||
target_compile_definitions(${MODULE} PRIVATE ${MAIN}_main=px4_module_main)
|
||||
set_target_properties(${MODULE} PROPERTIES
|
||||
PREFIX ""
|
||||
SUFFIX ".px4mod"
|
||||
)
|
||||
target_link_libraries(${MODULE} PRIVATE px4)
|
||||
if(APPLE)
|
||||
# Postpone resolving symbols until loading time, which is the default on most systems, but not Mac.
|
||||
set_target_properties(${MODULE} PROPERTIES LINK_FLAGS "-undefined dynamic_lookup")
|
||||
endif()
|
||||
else()
|
||||
add_library(${MODULE} STATIC EXCLUDE_FROM_ALL ${SRCS})
|
||||
endif()
|
||||
|
||||
# all modules can potentially use parameters and uORB
|
||||
add_dependencies(${MODULE} uorb_headers)
|
||||
|
||||
if(NOT DYNAMIC)
|
||||
target_link_libraries(${MODULE} PRIVATE prebuild_targets parameters_interface platforms__common px4_layer systemlib)
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_LIBRARIES ${MODULE})
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_PATHS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
# Pass variable to the parent px4_add_module.
|
||||
set(_no_optimization_for_target ${_no_optimization_for_target} PARENT_SCOPE)
|
||||
|
||||
# set defaults if not set
|
||||
set(MAIN_DEFAULT MAIN-NOTFOUND)
|
||||
set(STACK_MAIN_DEFAULT 1024)
|
||||
set(PRIORITY_DEFAULT SCHED_PRIORITY_DEFAULT)
|
||||
|
||||
foreach(property MAIN STACK_MAIN PRIORITY)
|
||||
if(NOT ${property})
|
||||
set(${property} ${${property}_DEFAULT})
|
||||
endif()
|
||||
set_target_properties(${MODULE} PROPERTIES ${property} ${${property}})
|
||||
endforeach()
|
||||
|
||||
# default stack max to stack main
|
||||
if(NOT STACK_MAX)
|
||||
set(STACK_MAX ${STACK_MAIN})
|
||||
endif()
|
||||
set_target_properties(${MODULE} PROPERTIES STACK_MAX ${STACK_MAX})
|
||||
|
||||
if(${PX4_PLATFORM} STREQUAL "qurt")
|
||||
set_property(TARGET ${MODULE} PROPERTY POSITION_INDEPENDENT_CODE TRUE)
|
||||
elseif(${PX4_PLATFORM} STREQUAL "nuttx")
|
||||
target_compile_options(${MODULE} PRIVATE -Wframe-larger-than=${STACK_MAX})
|
||||
endif()
|
||||
|
||||
if(MAIN)
|
||||
target_compile_definitions(${MODULE} PRIVATE PX4_MAIN=${MAIN}_app_main)
|
||||
target_compile_definitions(${MODULE} PRIVATE MODULE_NAME="${MAIN}")
|
||||
else()
|
||||
target_compile_definitions(${MODULE} PRIVATE MODULE_NAME="${MODULE}")
|
||||
endif()
|
||||
|
||||
if(COMPILE_FLAGS)
|
||||
target_compile_options(${MODULE} PRIVATE ${COMPILE_FLAGS})
|
||||
endif()
|
||||
|
||||
if(INCLUDES)
|
||||
target_include_directories(${MODULE} PRIVATE ${INCLUDES})
|
||||
endif()
|
||||
|
||||
if(DEPENDS)
|
||||
# using target_link_libraries for dependencies provides linking
|
||||
# as well as interface include and libraries
|
||||
foreach(dep ${DEPENDS})
|
||||
get_target_property(dep_type ${dep} TYPE)
|
||||
if (${dep_type} STREQUAL "STATIC_LIBRARY")
|
||||
target_link_libraries(${MODULE} PRIVATE ${dep})
|
||||
else()
|
||||
add_dependencies(${MODULE} ${dep})
|
||||
endif()
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
# join list variables to get ready to send to compiler
|
||||
foreach(prop LINK_FLAGS)
|
||||
if(${prop})
|
||||
px4_join(OUT ${prop} LIST ${${prop}} GLUE " ")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
foreach (prop LINK_FLAGS STACK_MAIN MAIN PRIORITY)
|
||||
if (${prop})
|
||||
set_target_properties(${MODULE} PROPERTIES ${prop} ${${prop}})
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(MODULE_CONFIG)
|
||||
foreach(module_config ${MODULE_CONFIG})
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_CONFIG_FILES ${CMAKE_CURRENT_SOURCE_DIR}/${module_config})
|
||||
endforeach()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_common_flags
|
||||
#
|
||||
# Set the default build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_add_common_flags(
|
||||
# BOARD <in-string>
|
||||
# C_FLAGS <inout-variable>
|
||||
# CXX_FLAGS <inout-variable>
|
||||
# OPTIMIZATION_FLAGS <inout-variable>
|
||||
# EXE_LINKER_FLAGS <inout-variable>
|
||||
# INCLUDE_DIRS <inout-variable>
|
||||
# LINK_DIRS <inout-variable>
|
||||
# DEFINITIONS <inout-variable>)
|
||||
#
|
||||
# Input:
|
||||
# BOARD : board
|
||||
#
|
||||
# Input/Output: (appends to existing variable)
|
||||
# C_FLAGS : c compile flags variable
|
||||
# CXX_FLAGS : c++ compile flags variable
|
||||
# OPTIMIZATION_FLAGS : optimization compile flags variable
|
||||
# EXE_LINKER_FLAGS : executable linker flags variable
|
||||
# INCLUDE_DIRS : include directories
|
||||
# LINK_DIRS : link directories
|
||||
# DEFINITIONS : definitions
|
||||
#
|
||||
# Example:
|
||||
# px4_add_common_flags(
|
||||
# BOARD px4_fmu-v2
|
||||
# C_FLAGS CMAKE_C_FLAGS
|
||||
# CXX_FLAGS CMAKE_CXX_FLAGS
|
||||
# OPTIMIZATION_FLAGS optimization_flags
|
||||
# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS
|
||||
# INCLUDES <list>)
|
||||
#
|
||||
function(px4_add_common_flags)
|
||||
|
||||
set(inout_vars
|
||||
C_FLAGS CXX_FLAGS OPTIMIZATION_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_add_common_flags
|
||||
ONE_VALUE ${inout_vars} BOARD
|
||||
REQUIRED ${inout_vars}
|
||||
ARGN ${ARGN})
|
||||
|
||||
set(warnings
|
||||
-Wall
|
||||
-Wextra
|
||||
-Werror
|
||||
|
||||
-Warray-bounds
|
||||
-Wdisabled-optimization
|
||||
-Wdouble-promotion
|
||||
-Wfatal-errors
|
||||
-Wfloat-equal
|
||||
-Wformat-security
|
||||
-Winit-self
|
||||
-Wlogical-op
|
||||
-Wmissing-declarations
|
||||
-Wpointer-arith
|
||||
-Wshadow
|
||||
-Wuninitialized
|
||||
-Wunknown-pragmas
|
||||
-Wunused-variable
|
||||
|
||||
-Wno-implicit-fallthrough # set appropriate level and update
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-missing-include-dirs # TODO: fix and enable
|
||||
-Wno-unused-parameter
|
||||
)
|
||||
|
||||
if (${CMAKE_C_COMPILER_ID} MATCHES ".*Clang.*")
|
||||
# QuRT 6.4.X compiler identifies as Clang but does not support this option
|
||||
if (NOT ${PX4_PLATFORM} STREQUAL "qurt")
|
||||
list(APPEND warnings
|
||||
-Qunused-arguments
|
||||
-Wno-unused-const-variable
|
||||
-Wno-varargs
|
||||
-Wno-address-of-packed-member
|
||||
-Wno-unknown-warning-option
|
||||
-Wunused-but-set-variable
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND warnings
|
||||
-Wunused-but-set-variable
|
||||
-Wformat=1
|
||||
)
|
||||
endif()
|
||||
|
||||
set(_optimization_flags
|
||||
-fno-strict-aliasing
|
||||
-fomit-frame-pointer
|
||||
|
||||
-fno-math-errno
|
||||
-funsafe-math-optimizations
|
||||
|
||||
-ffunction-sections
|
||||
-fdata-sections
|
||||
)
|
||||
|
||||
set(c_warnings
|
||||
-Wbad-function-cast
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
)
|
||||
|
||||
set(c_compile_flags
|
||||
-g
|
||||
-std=gnu99
|
||||
-fno-common
|
||||
)
|
||||
|
||||
set(cxx_warnings
|
||||
-Wno-overloaded-virtual # TODO: fix and remove
|
||||
-Wreorder
|
||||
)
|
||||
|
||||
set(cxx_compile_flags
|
||||
-g
|
||||
-fno-exceptions
|
||||
-fno-rtti
|
||||
-std=gnu++11
|
||||
-fno-threadsafe-statics
|
||||
-DCONFIG_WCHAR_BUILTIN
|
||||
-D__CUSTOM_FILE_IO__
|
||||
)
|
||||
|
||||
# regular Clang or AppleClang
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
|
||||
# force color for clang (needed for clang + ccache)
|
||||
list(APPEND _optimization_flags
|
||||
-fcolor-diagnostics
|
||||
)
|
||||
else()
|
||||
list(APPEND _optimization_flags
|
||||
-fno-strength-reduce
|
||||
-fno-builtin-printf
|
||||
)
|
||||
|
||||
# -fcheck-new is a no-op for Clang in general
|
||||
# and has no effect, but can generate a compile
|
||||
# error for some OS
|
||||
list(APPEND cxx_compile_flags
|
||||
-fcheck-new
|
||||
)
|
||||
endif()
|
||||
|
||||
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 4.9)
|
||||
# force color for gcc > 4.9
|
||||
list(APPEND _optimization_flags
|
||||
-fdiagnostics-color=always
|
||||
)
|
||||
endif()
|
||||
|
||||
list(APPEND cxx_warnings
|
||||
-Wno-format-truncation # TODO: fix
|
||||
)
|
||||
endif()
|
||||
|
||||
set(visibility_flags
|
||||
-fvisibility=hidden
|
||||
-include visibility.h
|
||||
)
|
||||
|
||||
set(added_c_flags
|
||||
${c_compile_flags}
|
||||
${warnings}
|
||||
${c_warnings}
|
||||
${visibility_flags}
|
||||
)
|
||||
|
||||
set(added_cxx_flags
|
||||
${cxx_compile_flags}
|
||||
${warnings}
|
||||
${cxx_warnings}
|
||||
${visibility_flags}
|
||||
)
|
||||
|
||||
set(added_optimization_flags
|
||||
${_optimization_flags}
|
||||
)
|
||||
|
||||
include_directories(
|
||||
${PX4_BINARY_DIR}
|
||||
${PX4_BINARY_DIR}/src
|
||||
${PX4_BINARY_DIR}/src/lib
|
||||
${PX4_BINARY_DIR}/src/modules
|
||||
|
||||
${PX4_SOURCE_DIR}/src
|
||||
${PX4_SOURCE_DIR}/src/include
|
||||
${PX4_SOURCE_DIR}/src/lib
|
||||
${PX4_SOURCE_DIR}/src/lib/DriverFramework/framework/include
|
||||
${PX4_SOURCE_DIR}/src/lib/matrix
|
||||
${PX4_SOURCE_DIR}/src/modules
|
||||
${PX4_SOURCE_DIR}/src/platforms
|
||||
)
|
||||
|
||||
string(TOUPPER ${PX4_BOARD} board_upper)
|
||||
string(REPLACE "-" "_" board_config ${board_upper})
|
||||
|
||||
add_definitions(
|
||||
-DCONFIG_PROCESSOR_BOARD_${board_config}
|
||||
-D__STDC_FORMAT_MACROS
|
||||
)
|
||||
|
||||
# output
|
||||
foreach(var ${inout_vars})
|
||||
string(TOLOWER ${var} lower_var)
|
||||
set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)
|
||||
#message(STATUS "set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)")
|
||||
endforeach()
|
||||
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_library
|
||||
#
|
||||
# Like add_library but with optimization flag fixup.
|
||||
#
|
||||
function(px4_add_library target)
|
||||
add_library(${target} ${ARGN})
|
||||
|
||||
target_compile_definitions(${target} PRIVATE MODULE_NAME="${target}")
|
||||
|
||||
# all PX4 libraries have access to parameters and uORB
|
||||
add_dependencies(${target} uorb_headers)
|
||||
target_link_libraries(${target} PRIVATE prebuild_targets parameters_interface uorb_msgs)
|
||||
|
||||
# TODO: move to platform layer
|
||||
if ("${PX4_PLATFORM}" MATCHES "nuttx")
|
||||
target_link_libraries(${target} PRIVATE m nuttx_c)
|
||||
endif()
|
||||
|
||||
# Pass variable to the parent px4_add_module.
|
||||
set(_no_optimization_for_target ${_no_optimization_for_target} PARENT_SCOPE)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_LIBRARIES ${target})
|
||||
set_property(GLOBAL APPEND PROPERTY PX4_MODULE_PATHS ${CMAKE_CURRENT_SOURCE_DIR})
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
|
||||
@@ -31,18 +31,8 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
include(CMakeParseArguments)
|
||||
include(px4_base)
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# Defined functions in this file
|
||||
#
|
||||
# utility functions
|
||||
#
|
||||
# * px4_add_git_submodule
|
||||
#
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_add_git_submodule
|
||||
|
||||
@@ -94,6 +94,7 @@ function(px4_os_add_flags)
|
||||
REQUIRED ${inout_vars}
|
||||
ARGN ${ARGN})
|
||||
|
||||
include(px4_add_common_flags)
|
||||
px4_add_common_flags(
|
||||
BOARD ${PX4_BOARD}
|
||||
C_FLAGS ${C_FLAGS}
|
||||
|
||||
@@ -259,6 +259,7 @@ function(px4_os_add_flags)
|
||||
REQUIRED ${inout_vars} BOARD
|
||||
ARGN ${ARGN})
|
||||
|
||||
include(px4_add_common_flags)
|
||||
px4_add_common_flags(
|
||||
BOARD ${PX4_BOARD}
|
||||
C_FLAGS ${C_FLAGS}
|
||||
|
||||
@@ -150,6 +150,7 @@ function(px4_os_add_flags)
|
||||
REQUIRED ${inout_vars} BOARD
|
||||
ARGN ${ARGN})
|
||||
|
||||
include(px4_add_common_flags)
|
||||
px4_add_common_flags(
|
||||
BOARD ${PX4_BOARD}
|
||||
C_FLAGS ${C_FLAGS}
|
||||
|
||||
Reference in New Issue
Block a user