mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-04-14 10:07:39 +08:00
cmake qurt and posix fixes for cmake
Added generation of build_git_version.h Added separate src/lib/eigen-3.2 dir for qurt (new submodule) Added patching of eigen-3.2 for qurt (compiler has issue with Complex) Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
parent
73a328473e
commit
75f1f91784
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -22,3 +22,6 @@
|
||||
[submodule "src/lib/dspal"]
|
||||
path = src/lib/dspal
|
||||
url = https://github.com/mcharleb/dspal.git
|
||||
[submodule "src/lib/eigen-3.2"]
|
||||
path = src/lib/eigen-3.2
|
||||
url = https://github.com/PX4/eigen.git
|
||||
|
||||
@ -175,12 +175,16 @@ endforeach()
|
||||
#=============================================================================
|
||||
# git
|
||||
#
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
if (${OS} STREQUAL "nuttx")
|
||||
px4_add_git_submodule(TARGET git_nuttx PATH "NuttX")
|
||||
endif()
|
||||
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_eigen PATH "src/lib/eigen")
|
||||
if (NOT ${OS} STREQUAL "qurt")
|
||||
px4_add_git_submodule(TARGET git_eigen PATH "src/lib/eigen")
|
||||
endif()
|
||||
|
||||
add_custom_target(submodule_clean
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
@ -233,6 +237,12 @@ add_subdirectory(src)
|
||||
# set the overall objective of the build
|
||||
add_custom_target(ALL firmware_${OS})
|
||||
|
||||
#=============================================================================
|
||||
# generate git version
|
||||
#
|
||||
include(px4_git_hash)
|
||||
px4_create_git_hash_header(HEADER ${CMAKE_BINARY_DIR}/build_git_version.h)
|
||||
|
||||
#=============================================================================
|
||||
# packaging
|
||||
#
|
||||
|
||||
4
cmake/build_git_version.h.in
Normal file
4
cmake/build_git_version.h.in
Normal file
@ -0,0 +1,4 @@
|
||||
/* Auto Magically Generated file */
|
||||
/* Do not edit! */
|
||||
#define PX4_GIT_VERSION_STR @git_desc@
|
||||
#define PX4_GIT_VERSION_BINARY 0x@git_desc_short@
|
||||
@ -581,13 +581,18 @@ function(px4_add_common_flags)
|
||||
# TODO Build/versioning was in Makefile,
|
||||
# do we need this, how does it work with cmake
|
||||
src/drivers/boards/${BOARD}
|
||||
src/lib/eigen
|
||||
${CMAKE_BINARY_DIR}
|
||||
${CMAKE_BINARY_DIR}/src/modules/px4_messages
|
||||
${CMAKE_BINARY_DIR}/src/modules
|
||||
mavlink/include/mavlink
|
||||
)
|
||||
|
||||
if (NOT ${OS} STREQUAL "qurt")
|
||||
list(APPEND added_include_dirs
|
||||
src/lib/eigen
|
||||
)
|
||||
endif()
|
||||
|
||||
set(added_link_dirs) # none used currently
|
||||
|
||||
string(TOUPPER ${BOARD} board_upper)
|
||||
|
||||
31
cmake/px4_git_hash.cmake
Normal file
31
cmake/px4_git_hash.cmake
Normal file
@ -0,0 +1,31 @@
|
||||
#=============================================================================
|
||||
#
|
||||
# px4_create_git_hash_header
|
||||
#
|
||||
# Create a header file containing the git hash of the current tree
|
||||
#
|
||||
# Usage:
|
||||
# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h)
|
||||
#
|
||||
# Input:
|
||||
# HEADER : path of the header file to generate
|
||||
#
|
||||
# Example:
|
||||
# px4_create_git_hash_header(HEADER ${CMAKE_BUILD_DIR}/git_hash.h)
|
||||
#
|
||||
function(px4_create_git_hash_header)
|
||||
px4_parse_function_args(
|
||||
NAME px4_create_git_hash_header
|
||||
ONE_VALUE HEADER
|
||||
REQUIRED HEADER
|
||||
ARGN ${ARGN})
|
||||
execute_process(
|
||||
COMMAND git log -n 1 --pretty=format:"%H"
|
||||
OUTPUT_VARIABLE git_desc
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
message(STATUS "GIT_DESC = ${git_desc}")
|
||||
set(git_desc_short)
|
||||
string(SUBSTRING ${git_desc} 1 16 git_desc_short)
|
||||
configure_file(${CMAKE_SOURCE_DIR}/cmake/build_git_version.h.in ${HEADER} @ONLY)
|
||||
endfunction()
|
||||
@ -227,6 +227,9 @@ function(px4_os_prebuild_targets)
|
||||
REQUIRED OUT BOARD
|
||||
ARGN ${ARGN})
|
||||
add_custom_target(${OUT})
|
||||
execute_process(
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/src/lib/eigen-3.2
|
||||
COMMAND patch -p1 -i ../../../cmake/qurt/qurt_eigen.patch)
|
||||
endfunction()
|
||||
|
||||
#=============================================================================
|
||||
|
||||
17
cmake/qurt/qurt_eigen.patch
Normal file
17
cmake/qurt/qurt_eigen.patch
Normal file
@ -0,0 +1,17 @@
|
||||
This patch is required for QuRT. complex.h defines "I" and it replaces "I" in the
|
||||
enum definition without this patch creating an error.
|
||||
|
||||
diff --git a/Eigen/src/Core/SolveTriangular.h b/Eigen/src/Core/SolveTriangular.h
|
||||
index ef17f28..1116270 100644
|
||||
--- a/Eigen/src/Core/SolveTriangular.h
|
||||
+++ b/Eigen/src/Core/SolveTriangular.h
|
||||
@@ -112,6 +112,9 @@ template<typename Lhs, typename Rhs, int Mode, int Index, int Size,
|
||||
bool Stop = Index==Size>
|
||||
struct triangular_solver_unroller;
|
||||
|
||||
+#ifdef __PX4_QURT
|
||||
+#undef I
|
||||
+#endif
|
||||
template<typename Lhs, typename Rhs, int Mode, int Index, int Size>
|
||||
struct triangular_solver_unroller<Lhs,Rhs,Mode,Index,Size,false> {
|
||||
enum {
|
||||
@ -1,2 +0,0 @@
|
||||
#define PX4_GIT_VERSION_STR "1234567890123456789012345678901234567890"
|
||||
#define PX4_GIT_VERSION_BINARY 0x1234567890123456
|
||||
1
src/lib/eigen-3.2
Submodule
1
src/lib/eigen-3.2
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit e7850ed81f9c469e02df496ef09ae32ec0379b71
|
||||
Loading…
x
Reference in New Issue
Block a user