-
Notifications
You must be signed in to change notification settings - Fork 66
Add BUILD files for printf and bsw libraries #494
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Accenture | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@bazel_skylib//rules:expand_template.bzl", "expand_template") | ||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| expand_template( | ||
| name = "printf_config_h", | ||
| out = "include/printf_config.h", | ||
| substitutions = { | ||
| "@PRINTF_SUPPORT_DECIMAL_SPECIFIERS@": "0", | ||
| "@PRINTF_SUPPORT_EXPONENTIAL_SPECIFIERS@": "0", | ||
| "@PRINTF_SUPPORT_WRITEBACK_SPECIFIER@": "1", | ||
| "@PRINTF_SUPPORT_LONG_LONG@": "1", | ||
| "@PRINTF_ALIAS_STANDARD_FUNCTION_NAMES@": "0", | ||
| "@PRINTF_INTEGER_BUFFER_SIZE@": "32", | ||
| "@PRINTF_DECIMAL_BUFFER_SIZE@": "32", | ||
| "@DEFAULT_FLOAT_PRECISION@": "6", | ||
| "@MAX_INTEGRAL_DIGITS_FOR_DECIMAL@": "9", | ||
| }, | ||
| template = "printf_config.h.in", | ||
| ) | ||
|
|
||
| cc_library( | ||
| name = "printf", | ||
| srcs = [ | ||
| "src/printf/printf.c", | ||
| ":printf_config_h", | ||
| ], | ||
| hdrs = [ | ||
| "src/printf/printf.h", | ||
| ], | ||
| copts = [ | ||
| "-std=c99", | ||
| "-pedantic", | ||
| "-Wall", | ||
| "-Wextra", | ||
| "-I$(GENDIR)/libs/3rdparty/printf/include", | ||
| ], | ||
| local_defines = ["PRINTF_INCLUDE_CONFIG_H"], | ||
| strip_include_prefix = "src", | ||
| visibility = ["//visibility:public"], | ||
| ) | ||
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Accenture | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "async_console", | ||
| srcs = [ | ||
| "src/console/AsyncCommandWrapper.cpp", | ||
| "src/console/AsyncConsole.cpp", | ||
| "src/console/SyncCommandWrapper.cpp", | ||
| "src/logger/ConsoleLogger.cpp", | ||
| ], | ||
| hdrs = [ | ||
| "include/console/AsyncCommandWrapper.h", | ||
| "include/console/AsyncConsole.h", | ||
| "include/console/SyncCommandWrapper.h", | ||
| "include/logger/ConsoleLogger.h", | ||
| ], | ||
| strip_include_prefix = "include", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//libs/bsw/async", | ||
| "//libs/bsw/util", | ||
| ], | ||
| ) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Accenture | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "cpp2can", | ||
| srcs = [ | ||
| "src/can/CanLogger.cpp", | ||
| "src/can/canframes/CANFrame.cpp", | ||
| "src/can/filter/AbstractStaticBitFieldFilter.cpp", | ||
| "src/can/filter/BitFieldFilter.cpp", | ||
| "src/can/filter/IntervalFilter.cpp", | ||
| "src/can/transceiver/AbstractCANTransceiver.cpp", | ||
| ], | ||
| hdrs = glob(["include/**/*.h"]), | ||
| implementation_deps = [ | ||
| "//libs/bsp/bspInterrupts:bsp_interrupts", | ||
| "//libs/bsw/bsp", | ||
| ], | ||
| strip_include_prefix = "include", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//libs/3rdparty/etl", | ||
| "//libs/bsw/common", | ||
| "//libs/bsw/util", | ||
| ], | ||
| ) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Accenture | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "cpp2ethernet", | ||
| srcs = glob(["src/**/*.cpp"]), | ||
| hdrs = glob(["include/**/*.h"]), | ||
| strip_include_prefix = "include", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//libs/3rdparty/etl", | ||
| "//libs/bsw/async", | ||
| "//libs/bsw/bsp", | ||
| "//libs/bsw/common", | ||
| "//libs/bsw/util", | ||
| ], | ||
| ) |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| # ******************************************************************************* | ||
| # Copyright (c) 2026 Accenture | ||
| # | ||
| # This program and the accompanying materials are made available under the | ||
| # terms of the Apache License Version 2.0 which is available at | ||
| # https://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("@rules_cc//cc:cc_library.bzl", "cc_library") | ||
|
|
||
| cc_library( | ||
| name = "lifecycle", | ||
| srcs = [ | ||
| "src/lifecycle/AsyncLifecycleComponent.cpp", | ||
| "src/lifecycle/LifecycleComponent.cpp", | ||
| "src/lifecycle/LifecycleLogger.cpp", | ||
| "src/lifecycle/LifecycleManager.cpp", | ||
| "src/lifecycle/LifecycleManagerForwarder.cpp", | ||
| "src/lifecycle/SimpleLifecycleComponent.cpp", | ||
| "src/lifecycle/SingleContextLifecycleComponent.cpp", | ||
| ], | ||
| hdrs = glob(["include/**/*.h"]), | ||
| strip_include_prefix = "include", | ||
| visibility = ["//visibility:public"], | ||
| deps = [ | ||
| "//libs/3rdparty/etl", | ||
| "//libs/bsw/async", | ||
| "//libs/bsw/util", | ||
| ], | ||
| ) |
Oops, something went wrong.
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.
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.
How does the
coptsinteract with the options of depending libraries? Let's say we have acc_libraryprintf_user and it uses adeps = ["//libs/3rdparty/printf"], then all files within printf_user will be compiled with these additional flags, right? What in case we compile globally with a different-stc? Or with differend error flags?Is there at all a reason that we need to put these extra warning flags and the
stdin the first place?The
-Iis just there to allow theprintf_config.hgenerated by theexpand_templateabove to be in the include path, right? Thestrip_include_prefixdoes not help for it andincludeswould lead to system includes, right? Or do we even want this to be a system include?Uh oh!
There was an error while loading. Please reload this page.
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.
The copts flags are not propagated to consumers t all and should only affect printf itself.
These flags are applied like this also on the Cmake side:
Correct:
strip_include_prefixdoesn't cover generated files.includeswould cause-iSystem, which might be fine but currently would be a deviation from the Cmake sideThere 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.
okay, then let's leave it like this, but still something like
-stdmight also affect the header files which we include somewhere. Since it is like this im CMake as well we can take it over and later adapt it on both sides.