cmake handle git submodule depdencies

This commit is contained in:
Daniel Agar
2017-11-23 00:22:45 -05:00
parent cea2c36000
commit d1a4c2dcd0
11 changed files with 79 additions and 66 deletions
+4 -2
View File
@@ -30,11 +30,13 @@
# POSSIBILITY OF SUCH DAMAGE.
#
############################################################################
px4_add_git_submodule(TARGET git_gps_devices PATH "devices")
px4_add_module(
MODULE drivers__gps
MAIN gps
STACK_MAIN 1200
COMPILE_FLAGS
SRCS
gps.cpp
devices/src/gps_helper.cpp
@@ -43,5 +45,5 @@ px4_add_module(
devices/src/ubx.cpp
DEPENDS
platforms__common
git_gps_devices
)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
+3 -1
View File
@@ -107,7 +107,9 @@ elseif ("${BOARD}" STREQUAL "bebop")
elseif ("${BOARD}" STREQUAL "sitl")
include(./sitl_target.cmake)
include(./sitl_tests.cmake)
if(BUILD_TESTING)
include(./sitl_tests.cmake)
endif()
else()
+16 -7
View File
@@ -1,6 +1,6 @@
function(px4_add_sitl_app)
px4_parse_function_args(NAME px4_add_sitl_app
px4_parse_function_args(NAME px4_add_sitl_app
ONE_VALUE APP_NAME MAIN_SRC UPLOAD_NAME
REQUIRED APP_NAME MAIN_SRC
ARGN ${ARGN}
@@ -56,11 +56,14 @@ add_custom_target(run_config
${config_sitl_model}
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
DEPENDS px4 logs_symlink
)
px4_add_git_submodule(TARGET git_gazebo PATH "${PX4_SOURCE_DIR}/Tools/sitl_gazebo")
px4_add_git_submodule(TARGET git_jmavsim PATH "${PX4_SOURCE_DIR}/Tools/jMAVSim")
# Add support for external project building
include(ExternalProject)
@@ -70,13 +73,16 @@ ExternalProject_Add(sitl_gazebo
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}
BINARY_DIR ${PX4_BINARY_DIR}/build_gazebo
INSTALL_COMMAND ""
DEPENDS
git_gazebo
)
set_target_properties(sitl_gazebo PROPERTIES EXCLUDE_FROM_ALL TRUE)
ExternalProject_Add_Step(sitl_gazebo forceconfigure
DEPENDEES update
DEPENDERS configure
ALWAYS 1)
ALWAYS 1
)
# create targets for each viewer/model/debugger combination
set(viewers none jmavsim gazebo replay)
@@ -123,9 +129,10 @@ foreach(viewer ${viewers})
${model}
${PX4_SOURCE_DIR}
${PX4_BINARY_DIR}
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
DEPENDS logs_symlink
WORKING_DIRECTORY ${SITL_WORKING_DIR}
USES_TERMINAL
DEPENDS
logs_symlink
)
list(APPEND all_posix_vmd_make_targets ${_targ_name})
if (viewer STREQUAL "gazebo")
@@ -133,6 +140,8 @@ foreach(viewer ${viewers})
if (viewer STREQUAL "gazebo")
add_dependencies(${_targ_name} px4_${model})
endif()
elseif(viewer STREQUAL "jmavsim")
add_dependencies(${_targ_name} git_jmavsim)
endif()
endforeach()
endforeach()
-1
View File
@@ -43,4 +43,3 @@ px4_add_module(
platforms__common
git_ecl
)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
+6 -2
View File
@@ -31,7 +31,8 @@
#
############################################################################
include_directories(${PX4_SOURCE_DIR}/mavlink/include/mavlink)
px4_add_git_submodule(TARGET git_mavlink PATH "${PX4_SOURCE_DIR}/mavlink/include/mavlink/v1.0")
px4_add_git_submodule(TARGET git_mavlink2 PATH "${PX4_SOURCE_DIR}/mavlink/include/mavlink/v2.0")
px4_add_module(
MODULE modules__mavlink
@@ -41,6 +42,8 @@ px4_add_module(
COMPILE_FLAGS
-Wno-extra-semi
-Wno-sign-compare # TODO: fix all sign-compare
INCLUDES
${PX4_SOURCE_DIR}/mavlink/include/mavlink
SRCS
mavlink.c
mavlink_command_sender.cpp
@@ -58,5 +61,6 @@ px4_add_module(
mavlink_ulog.cpp
DEPENDS
platforms__common
git_mavlink
git_mavlink2
)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
-4
View File
@@ -63,8 +63,4 @@ px4_add_module(
${SIMULATOR_SRCS}
DEPENDS
platforms__common
git_jmavsim
git_gazebo
)
# vim: set noet ft=cmake fenc=utf-8 ff=unix :
+11 -8
View File
@@ -31,6 +31,8 @@
#
############################################################################
px4_add_git_submodule(TARGET git_uavcan PATH "libuavcan")
set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03")
set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform")
@@ -50,20 +52,19 @@ add_definitions(
)
add_subdirectory(libuavcan EXCLUDE_FROM_ALL)
add_dependencies(uavcan platforms__nuttx)
include_directories(${PX4_SOURCE_DIR}/mavlink/include/mavlink)
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)
add_dependencies(uavcan prebuild_targets)
px4_add_module(
MODULE modules__uavcan
MAIN uavcan
STACK_MAIN 3200
STACK_MAX 1500
COMPILE_FLAGS
INCLUDES
${PX4_SOURCE_DIR}/mavlink/include/mavlink
libuavcan/libuavcan/include
libuavcan/libuavcan/include/dsdlc_generated
libuavcan/libuavcan_drivers/posix/include
libuavcan/libuavcan_drivers/stm32/driver/include
SRCS
# Main
uavcan_main.cpp
@@ -81,8 +82,10 @@ px4_add_module(
sensors/baro.cpp
DEPENDS
git_uavcan
platforms__common
uavcan
uavcan_stm32_driver
)
target_link_libraries(modules__uavcan uavcan uavcan_stm32_driver)