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

Additional SOURCE_FILENAME variable in CppCompileVariables #15924

Open
nikhilkalige opened this issue Jul 19, 2022 · 2 comments
Open

Additional SOURCE_FILENAME variable in CppCompileVariables #15924

nikhilkalige opened this issue Jul 19, 2022 · 2 comments
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request

Comments

@nikhilkalige
Copy link
Contributor

nikhilkalige commented Jul 19, 2022

Description of the feature request:

We currently define __SHORT_FILENAME__=basename of source_file in cmake using COMPILE_DEFINITIONS feature. Currently, I don't see any way to define that flag inside of bazel. I tried

# pseudo code
flag_group('-D__SHORT_FILENAME__=$(basename %{source_file})')

but that fails to work because it gets escaped during the shell expansion with single quotes to '-D__SHORT_FILENAME=$(basename path_to_file/file.cpp)'.

So, would it be okay for me to make a change to the CompileBuildVariables.java and add a enum SOURCE_FILENAME that just stores the name of the file.

@oquenchil oquenchil added P3 We're not considering working on this, but happy to review a PR. (No assignee) and removed untriaged labels Oct 26, 2022
@oquenchil oquenchil added P1 I'll work on this now. (Assignee required) and removed P3 We're not considering working on this, but happy to review a PR. (No assignee) labels Nov 16, 2022
@oquenchil oquenchil added P2 We'll consider working on this in future. (Assignee optional) and removed P1 I'll work on this now. (Assignee required) labels Jan 18, 2023
@oquenchil
Copy link
Contributor

I think this came up when we had the conversation in person but I can't recall in detail. Did you try with a wrapper around clang/gcc to do this?

@nikhilkalige
Copy link
Contributor Author

I did not find a easy solution for this so just went with full path for now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 We'll consider working on this in future. (Assignee optional) team-Rules-CPP Issues for C++ rules type: feature request
Projects
None yet
Development

No branches or pull requests

3 participants