CLI improvements - #224
Merged
Merged
Conversation
This is not really needed as the variable is always set in
build_firmware.sh. It was also implemented incorrectly, as the -z check
does not work for unset variables (the correct way would be to use [ -z
${UROS_VERBOSE_BUILD+x} ]).
Signed-off-by: Robert Wilbrandt <robert@stamm-wilbrandt.de>
This will output a line for the configuration file in every build and also prevent the double-output in case of PLATFORM=host with no transport-specific config. Signed-off-by: Robert Wilbrandt <robert@stamm-wilbrandt.de>
This is a much more robust solution for custom argument parsing and allows for providing a useful help message. Signed-off-by: Robert Wilbrandt <robert@stamm-wilbrandt.de>
There are some use cases where this feature is useful, e.g.: - It is quite common to use -DCMAKE_EXPORT_COMPILE_COMMANDS for better IDE support - In zephyr specifically, you might want to pass -DZEPHYR_EXTRA_MODULES=[...] so you can use e.g. out-of-tree device drivers The syntax used here is consistent with the way west can forward arguments directly to cmake. Signed-off-by: Robert Wilbrandt <robert@stamm-wilbrandt.de>
Signed-off-by: Robert Wilbrandt <robert@stamm-wilbrandt.de>
RobertWilbrandt
requested review from
FranFin,
jamoralp and
pablogs9
as code owners
November 4, 2020 17:01
Member
|
Hello @RobertWilbrandt, this looks amazing. Thank you very much for your contributions! |
pablogs9
approved these changes
Nov 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This contains a set of cli improvements for the build step, mainly centered around the zephyr RTOS:
Add option to pass arbitrary commands to cmake for zephyr builds. This uses the following syntax:
ros2 run micro_ros_setup build_firmware.sh -f -- -DCMAKE_EXPORT_COMPILE_COMMANDS=on. This is consistent with the way west handles these arguments. Use cases are:-DCMAKE_EXPORT_COMPILE_COMMANDS=onis useful to provide better ide integration-DZEPHYR_EXTRA_MODULES=/path/to/modulecan be useful if you rely on e.g. out-of-tree zephyr device drivers.While both these could get implemented as extra flags to
build_firmware.sh, i think this is the more versatile approach (after all,micro_ros_setupshouldn't have to know about every possibly useful west argument). It might make sense to add support for this feature to other RTOSes too, even for make-based build systems passing things like-j 4might be useful.Use getopts to parse cli arguments and provide a useful help message. This is just generally more robust then handmade parsing and allows for the feature above.
Print build information for verbose zephyr builds (=> only done if
-vis used). See example below.Some small cleanups.
Example help message:
Example verbose build output: