mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-29 06:23:34 +08:00
cmake remove circular linking and reorganize
- px4_add_module now requires MAIN - px4_add_library doesn't automatically link
This commit is contained in:
@@ -164,21 +164,19 @@ function(px4_os_add_flags)
|
||||
LINK_DIRS ${LINK_DIRS}
|
||||
DEFINITIONS ${DEFINITIONS})
|
||||
|
||||
set(added_include_dirs
|
||||
platforms/posix/include
|
||||
)
|
||||
|
||||
# This block sets added_definitions and added_cxx_flags.
|
||||
set(added_c_flags)
|
||||
set(added_cxx_flags)
|
||||
set(added_exe_linker_flags)
|
||||
set(added_definitions
|
||||
|
||||
add_definitions(
|
||||
-D__PX4_POSIX
|
||||
-Dnoreturn_function=__attribute__\(\(noreturn\)\)
|
||||
)
|
||||
|
||||
include_directories(platforms/posix/include)
|
||||
|
||||
if(UNIX AND APPLE)
|
||||
list(APPEND added_definitions
|
||||
add_definitions(
|
||||
-D__PX4_DARWIN
|
||||
-D__DF_DARWIN
|
||||
)
|
||||
@@ -191,7 +189,7 @@ function(px4_os_add_flags)
|
||||
STRING(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
|
||||
# message(STATUS "PX4 Darwin Version: ${DARWIN_VERSION}")
|
||||
if (DARWIN_VERSION LESS 16)
|
||||
list(APPEND added_definitions
|
||||
add_definitions(
|
||||
-DCLOCK_MONOTONIC=1
|
||||
-DCLOCK_REALTIME=0
|
||||
-D__PX4_APPLE_LEGACY
|
||||
@@ -199,14 +197,14 @@ function(px4_os_add_flags)
|
||||
endif()
|
||||
|
||||
elseif(CYGWIN)
|
||||
list(APPEND added_definitions
|
||||
add_definitions(
|
||||
-D__PX4_CYGWIN
|
||||
-D_GNU_SOURCE
|
||||
-D__USE_LINUX_IOCTL_DEFS
|
||||
-U __CUSTOM_FILE_IO__
|
||||
)
|
||||
else()
|
||||
list(APPEND added_definitions
|
||||
add_definitions(
|
||||
-D__PX4_LINUX
|
||||
-D__DF_LINUX
|
||||
)
|
||||
@@ -316,5 +314,6 @@ function(px4_os_prebuild_targets)
|
||||
REQUIRED OUT BOARD
|
||||
ARGN ${ARGN})
|
||||
|
||||
add_custom_target(${OUT} DEPENDS uorb_headers)
|
||||
add_library(${OUT} INTERFACE)
|
||||
add_dependencies(${OUT} DEPENDS uorb_headers)
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user