mirror of
https://gitee.com/xiaohuolufeihua/bizhang_-obav.git
synced 2026-05-21 01:12:11 +00:00
cmake use standard mechanisms for settings flags
This commit is contained in:
committed by
David Sidrane
parent
11be2b8873
commit
3e0a3559a9
@@ -9,8 +9,6 @@ add_subdirectory(src)
|
||||
|
||||
include_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-prototypes")
|
||||
|
||||
get_property(module_libraries GLOBAL PROPERTY PX4_MODULE_LIBRARIES)
|
||||
|
||||
px4_qurt_generate_builtin_commands(
|
||||
@@ -20,6 +18,8 @@ px4_qurt_generate_builtin_commands(
|
||||
|
||||
FASTRPC_STUB_GEN(px4muorb.idl)
|
||||
|
||||
add_definitions(-D__QAIC_SKEL_EXPORT=__EXPORT)
|
||||
|
||||
# Enable build without HexagonSDK to check link dependencies
|
||||
if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
|
||||
@@ -36,6 +36,7 @@ if ("${QURT_ENABLE_STUBS}" STREQUAL "1")
|
||||
)
|
||||
|
||||
target_link_libraries(px4 PRIVATE ${module_libraries} ${df_driver_libs})
|
||||
|
||||
else()
|
||||
# Generate the DSP lib and stubs but not the apps side executable
|
||||
# The Apps side executable is generated via the posix_eagle_xxxx target
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
#
|
||||
############################################################################
|
||||
|
||||
|
||||
#=============================================================================
|
||||
#
|
||||
# Defined functions in this file
|
||||
@@ -106,61 +105,10 @@ endfunction()
|
||||
# Set the qurt build flags.
|
||||
#
|
||||
# Usage:
|
||||
# px4_os_add_flags(
|
||||
# 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 : flags depend on board/qurt config
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# Note that EXE_LINKER_FLAGS is not suitable for adding libraries because
|
||||
# these flags are added before any of the object files and static libraries.
|
||||
# Add libraries in src/firmware/qurt/CMakeLists.txt.
|
||||
#
|
||||
# Example:
|
||||
# px4_os_add_flags(
|
||||
# C_FLAGS CMAKE_C_FLAGS
|
||||
# CXX_FLAGS CMAKE_CXX_FLAGS
|
||||
# OPTIMIZATION_FLAGS optimization_flags
|
||||
# EXE_LINKER_FLAG CMAKE_EXE_LINKER_FLAGS
|
||||
# INCLUDES <list>)
|
||||
# px4_os_add_flags()
|
||||
#
|
||||
function(px4_os_add_flags)
|
||||
|
||||
set(inout_vars
|
||||
C_FLAGS CXX_FLAGS OPTIMIZATION_FLAGS EXE_LINKER_FLAGS INCLUDE_DIRS LINK_DIRS DEFINITIONS)
|
||||
|
||||
px4_parse_function_args(
|
||||
NAME px4_os_add_flags
|
||||
ONE_VALUE ${inout_vars} BOARD
|
||||
REQUIRED ${inout_vars} BOARD
|
||||
ARGN ${ARGN})
|
||||
|
||||
include(px4_add_common_flags)
|
||||
px4_add_common_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})
|
||||
|
||||
set(DSPAL_ROOT src/lib/DriverFramework/dspal)
|
||||
include_directories(
|
||||
${DSPAL_ROOT}/include
|
||||
@@ -174,38 +122,24 @@ function(px4_os_add_flags)
|
||||
)
|
||||
|
||||
add_definitions(
|
||||
-D__DF_QURT # For DriverFramework
|
||||
-D__PX4_POSIX
|
||||
-D__PX4_QURT
|
||||
-D__QAIC_SKEL_EXPORT=__EXPORT
|
||||
|
||||
-D__DF_QURT # For DriverFramework
|
||||
)
|
||||
|
||||
# Add the toolchain specific flags
|
||||
set(added_c_flags
|
||||
-Wno-unknown-warning-option
|
||||
)
|
||||
|
||||
set(added_cxx_flags
|
||||
-Wno-unknown-warning-option
|
||||
-Wno-unreachable-code
|
||||
)
|
||||
|
||||
set(added_optimization_flags
|
||||
add_compile_options(
|
||||
-fPIC
|
||||
-fmath-errno
|
||||
)
|
||||
|
||||
-Wno-unknown-warning-option
|
||||
)
|
||||
|
||||
# Clear -rdynamic flag which fails for hexagon
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
|
||||
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
|
||||
|
||||
set(DF_TARGET "qurt" PARENT_SCOPE)
|
||||
|
||||
# output
|
||||
foreach(var ${inout_vars})
|
||||
string(TOLOWER ${var} lower_var)
|
||||
set(${${var}} ${${${var}}} ${added_${lower_var}} PARENT_SCOPE)
|
||||
endforeach()
|
||||
set(DF_TARGET "qurt" CACHE STRING "DriverFramework target" FORCE)
|
||||
|
||||
endfunction()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user