Skip to content
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

RFC: Add support for CPPFLAGS and clean up CxxFlagsInfo #1231

Open
allsey87 opened this issue Jul 18, 2024 · 0 comments
Open

RFC: Add support for CPPFLAGS and clean up CxxFlagsInfo #1231

allsey87 opened this issue Jul 18, 2024 · 0 comments

Comments

@allsey87
Copy link
Contributor

allsey87 commented Jul 18, 2024

While working on #1230, it came to my attention that if CPPFLAGS is included in the env of a configure_make rule, they are also ignored. I think this should be supported like the other xxxFLAGS variables and would like to get feedback on a PR that touches the code as follows:

  1. Add CPPFLAGS to _MAKE_FLAGS:
    https://github.com/bazelbuild/rules_foreign_cc/blob/9d5727d5e51bf1be8423dff7996bdb4d847b47e6/foreign_cc/private/make_env_vars.bzl#L79-L88

  2. Add cpp to CxxFlagsInfo provider struct:
    https://github.com/bazelbuild/rules_foreign_cc/blob/9d5727d5e51bf1be8423dff7996bdb4d847b47e6/foreign_cc/private/cc_toolchain_util.bzl#L28-L38

I would also like to clean up the names of the variables inside CxxFlagsInfo since they are quite misleading and inconsistent. Linked flags are language in dependent. Would the following be acceptable? I think this provider is just used internally so it would not be a breaking change, right?

CFlagsInfo = provider( 
     doc = "Flags for the C/C++ tools, taken from the toolchain", 
     fields = dict( 
         c = "C compiler flags", 
         cxx = "C++ compiler flags",
         cpp = "C/C++ preprocessor flags",
         linker_shared = "Linker flags when linking shared library", 
         linker_static = "Linker flags when linking static library", 
         linker_executable = "Linker flags when linking executable", 
         asm = "Assembler flags", 
     ), 
 ) 
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant