-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Bazel build implementation, doesn't provide options for the compilation modes opt and debug #2395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Bazel build implementation, doesn't provide options for the compilation modes opt and debug #2395
Conversation
ping @armandomontanez for his thoughts / review |
bazel/config/BUILD.bazel
Outdated
@@ -294,3 +294,13 @@ label_flag( | |||
name = "PICO_FREERTOS_LIB", | |||
build_setting_default = "//bazel:empty_cc_lib", | |||
) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add docstrings above these and add them to the exclusion list in BAZEL_ONLY_ALLOWLIST
here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Thanks. These have been added.
bazel/toolchain/BUILD.bazel
Outdated
@@ -134,16 +152,27 @@ configurable_toolchain_feature( | |||
|
|||
# TODO: Make this shim unnecessary. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These shims aren't necessary anymore, you can just directly list opt_args
and debug_args
in the cc_feature
rules.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, Thanks. You are right, they weren't needed. Removed
…didnt make much sense, nor work. Leaving these for completness and future addition
I have also added for completeness the same implementations for the fastbuild compilation mode, which is the default. Thanks |
…COMPILATION_NO_XXX_ARGS for OPT, FASTBUILD & DEBUG variants
Fixes #2394
The Bazel toolchain implementation does not have default args for the compilation modes opt and debug
i,e --compilation_mode=dbg and --compilation_mode=opt
Also the rule "@pico-sdk//bazel/toolchain:override_debug" provides defaults of -Og and -g3, but these are enabled by default in the toolchains, and are not changed with the above bazel cmd line --compilation_mode
From the bazel docs the defaults for opt should be -O2 and -DNDEBUG
https://bazel.build/docs/user-manual#compilation-mode
I have added 2 boolean flags
//bazel/config:PICO_COMPILATION_DEBUG_OVERRIDE
//bazel/config:PICO_COMPILATION_OPT_OVERRIDE
These can be set to true ( default is False) which will then remove the defaults from the toolchain. the user can then provide their own args with the cmd line --copts="...."