forked from Archive/PX4-Autopilot
mavlink: cmake generate mavlink headers at build time
- mavlink/mavlink is now directly included as a submodule instead of the generated mavlink/c_library_v2 - this also switches to mavlink development.xml by default
This commit is contained in:
parent
88489ae8bd
commit
5969508fa7
|
@ -1,6 +1,6 @@
|
||||||
[submodule "mavlink/include/mavlink/v2.0"]
|
[submodule "src/modules/mavlink/mavlink"]
|
||||||
path = mavlink/include/mavlink/v2.0
|
path = src/modules/mavlink/mavlink
|
||||||
url = https://github.com/mavlink/c_library_v2.git
|
url = https://github.com/mavlink/mavlink.git
|
||||||
branch = master
|
branch = master
|
||||||
[submodule "src/drivers/uavcan/libuavcan"]
|
[submodule "src/drivers/uavcan/libuavcan"]
|
||||||
path = src/drivers/uavcan/libuavcan
|
path = src/drivers/uavcan/libuavcan
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
url = https://github.com/mavlink/libevents.git
|
url = https://github.com/mavlink/libevents.git
|
||||||
[submodule "Tools/simulation-ignition"]
|
[submodule "Tools/simulation-ignition"]
|
||||||
path = Tools/simulation-ignition
|
path = Tools/simulation-ignition
|
||||||
url = https://github.com/Auterion/px4-simulation-ignition.git
|
url = https://github.com/PX4/px4-simulation-ignition.git
|
||||||
[submodule "src/lib/crypto/libtomcrypt"]
|
[submodule "src/lib/crypto/libtomcrypt"]
|
||||||
path = src/lib/crypto/libtomcrypt
|
path = src/lib/crypto/libtomcrypt
|
||||||
url = https://github.com/PX4/libtomcrypt.git
|
url = https://github.com/PX4/libtomcrypt.git
|
||||||
|
|
|
@ -21,6 +21,7 @@ exec find boards msg src platforms test \
|
||||||
-path src/lib/parameters/uthash -prune -o \
|
-path src/lib/parameters/uthash -prune -o \
|
||||||
-path src/modules/ekf2/EKF -prune -o \
|
-path src/modules/ekf2/EKF -prune -o \
|
||||||
-path src/modules/gyro_fft/CMSIS_5 -prune -o \
|
-path src/modules/gyro_fft/CMSIS_5 -prune -o \
|
||||||
|
-path src/modules/mavlink/mavlink -prune -o \
|
||||||
-path src/modules/micrortps_bridge/micro-CDR -prune -o \
|
-path src/modules/micrortps_bridge/micro-CDR -prune -o \
|
||||||
-path src/modules/micrortps_bridge/microRTPS_client -prune -o \
|
-path src/modules/micrortps_bridge/microRTPS_client -prune -o \
|
||||||
-path test/mavsdk_tests/catch2 -prune -o \
|
-path test/mavsdk_tests/catch2 -prune -o \
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 7c2c623da9f5dcb3f01d32830af1a2ed958de363
|
Subproject commit ea9b6cb5b93365928190864a6592c0a280e101ea
|
|
@ -1 +1 @@
|
||||||
Subproject commit e070c50d591541d440510b65c9da5cad1db5aa9a
|
Subproject commit 68de2cc63ded9a0d6641d45e9eb3ed2b43454cba
|
|
@ -6,6 +6,7 @@ empy>=3.3
|
||||||
jinja2>=2.8
|
jinja2>=2.8
|
||||||
jsonschema
|
jsonschema
|
||||||
kconfiglib
|
kconfiglib
|
||||||
|
lxml
|
||||||
matplotlib>=3.0.*
|
matplotlib>=3.0.*
|
||||||
numpy>=1.13
|
numpy>=1.13
|
||||||
nunavut>=1.1.0
|
nunavut>=1.1.0
|
||||||
|
|
|
@ -86,6 +86,8 @@ sudo DEBIAN_FRONTEND=noninteractive apt-get -y --quiet --no-install-recommends i
|
||||||
gdb \
|
gdb \
|
||||||
git \
|
git \
|
||||||
lcov \
|
lcov \
|
||||||
|
libxml2-dev \
|
||||||
|
libxml2-utils \
|
||||||
make \
|
make \
|
||||||
ninja-build \
|
ninja-build \
|
||||||
python3 \
|
python3 \
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit e78ad94a4f41bbc202fd7fc1acb728b09cb1dbaf
|
Subproject commit 0ea4dbe2c3dac84f5927a59b1caf5e5561cf942e
|
|
@ -1 +1 @@
|
||||||
Subproject commit d8366bf2389eae6106d1dbfaac72ebfdf23a5d2d
|
Subproject commit 1c8c9197103e746a21f2d2d2c844dd2f7e2b036b
|
|
@ -125,7 +125,7 @@ function(px4_add_module)
|
||||||
# as well as interface include and libraries
|
# as well as interface include and libraries
|
||||||
foreach(dep ${DEPENDS})
|
foreach(dep ${DEPENDS})
|
||||||
get_target_property(dep_type ${dep} TYPE)
|
get_target_property(dep_type ${dep} TYPE)
|
||||||
if (${dep_type} STREQUAL "STATIC_LIBRARY")
|
if((${dep_type} STREQUAL "STATIC_LIBRARY") OR (${dep_type} STREQUAL "INTERFACE_LIBRARY"))
|
||||||
target_link_libraries(${MODULE}_original PRIVATE ${dep})
|
target_link_libraries(${MODULE}_original PRIVATE ${dep})
|
||||||
else()
|
else()
|
||||||
add_dependencies(${MODULE}_original ${dep})
|
add_dependencies(${MODULE}_original ${dep})
|
||||||
|
@ -205,7 +205,7 @@ function(px4_add_module)
|
||||||
# as well as interface include and libraries
|
# as well as interface include and libraries
|
||||||
foreach(dep ${DEPENDS})
|
foreach(dep ${DEPENDS})
|
||||||
get_target_property(dep_type ${dep} TYPE)
|
get_target_property(dep_type ${dep} TYPE)
|
||||||
if (${dep_type} STREQUAL "STATIC_LIBRARY")
|
if((${dep_type} STREQUAL "STATIC_LIBRARY") OR (${dep_type} STREQUAL "INTERFACE_LIBRARY"))
|
||||||
target_link_libraries(${MODULE} PRIVATE ${dep})
|
target_link_libraries(${MODULE} PRIVATE ${dep})
|
||||||
else()
|
else()
|
||||||
add_dependencies(${MODULE} ${dep})
|
add_dependencies(${MODULE} ${dep})
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
Subproject commit 5571ffbcd67e19ee6c6301fe13712856906525c2
|
|
|
@ -135,9 +135,9 @@ if (os.path.exists('src/lib/ecl/.git')):
|
||||||
|
|
||||||
|
|
||||||
# Mavlink
|
# Mavlink
|
||||||
if (os.path.exists('mavlink/include/mavlink/v2.0/.git')):
|
if (os.path.exists('src/modules/mavlink/mavlink/.git')):
|
||||||
mavlink_git_version = subprocess.check_output('git rev-parse --verify HEAD'.split(),
|
mavlink_git_version = subprocess.check_output('git rev-parse --verify HEAD'.split(),
|
||||||
cwd='mavlink/include/mavlink/v2.0', stderr=subprocess.STDOUT).decode('utf-8').strip()
|
cwd='src/modules/mavlink/mavlink', stderr=subprocess.STDOUT).decode('utf-8').strip()
|
||||||
mavlink_git_version_short = mavlink_git_version[0:16]
|
mavlink_git_version_short = mavlink_git_version[0:16]
|
||||||
|
|
||||||
header += f"""
|
header += f"""
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
############################################################################
|
############################################################################
|
||||||
#
|
#
|
||||||
# Copyright (c) 2015-2017 PX4 Development Team. All rights reserved.
|
# Copyright (c) 2015-2021 PX4 Development Team. All rights reserved.
|
||||||
#
|
#
|
||||||
# Redistribution and use in source and binary forms, with or without
|
# Redistribution and use in source and binary forms, with or without
|
||||||
# modification, are permitted provided that the following conditions
|
# modification, are permitted provided that the following conditions
|
||||||
|
@ -31,18 +31,51 @@
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
px4_add_git_submodule(TARGET git_mavlink_v2 PATH "${PX4_SOURCE_DIR}/mavlink/include/mavlink/v2.0")
|
set(MAVLINK_DIALECT "development") # standard, development, etc
|
||||||
|
|
||||||
|
# force mavlink dialect to standard if flash constrained
|
||||||
|
if(px4_constrained_flash_build)
|
||||||
|
set(MAVLINK_DIALECT "standard")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(MAVLINK_GIT_DIR "${CMAKE_CURRENT_LIST_DIR}/mavlink")
|
||||||
|
set(MAVLINK_LIBRARY_DIR "${CMAKE_BINARY_DIR}/mavlink")
|
||||||
|
file(RELATIVE_PATH MAVLINK_GIT_DIR_RELATIVE ${CMAKE_SOURCE_DIR} ${MAVLINK_GIT_DIR})
|
||||||
|
|
||||||
|
px4_add_git_submodule(TARGET git_mavlink_v2 PATH "${MAVLINK_GIT_DIR}")
|
||||||
|
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT}/${MAVLINK_DIALECT}.h
|
||||||
|
COMMAND
|
||||||
|
${PYTHON_EXECUTABLE} ${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
|
||||||
|
--lang C --wire-protocol 2.0
|
||||||
|
#--no-validate
|
||||||
|
#--strict-units
|
||||||
|
--output ${MAVLINK_LIBRARY_DIR}
|
||||||
|
${MAVLINK_GIT_DIR}/message_definitions/v1.0/${MAVLINK_DIALECT}.xml
|
||||||
|
DEPENDS
|
||||||
|
git_mavlink_v2
|
||||||
|
${MAVLINK_GIT_DIR}/pymavlink/tools/mavgen.py
|
||||||
|
${MAVLINK_GIT_DIR}/message_definitions/v1.0/${MAVLINK_DIALECT}.xml
|
||||||
|
COMMENT "Generating Mavlink ${MAVLINK_DIALECT}: ${MAVLINK_GIT_DIR_RELATIVE}/message_definitions/v1.0/${MAVLINK_DIALECT}.xml"
|
||||||
|
USES_TERMINAL
|
||||||
|
)
|
||||||
|
add_custom_target(mavlink_c_generate DEPENDS ${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT}/${MAVLINK_DIALECT}.h)
|
||||||
|
|
||||||
|
# mavlink header only library
|
||||||
|
add_library(mavlink_c INTERFACE)
|
||||||
|
target_sources(mavlink_c INTERFACE ${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT}/${MAVLINK_DIALECT}.h)
|
||||||
|
set_source_files_properties(${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT}/${MAVLINK_DIALECT}.h PROPERTIES GENERATED true)
|
||||||
|
target_include_directories(mavlink_c INTERFACE ${MAVLINK_LIBRARY_DIR} ${MAVLINK_LIBRARY_DIR}/${MAVLINK_DIALECT})
|
||||||
|
target_compile_options(mavlink_c INTERFACE -Wno-address-of-packed-member -Wno-cast-align)
|
||||||
|
|
||||||
|
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE modules__mavlink
|
MODULE modules__mavlink
|
||||||
MAIN mavlink
|
MAIN mavlink
|
||||||
COMPILE_FLAGS
|
COMPILE_FLAGS
|
||||||
-Wno-cast-align # TODO: fix and enable
|
|
||||||
-Wno-address-of-packed-member # TODO: fix in c_library_v2
|
|
||||||
-Wno-enum-compare # ROTATION <-> MAV_SENSOR_ROTATION
|
-Wno-enum-compare # ROTATION <-> MAV_SENSOR_ROTATION
|
||||||
#-DDEBUG_BUILD
|
#-DDEBUG_BUILD
|
||||||
INCLUDES
|
|
||||||
${PX4_SOURCE_DIR}/mavlink/include/mavlink
|
|
||||||
SRCS
|
SRCS
|
||||||
mavlink.c
|
mavlink.c
|
||||||
mavlink_command_sender.cpp
|
mavlink_command_sender.cpp
|
||||||
|
@ -70,9 +103,9 @@ px4_add_module(
|
||||||
drivers_barometer
|
drivers_barometer
|
||||||
drivers_gyroscope
|
drivers_gyroscope
|
||||||
drivers_magnetometer
|
drivers_magnetometer
|
||||||
git_mavlink_v2
|
|
||||||
conversion
|
conversion
|
||||||
geo
|
geo
|
||||||
|
mavlink_c
|
||||||
version
|
version
|
||||||
UNITY_BUILD
|
UNITY_BUILD
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1 @@
|
||||||
|
Subproject commit 3718ee300bef7a8e7a25314e25e03c11d9f0b180
|
|
@ -61,7 +61,7 @@
|
||||||
# define MAVLINK_COMM_5 static_cast<mavlink_channel_t>(5)
|
# define MAVLINK_COMM_5 static_cast<mavlink_channel_t>(5)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <v2.0/mavlink_types.h>
|
#include <mavlink_types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
__BEGIN_DECLS
|
__BEGIN_DECLS
|
||||||
|
@ -92,7 +92,7 @@ void mavlink_end_uart_send(mavlink_channel_t chan, int length);
|
||||||
extern mavlink_status_t *mavlink_get_channel_status(uint8_t chan);
|
extern mavlink_status_t *mavlink_get_channel_status(uint8_t chan);
|
||||||
extern mavlink_message_t *mavlink_get_channel_buffer(uint8_t chan);
|
extern mavlink_message_t *mavlink_get_channel_buffer(uint8_t chan);
|
||||||
|
|
||||||
#include <v2.0/standard/mavlink.h>
|
#include <mavlink.h>
|
||||||
|
|
||||||
__END_DECLS
|
__END_DECLS
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
#ifndef MAVLINK_FTP_UNIT_TEST
|
#ifndef MAVLINK_FTP_UNIT_TEST
|
||||||
#include "mavlink_main.h"
|
#include "mavlink_main.h"
|
||||||
#else
|
#else
|
||||||
#include <v2.0/standard/mavlink.h>
|
#include <mavlink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
using namespace time_literals;
|
using namespace time_literals;
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
#ifndef MAVLINK_FTP_UNIT_TEST
|
#ifndef MAVLINK_FTP_UNIT_TEST
|
||||||
#include "mavlink_bridge_header.h"
|
#include "mavlink_bridge_header.h"
|
||||||
#else
|
#else
|
||||||
#include <v2.0/standard/mavlink.h>
|
#include <mavlink.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
class MavlinkFtpTest;
|
class MavlinkFtpTest;
|
||||||
|
|
|
@ -31,12 +31,13 @@
|
||||||
#
|
#
|
||||||
############################################################################
|
############################################################################
|
||||||
|
|
||||||
include_directories(${PX4_SOURCE_DIR}/mavlink/include/mavlink)
|
|
||||||
|
|
||||||
px4_add_module(
|
px4_add_module(
|
||||||
MODULE modules__mavlink__mavlink_tests
|
MODULE modules__mavlink__mavlink_tests
|
||||||
MAIN mavlink_tests
|
MAIN mavlink_tests
|
||||||
STACK_MAIN 8192
|
STACK_MAIN 8192
|
||||||
|
INCLUDES
|
||||||
|
${CMAKE_BINARY_DIR}/mavlink
|
||||||
|
${CMAKE_BINARY_DIR}/mavlink/common
|
||||||
COMPILE_FLAGS
|
COMPILE_FLAGS
|
||||||
-DMAVLINK_FTP_UNIT_TEST
|
-DMAVLINK_FTP_UNIT_TEST
|
||||||
#-DMAVLINK_FTP_DEBUG
|
#-DMAVLINK_FTP_DEBUG
|
||||||
|
|
|
@ -40,7 +40,7 @@
|
||||||
#ifndef MAVLINK_FTP_UNIT_TEST
|
#ifndef MAVLINK_FTP_UNIT_TEST
|
||||||
#include "../mavlink_bridge_header.h"
|
#include "../mavlink_bridge_header.h"
|
||||||
#else
|
#else
|
||||||
#include <v2.0/standard/mavlink.h>
|
#include <mavlink.h>
|
||||||
#endif
|
#endif
|
||||||
#include "../mavlink_ftp.h"
|
#include "../mavlink_ftp.h"
|
||||||
|
|
||||||
|
|
|
@ -55,12 +55,13 @@ px4_add_module(
|
||||||
-Wno-cast-align
|
-Wno-cast-align
|
||||||
-Wno-address-of-packed-member # TODO: fix in c_library_v2
|
-Wno-address-of-packed-member # TODO: fix in c_library_v2
|
||||||
INCLUDES
|
INCLUDES
|
||||||
${PX4_SOURCE_DIR}/mavlink/include/mavlink
|
${CMAKE_BINARY_DIR}/mavlink
|
||||||
|
${CMAKE_BINARY_DIR}/mavlink/development
|
||||||
SRCS
|
SRCS
|
||||||
simulator.cpp
|
simulator.cpp
|
||||||
simulator_mavlink.cpp
|
simulator_mavlink.cpp
|
||||||
DEPENDS
|
DEPENDS
|
||||||
git_mavlink_v2
|
mavlink_c_generate
|
||||||
conversion
|
conversion
|
||||||
geo
|
geo
|
||||||
drivers_accelerometer
|
drivers_accelerometer
|
||||||
|
@ -68,6 +69,6 @@ px4_add_module(
|
||||||
drivers_gyroscope
|
drivers_gyroscope
|
||||||
drivers_magnetometer
|
drivers_magnetometer
|
||||||
)
|
)
|
||||||
target_include_directories(modules__simulator INTERFACE ${PX4_SOURCE_DIR}/mavlink/include/mavlink)
|
target_include_directories(modules__simulator INTERFACE ${CMAKE_BINARY_DIR}/mavlink)
|
||||||
|
|
||||||
add_subdirectory(battery_simulator)
|
add_subdirectory(battery_simulator)
|
||||||
|
|
|
@ -76,8 +76,8 @@
|
||||||
|
|
||||||
#include <random>
|
#include <random>
|
||||||
|
|
||||||
#include <v2.0/common/mavlink.h>
|
#include <mavlink.h>
|
||||||
#include <v2.0/mavlink_types.h>
|
#include <mavlink_types.h>
|
||||||
|
|
||||||
using namespace time_literals;
|
using namespace time_literals;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue