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
ce182257
Commit
ce182257
authored
6 years ago
by
Daniel Agar
Committed by
Lorenz Meier
6 years ago
Browse files
Options
Downloads
Patches
Plain Diff
cmake px4_add_module add unity build support
- a unity build is a single compilation unit per module
parent
84f121ce
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
cmake/common/px4_base.cmake
+28
-4
28 additions, 4 deletions
cmake/common/px4_base.cmake
src/modules/mavlink/CMakeLists.txt
+1
-0
1 addition, 0 deletions
src/modules/mavlink/CMakeLists.txt
src/modules/mavlink/mavlink_tests/CMakeLists.txt
+0
-3
0 additions, 3 deletions
src/modules/mavlink/mavlink_tests/CMakeLists.txt
with
29 additions
and
7 deletions
cmake/common/px4_base.cmake
+
28
−
4
View file @
ce182257
...
...
@@ -175,6 +175,7 @@ endfunction()
# INCLUDES : include directories
# DEPENDS : targets which this module depends on
# EXTERNAL : flag to indicate that this module is out-of-tree
# UNITY_BUILD : merge all source files and build this module as a single compilation unit
#
# Output:
# Static library with name matching MODULE.
...
...
@@ -194,11 +195,34 @@ 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
OPTIONS EXTERNAL
UNITY_BUILD
REQUIRED MODULE MAIN
ARGN
${
ARGN
}
)
add_library
(
${
MODULE
}
STATIC EXCLUDE_FROM_ALL
${
SRCS
}
)
if
(
UNITY_BUILD
AND
(
${
OS
}
STREQUAL
"nuttx"
))
# build standalone test library to catch compilation errors and provide sane output
add_library
(
${
MODULE
}
_original STATIC EXCLUDE_FROM_ALL
${
SRCS
}
)
if
(
DEPENDS
)
add_dependencies
(
${
MODULE
}
_original
${
DEPENDS
}
)
endif
()
if
(
INCLUDES
)
target_include_directories
(
${
MODULE
}
_original PRIVATE
${
INCLUDES
}
)
endif
()
add_custom_command
(
OUTPUT
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
MODULE
}
_unity.cpp
COMMAND cat
${
SRCS
}
>
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
MODULE
}
_unity.cpp
DEPENDS
${
MODULE
}
_original
${
DEPENDS
}
${
SRCS
}
COMMENT
"
${
MODULE
}
merging source"
WORKING_DIRECTORY
${
CMAKE_CURRENT_SOURCE_DIR
}
)
set_source_files_properties
(
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
MODULE
}
_unity.cpp PROPERTIES GENERATED true
)
add_library
(
${
MODULE
}
STATIC EXCLUDE_FROM_ALL
${
CMAKE_CURRENT_BINARY_DIR
}
/
${
MODULE
}
_unity.cpp
)
target_include_directories
(
${
MODULE
}
PRIVATE
${
CMAKE_CURRENT_SOURCE_DIR
}
)
else
()
add_library
(
${
MODULE
}
STATIC EXCLUDE_FROM_ALL
${
SRCS
}
)
endif
()
# all modules can potentially use parameters and uORB
add_dependencies
(
${
MODULE
}
uorb_headers
)
...
...
@@ -230,9 +254,9 @@ function(px4_add_module)
endif
()
set_target_properties
(
${
MODULE
}
PROPERTIES STACK_MAX
${
STACK_MAX
}
)
if
(
${
OS
}
STREQUAL
"qurt"
)
if
(
${
OS
}
STREQUAL
"qurt"
)
set_property
(
TARGET
${
MODULE
}
PROPERTY POSITION_INDEPENDENT_CODE TRUE
)
elseif
(
${
OS
}
STREQUAL
"nuttx"
)
elseif
(
${
OS
}
STREQUAL
"nuttx"
)
target_compile_options
(
${
MODULE
}
PRIVATE -Wframe-larger-than=
${
STACK_MAX
}
)
endif
()
...
...
This diff is collapsed.
Click to expand it.
src/modules/mavlink/CMakeLists.txt
+
1
−
0
View file @
ce182257
...
...
@@ -66,4 +66,5 @@ px4_add_module(
git_ecl
ecl_geo
version
UNITY_BUILD
)
This diff is collapsed.
Click to expand it.
src/modules/mavlink/mavlink_tests/CMakeLists.txt
+
0
−
3
View file @
ce182257
...
...
@@ -47,7 +47,4 @@ px4_add_module(
mavlink_ftp_test.cpp
../mavlink_stream.cpp
../mavlink_ftp.cpp
../mavlink.c
DEPENDS
)
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