Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
Firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alberto Ruiz Garcia
Firmware
Commits
670c93e7
Commit
670c93e7
authored
8 years ago
by
Beat Küng
Committed by
Lorenz Meier
8 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cmake: add support for out-of-tree modules via EXTERNAL_MODULES_LOCATION variable
parent
65e3ae70
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
CMakeLists.txt
+19
-0
19 additions, 0 deletions
CMakeLists.txt
Makefile
+7
-1
7 additions, 1 deletion
Makefile
cmake/common/px4_base.cmake
+7
-0
7 additions, 0 deletions
cmake/common/px4_base.cmake
with
33 additions
and
1 deletion
CMakeLists.txt
+
19
−
0
View file @
670c93e7
...
...
@@ -146,6 +146,7 @@ set_property(CACHE CONFIG PROPERTY STRINGS ${configs})
set
(
THREADS
"4"
CACHE STRING
"number of threads to use for external build processes"
)
set
(
DEBUG_PORT
"/dev/ttyACM0"
CACHE STRING
"debugging port"
)
set
(
EXTERNAL_MODULES_LOCATION
""
CACHE STRING
"External modules source location"
)
#=============================================================================
# configuration
...
...
@@ -371,6 +372,24 @@ foreach(driver ${config_df_driver_list})
message
(
"Adding DF driver:
${
driver
}
"
)
endforeach
()
#=============================================================================
# external modules
#
if
(
NOT EXTERNAL_MODULES_LOCATION STREQUAL
""
)
message
(
STATUS
"External modules:
${
EXTERNAL_MODULES_LOCATION
}
"
)
add_subdirectory
(
"
${
EXTERNAL_MODULES_LOCATION
}
/src"
external_modules_src
)
set
(
config_module_list_external_expanded
)
foreach
(
external_module
${
config_module_list_external
}
)
list
(
APPEND config_module_list_external_expanded
${
EXTERNAL_MODULES_LOCATION
}
/src/
${
external_module
}
)
endforeach
()
set
(
config_module_list
${
config_module_list
}
${
config_module_list_external_expanded
}
)
endif
()
#=============================================================================
# subdirectories
#
...
...
This diff is collapsed.
Click to expand it.
Makefile
+
7
−
1
View file @
670c93e7
...
...
@@ -114,6 +114,12 @@ else
BUILD_DIR_SUFFIX
:=
endif
# additional config parameters passed to cmake
CMAKE_ARGS
:=
ifdef
EXTERNAL_MODULES_LOCATION
CMAKE_ARGS
:=
-DEXTERNAL_MODULES_LOCATION
:STRING
=
$(
EXTERNAL_MODULES_LOCATION
)
endif
SRC_DIR
:=
$(
shell
dirname
$(
realpath
$(
lastword
$(
MAKEFILE_LIST
))))
# Functions
...
...
@@ -122,7 +128,7 @@ SRC_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
define
cmake-build
+@
$(
eval
BUILD_DIR
=
$(
SRC_DIR
)
/build_
$@
$(
BUILD_DIR_SUFFIX
))
+@if
[
$(PX4_CMAKE_GENERATOR)
=
"Ninja"
]
&&
[
-e
$(
BUILD_DIR
)
/Makefile
]
;
then
rm
-rf
$(
BUILD_DIR
);
fi
+@if
[
!
-e
$(BUILD_DIR)/CMakeCache.txt
];
then
mkdir
-p
$(BUILD_DIR)
&&
cd
$(BUILD_DIR)
&&
cmake
..
-G$(PX4_CMAKE_GENERATOR)
-DCONFIG
=
$(
1
)
||
(
cd
..
&&
rm
-rf
$(
BUILD_DIR
)
)
;
fi
+@if
[
!
-e
$(BUILD_DIR)/CMakeCache.txt
];
then
mkdir
-p
$(BUILD_DIR)
&&
cd
$(BUILD_DIR)
&&
cmake
..
-G$(PX4_CMAKE_GENERATOR)
-DCONFIG
=
$(
1
)
$(
CMAKE_ARGS
)
||
(
cd
..
&&
rm
-rf
$(
BUILD_DIR
)
)
;
fi
+@echo "PX4 CONFIG
:
$(BUILD_DIR)"
+@$(PX4_MAKE)
-C
"$(BUILD_DIR)"
$(PX4_MAKE_ARGS)
$(ARGS)
endef
...
...
This diff is collapsed.
Click to expand it.
cmake/common/px4_base.cmake
+
7
−
0
View file @
670c93e7
...
...
@@ -231,6 +231,7 @@ endfunction()
# [ COMPILE_FLAGS <list> ]
# [ INCLUDES <list> ]
# [ DEPENDS <string> ]
# [ EXTERNAL ]
# )
#
# Input:
...
...
@@ -244,6 +245,7 @@ endfunction()
# SRCS : source files
# INCLUDES : include directories
# DEPENDS : targets which this module depends on
# EXTERNAL : flag to indicate that this module is out-of-tree
#
# Output:
# Static library with name matching MODULE.
...
...
@@ -263,9 +265,14 @@ function(px4_add_module)
NAME px4_add_module
ONE_VALUE MODULE MAIN STACK STACK_MAIN STACK_MAX PRIORITY
MULTI_VALUE COMPILE_FLAGS LINK_FLAGS SRCS INCLUDES DEPENDS
OPTIONS EXTERNAL
REQUIRED MODULE
ARGN
${
ARGN
}
)
if
(
EXTERNAL
)
px4_mangle_name
(
"
${
EXTERNAL_MODULES_LOCATION
}
/src/
${
MODULE
}
"
MODULE
)
endif
()
px4_add_library
(
${
MODULE
}
STATIC EXCLUDE_FROM_ALL
${
SRCS
}
)
# set defaults if not set
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment