-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Add subproject.build_root() #10409
base: master
Are you sure you want to change the base?
Add subproject.build_root() #10409
Conversation
b2caaac
to
22c83f2
Compare
Imagine a C project with a subproject that is its Python bindings. The C project makes use of the Python bindings to use a higher level language for writing tests. In order to properly set PYTHONPATH in the tests' environments, you need to know the subprojects build root, so that the generated module is visibile when the test imports it. By exposing the subproject's build root, the parent project can easily set the PYTHONPATH to resolve the import.
22c83f2
to
5e23403
Compare
Assuming this gets accepted, I wouldn't mind also having a source_root() |
Codecov Report
@@ Coverage Diff @@
## master #10409 +/- ##
==========================================
- Coverage 68.73% 68.24% -0.49%
==========================================
Files 406 203 -203
Lines 87650 43831 -43819
Branches 19486 9743 -9743
==========================================
- Hits 60249 29914 -30335
+ Misses 22862 11609 -11253
+ Partials 4539 2308 -2231
Continue to review full report at Codecov.
|
I am going to advocate for this again. In some Go bindings for a C library that I have been working on, I need to set the cgo_env.set('CGO_CFLAGS', '-I@0@ -I@1@'.format(hse_dep.get_variable('includedir'), meson.global_build_root() / 'subprojects/hse/include') Obviously this is not ideal because |
I thought I already commented on this but apparently not... I don't really understand the rationale for this. It can inherently be done with And, in general this involves poking at subproject internals, which we would usually say means the subproject should collaborate with this use case by exporting whatever variables are necessary. As for the specificity of this case exactly, this feels very much a solution to the wrong problem. The actual problem is that you want to get So, hard NACK. If we are going to add API here, I'm strongly of the opinion that subp.get_variable() is wrong and you actually want idk, The backwards-compatible way to do this using existing API would be to have the subproject define
And either retrieve that via |
Relevant: #5468 |
Makes sense. Essentially, I want access to the cflags and libflags for a dependency. I need them for both internal and pkgconfig dependency types. |
Imagine a C project with a subproject that is its Python bindings. The C
project makes use of the Python bindings to use a higher level language
for writing tests. In order to properly set PYTHONPATH in the tests'
environments, you need to know the subprojects build root, so that the
generated module is visibile when the test imports it. By exposing the
subproject's build root, the parent project can easily set the
PYTHONPATH to resolve the import.
Fixes #8302