Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place. Commercial Alternative to JupyterHub.
Path: blob/master/Tools/ros2/ardupilot_sitl/CMakeLists.txt
Views: 1799
cmake_minimum_required(VERSION 3.20)1project(ardupilot_sitl)23# --------------------------------------------------------------------------- #4# Find dependencies.5find_package(ament_cmake REQUIRED)6find_package(ament_cmake_python REQUIRED)78# --------------------------------------------------------------------------- #9# Add custom targets to configure and build ardupilot.1011# TODO(srmainwaring): add cache variables for vehicle type, debug etc.12# set(ARDUPILOT_VEHICLE "copter" CACHE STRING "Vehicle type")1314option(ARDUPILOT_DISABLE_NETWORKING "Disable the networking API code" OFF)15option(ARDUPILOT_DISABLE_SCRIPTING "Disable the scripting API code" OFF)16option(ARDUPILOT_DISABLE_WATCHDOG "Build with watchdog disabled" OFF)17option(ARDUPILOT_ENABLE_DDS "Enable the DDS client" ON)18option(ARDUPILOT_ENABLE_NETWORKING_TESTS "Enable the networking test code" OFF)19option(ARDUPILOT_ENABLE_PPP "Enable PPP networking" OFF)20set(ARDUPILOT_WAF_CONFIGURE_ARGS "" CACHE STRING "Arbitrary waf configure arguments")21set(ARDUPILOT_WAF_BUILD_ARGS "" CACHE STRING "Arbitrary waf build arguments")222324# NOTE: look for `waf` and set source and build directories to top level.25# ${PROJECT_SOURCE_DIR} = ./Tools/ros2/ardupilot26#27cmake_path(SET ARDUPILOT_ROOT NORMALIZE ${PROJECT_SOURCE_DIR}/../../..)2829find_program(WAF_COMMAND waf HINTS ${ARDUPILOT_ROOT})30message(STATUS "WAF_COMMAND: ${WAF_COMMAND}")3132# Set the build config.33set(WAF_CONFIG $<$<OR:$<CONFIG:Debug>,$<CONFIG:RelWithDebInfo>>:"--debug">)34set(WAF_DISABLE_NETWORKING $<$<BOOL:${ARDUPILOT_DISABLE_NETWORKING}>:"--disable-networking">)35set(WAF_DISABLE_SCRIPTING $<$<BOOL:${ARDUPILOT_DISABLE_SCRIPTING}>:"--disable-scripting">)36set(WAF_DISABLE_WATCHDOG $<$<BOOL:${ARDUPILOT_DISABLE_WATCHDOG}>:"--disable-watchdog">)37set(WAF_ENABLE_DDS $<$<BOOL:${ARDUPILOT_ENABLE_DDS}>:"--enable-dds">)38set(WAF_ENABLE_NETWORKING_TESTS $<$<BOOL:${ARDUPILOT_ENABLE_NETWORKING_TESTS}>:"--enable-networking-tests">)39set(WAF_ENABLE_PPP $<$<BOOL:${ARDUPILOT_ENABLE_PPP}>:"--enable-PPP">)4041add_custom_target(ardupilot_configure ALL42${WAF_COMMAND} configure --board sitl43${WAF_CONFIG}44${WAF_DISABLE_NETWORKING}45${WAF_DISABLE_SCRIPTING}46${WAF_DISABLE_WATCHDOG}47${WAF_ENABLE_DDS}48${WAF_ENABLE_NETWORKING_TESTS}49${WAF_ENABLE_PPP}50${ARDUPILOT_WAF_CONFIGURE_ARGS}51WORKING_DIRECTORY ${ARDUPILOT_ROOT}52)5354add_custom_target(ardupilot_build ALL55${WAF_COMMAND} build --enable-dds ${WAF_CONFIG} ${ARDUPILOT_WAF_BUILD_ARGS}56WORKING_DIRECTORY ${ARDUPILOT_ROOT}57)58add_dependencies(ardupilot_build ardupilot_configure)5960# --------------------------------------------------------------------------- #61# Install.6263# Install executables.64install(PROGRAMS65${ARDUPILOT_ROOT}/build/sitl/bin/antennatracker66${ARDUPILOT_ROOT}/build/sitl/bin/arducopter67${ARDUPILOT_ROOT}/build/sitl/bin/arducopter-heli68${ARDUPILOT_ROOT}/build/sitl/bin/arduplane69${ARDUPILOT_ROOT}/build/sitl/bin/ardurover70${ARDUPILOT_ROOT}/build/sitl/bin/ardusub71${ARDUPILOT_ROOT}/build/sitl/bin/blimp72DESTINATION bin/73)7475# Install libs.76install(DIRECTORY77${ARDUPILOT_ROOT}/build/sitl/lib78DESTINATION ./79)8081# Install launch files.82install(DIRECTORY83launch84DESTINATION share/${PROJECT_NAME}/85)8687# Install additional default params.88install(DIRECTORY89config/default_params90DESTINATION share/${PROJECT_NAME}/config91)9293# Install autotest default params.94install(DIRECTORY95${ARDUPILOT_ROOT}/Tools/autotest/default_params96DESTINATION share/${PROJECT_NAME}/config/97)9899# Install additional autotest model params.100install(DIRECTORY101${ARDUPILOT_ROOT}/Tools/autotest/models102DESTINATION share/${PROJECT_NAME}/config/103)104105# Install Python package.106ament_python_install_package(${PROJECT_NAME}107PACKAGE_DIR src/${PROJECT_NAME}108)109110# --------------------------------------------------------------------------- #111# build tests112113if(BUILD_TESTING)114# Add linters.115find_package(ament_lint_auto REQUIRED)116ament_lint_auto_find_test_dependencies()117118# Add python tests.119find_package(ament_cmake_pytest REQUIRED)120set(_pytest_tests121# Add tests here, for example:122# tests/test_a.py123)124foreach(_test_path ${_pytest_tests})125get_filename_component(_test_name ${_test_path} NAME_WE)126ament_add_pytest_test(${_test_name} ${_test_path}127APPEND_ENV PYTHONPATH=${CMAKE_CURRENT_BINARY_DIR}128TIMEOUT 60129WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}130)131endforeach()132endif()133134# --------------------------------------------------------------------------- #135# Call last.136137ament_package()138139140