Skip to content
Snippets Groups Projects
Commit db8900ff authored by Daniel Agar's avatar Daniel Agar
Browse files

cmake improve git submodule dependencies

parent 1086d4a1
No related branches found
No related tags found
No related merge requests found
......@@ -110,6 +110,25 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PX4_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${PX4_BINARY_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${PX4_BINARY_DIR})
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/cmake")
#=============================================================================
# git
#
include(common/px4_git)
execute_process(
COMMAND git describe --always --tags
OUTPUT_VARIABLE git_tag
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
px4_add_git_submodule(TARGET git_cmake_hexagon PATH "cmake/cmake_hexagon")
px4_add_git_submodule(TARGET git_uavcan_board_ident PATH "cmake/configs/uavcan_board_ident")
px4_add_git_submodule(TARGET git_ecl PATH "src/lib/ecl")
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
define_property(GLOBAL PROPERTY PX4_LIBRARIES
BRIEF_DOCS "PX4 libs"
FULL_DOCS "List of all PX4 module libraries"
......@@ -138,7 +157,6 @@ if (NOT EXTERNAL_MODULES_LOCATION STREQUAL "")
get_filename_component(EXTERNAL_MODULES_LOCATION "${EXTERNAL_MODULES_LOCATION}" ABSOLUTE)
endif()
list(APPEND CMAKE_MODULE_PATH "${PX4_SOURCE_DIR}/cmake")
set(config_module "configs/${CONFIG}")
include(${config_module})
......@@ -163,31 +181,6 @@ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug;Release;RelWithDebIn
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE}")
#=============================================================================
# git
#
include(common/px4_git)
# version info from git
execute_process(
COMMAND Tools/tag_to_version.py --root ${PX4_SOURCE_DIR}
OUTPUT_VARIABLE version
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
execute_process(
COMMAND git describe --always --tags
OUTPUT_VARIABLE git_tag
OUTPUT_STRIP_TRAILING_WHITESPACE
WORKING_DIRECTORY ${PX4_SOURCE_DIR}
)
px4_add_git_submodule(TARGET git_cmake_hexagon PATH "cmake/cmake_hexagon")
px4_add_git_submodule(TARGET git_uavcan_board_ident PATH "cmake/configs/uavcan_board_ident")
px4_add_git_submodule(TARGET git_ecl PATH "src/lib/ecl")
px4_add_git_submodule(TARGET git_matrix PATH "src/lib/matrix")
#=============================================================================
message(STATUS "PX4 VERSION: ${git_tag}")
......
#!/usr/bin/env python
import subprocess
import os
import argparse
p = argparse.ArgumentParser('finds major minor patch version from git tag')
p.add_argument('--root', help="root of git repo", default=".")
args = p.parse_args()
os.chdir(args.root)
p= subprocess.Popen(
'git describe --always --tags'.split(),
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
# Python3 needs this decode step.
stdout = stdout.decode('ascii')
res = stdout.split('-')[0].split('.')
major = res[0].replace('v','')
minor = res[1]
patch = res[2]
print("{:s}.{:s}.{:s}".format(major, minor, patch))
......@@ -31,6 +31,8 @@
#
############################################################################
px4_add_git_submodule(TARGET git_uavcan PATH "../uavcan/libuavcan")
set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03")
set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform")
......
......@@ -31,6 +31,8 @@
#
############################################################################
px4_add_git_submodule(TARGET git_uavcan PATH "../uavcan/libuavcan")
set(UAVCAN_USE_CPP03 ON CACHE BOOL "uavcan cpp03")
set(UAVCAN_PLATFORM stm32 CACHE STRING "uavcan platform")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment