forked from Archive/PX4-Autopilot
cmake add libuavcan as subdirectory
-move uavcan submodule to src/modules/uavcan/libuavcan -adding libuavcan as a subdirectory simplifies inheriting all compile flags and include paths
This commit is contained in:
parent
cc3695d0b7
commit
5865dc6434
|
@ -4,8 +4,8 @@
|
|||
[submodule "NuttX"]
|
||||
path = NuttX
|
||||
url = git://github.com/PX4/NuttX.git
|
||||
[submodule "src/lib/uavcan"]
|
||||
path = src/lib/uavcan
|
||||
[submodule "src/modules/uavcan/libuavcan"]
|
||||
path = src/modules/uavcan/libuavcan
|
||||
url = git://github.com/UAVCAN/libuavcan.git
|
||||
[submodule "Tools/genmsg"]
|
||||
path = Tools/genmsg
|
||||
|
|
|
@ -224,7 +224,7 @@ px4_add_git_submodule(TARGET git_genmsg PATH "Tools/genmsg")
|
|||
px4_add_git_submodule(TARGET git_gencpp PATH "Tools/gencpp")
|
||||
px4_add_git_submodule(TARGET git_mavlink PATH "mavlink/include/mavlink/v1.0")
|
||||
px4_add_git_submodule(TARGET git_gtest PATH "unittets/gtest")
|
||||
px4_add_git_submodule(TARGET git_uavcan PATH "src/lib/uavcan")
|
||||
px4_add_git_submodule(TARGET git_uavcan PATH "src/modules/uavcan/libuavcan")
|
||||
px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
px4_add_git_submodule(TARGET git_dspal PATH "src/lib/dspal")
|
||||
|
|
4
Makefile
4
Makefile
|
@ -177,9 +177,9 @@ distclean: clean
|
|||
@cd NuttX
|
||||
@git clean -d -f -x
|
||||
@cd ..
|
||||
@cd src/lib/uavcan
|
||||
@cd src/modules/uavcan/libuavcan
|
||||
@git clean -d -f -x
|
||||
@cd ../../..
|
||||
@cd ../../../..
|
||||
|
||||
# targets handled by cmake
|
||||
cmake_targets = test upload package package_source debug debug_tui debug_ddd debug_io debug_io_tui debug_io_ddd check_weak libuavcan
|
||||
|
|
|
@ -25,7 +25,7 @@ for fn in $(find src/examples \
|
|||
-path './NuttX' -prune -o \
|
||||
-path './src/lib/eigen' -prune -o \
|
||||
-path './src/lib/mathlib/CMSIS' -prune -o \
|
||||
-path './src/lib/uavcan' -prune -o \
|
||||
-path './src/modules/uavcan/libuavcan' -prune -o \
|
||||
-path './src/modules/attitude_estimator_ekf/codegen' -prune -o \
|
||||
-path './src/modules/ekf_att_pos_estimator' -prune -o \
|
||||
-path './src/modules/sdlog2' -prune -o \
|
||||
|
|
|
@ -138,8 +138,7 @@ function(px4_add_git_submodule)
|
|||
string(REPLACE "/" "_" NAME ${PATH})
|
||||
add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/git_${NAME}.stamp
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
COMMAND git submodule init ${PATH}
|
||||
COMMAND git submodule update -f ${PATH}
|
||||
COMMAND git submodule update --init --recursive -f ${PATH}
|
||||
COMMAND touch ${CMAKE_BINARY_DIR}/git_${NAME}.stamp
|
||||
)
|
||||
add_custom_target(${TARGET}
|
||||
|
@ -544,7 +543,6 @@ function(px4_add_common_flags)
|
|||
endif()
|
||||
|
||||
set(c_warnings
|
||||
-Wbad-function-cast
|
||||
-Wstrict-prototypes
|
||||
-Wmissing-prototypes
|
||||
-Wnested-externs
|
||||
|
|
|
@ -168,8 +168,8 @@ set(config_io_board
|
|||
|
||||
set(config_extra_libs
|
||||
${CMAKE_SOURCE_DIR}/src/lib/mathlib/CMSIS/libarm_cortexM4lf_math.a
|
||||
libuavcan.a
|
||||
libuavcan_stm32_driver.a
|
||||
uavcan
|
||||
uavcan_stm32_driver
|
||||
)
|
||||
|
||||
set(config_io_extra_libs
|
||||
|
|
|
@ -1064,3 +1064,5 @@ CONFIG_SYSTEM_SYSINFO=y
|
|||
#
|
||||
# USB Monitor
|
||||
#
|
||||
|
||||
CONFIG_NSOCKET_DESCRIPTORS=0
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
Subproject commit 86c3397b1b423eeed86f21c8b08c8acfbd5add96
|
|
@ -31,65 +31,30 @@
|
|||
#
|
||||
############################################################################
|
||||
|
||||
# uavcan project
|
||||
set(uavcan_c_flags ${c_flags})
|
||||
list(REMOVE_ITEM uavcan_c_flags -std=gnu++0x -D__CUSTOM_FILE_IO__)
|
||||
set(uavcan_cxx_flags ${cxx_flags})
|
||||
list(REMOVE_ITEM uavcan_cxx_flags -std=gnu++0x -std=c++11 -Wundef -Werror -D__CUSTOM_FILE_IO__)
|
||||
set(uavcan_deps git_uavcan)
|
||||
set(uavcan_platform generic)
|
||||
|
||||
set(nuttx_export_dir ${CMAKE_BINARY_DIR}/${BOARD}/NuttX/nuttx-export)
|
||||
set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03")
|
||||
set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform")
|
||||
|
||||
string(TOUPPER "${OS}" OS_UPPER)
|
||||
|
||||
set(uavcan_definitions
|
||||
-DUAVCAN_NO_ASSERTIONS
|
||||
-DUAVCAN_STM32_NUM_IFACES=2
|
||||
-DUAVCAN_USE_EXTERNAL_SNPRINT
|
||||
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48
|
||||
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16
|
||||
-DUAVCAN_STM32_TIMER_NUMBER=5
|
||||
-DUAVCAN_STM32_${OS_UPPER}=1
|
||||
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03
|
||||
)
|
||||
set(uavcan_extra_flags ${uavcan_definitions} -I${CMAKE_SOURCE_DIR}/src/include)
|
||||
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
set(uavcan_platform stm32)
|
||||
list(APPEND uavcan_extra_flags
|
||||
-I${nuttx_export_dir}/include
|
||||
-I${nuttx_export_dir}/include/cxx
|
||||
-I${nuttx_export_dir}/arch/chip
|
||||
-I${nuttx_export_dir}/arch/common
|
||||
)
|
||||
list(APPEND uavcan_deps nuttx_export_${BOARD})
|
||||
endif()
|
||||
|
||||
list(APPEND uavcan_c_flags ${uavcan_extra_flags})
|
||||
list(APPEND uavcan_cxx_flags ${uavcan_extra_flags})
|
||||
|
||||
px4_join(OUT uavcan_c_flags LIST "${uavcan_c_flags}" GLUE " ")
|
||||
px4_join(OUT uavcan_cxx_flags LIST "${uavcan_cxx_flags}" GLUE " ")
|
||||
|
||||
externalproject_add(libuavcan
|
||||
DEPENDS ${uavcan_deps}
|
||||
DOWNLOAD_COMMAND ""
|
||||
UPDATE_COMMAND git submodule update --init
|
||||
LOG_INSTALL 1
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/src/lib/uavcan
|
||||
CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
||||
add_definitions(
|
||||
-DUAVCAN_CPP_VERSION=UAVCAN_CPP03
|
||||
-DUAVCAN_MAX_NETWORK_SIZE_HINT=16
|
||||
-DUAVCAN_MEM_POOL_BLOCK_SIZE=48
|
||||
-DUAVCAN_NO_ASSERTIONS
|
||||
-DUAVCAN_PLATFORM=stm32
|
||||
-DUAVCAN_STM32_${OS_UPPER}=1
|
||||
-DUAVCAN_STM32_NUM_IFACES=2
|
||||
-DUAVCAN_STM32_TIMER_NUMBER=5
|
||||
-DUAVCAN_USE_CPP03=ON
|
||||
-DUAVCAN_PLATFORM=${uavcan_platform}
|
||||
-DUAVCAN_OS=${OS}
|
||||
-DCMAKE_CXX_FLAGS=${uavcan_cxx_flags}
|
||||
-DCMAKE_C_FLAGS=${uavcan_c_flags}
|
||||
-DCMAKE_INSTALL_PREFIX=${ep_base}/Install
|
||||
)
|
||||
-DUAVCAN_USE_EXTERNAL_SNPRINT
|
||||
)
|
||||
|
||||
string(TOUPPER ${OS} OS_UPPER)
|
||||
add_subdirectory(libuavcan EXCLUDE_FROM_ALL)
|
||||
add_dependencies(uavcan platforms__nuttx)
|
||||
|
||||
add_definitions(${uavcan_definitions})
|
||||
include_directories(libuavcan/libuavcan/include)
|
||||
include_directories(libuavcan/libuavcan/include/dsdlc_generated)
|
||||
include_directories(libuavcan/libuavcan_drivers/posix/include)
|
||||
include_directories(libuavcan/libuavcan_drivers/stm32/driver/include)
|
||||
|
||||
px4_add_module(
|
||||
MODULE modules__uavcan
|
||||
|
@ -100,7 +65,6 @@ px4_add_module(
|
|||
-Wno-deprecated-declarations
|
||||
-O3
|
||||
SRCS
|
||||
|
||||
# Main
|
||||
uavcan_main.cpp
|
||||
uavcan_servers.cpp
|
||||
|
@ -117,7 +81,7 @@ px4_add_module(
|
|||
|
||||
DEPENDS
|
||||
platforms__common
|
||||
libuavcan
|
||||
uavcan
|
||||
)
|
||||
|
||||
## vim: set noet ft=cmake fenc=utf-8 ff=unix :
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Subproject commit 0643879922239930cf7482777356f06891c26616
|
Loading…
Reference in New Issue