-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Feature: build_target for objects build_target(target_type:'objects')
#9587
Comments
One thing that I think we likely want to do is provide an objs = compiled_objects(...)
library(
...,
objects : objs, # no need for extract_all_objects(), as this is already the type returned by library.extract_all_objects()
) Also, we generally have a free form name for targets, so you don't have to use |
Sure, Had similar feelings it should be possible to pass it to objects directly. Thanks for feedback! |
For starters #9600 |
I was thinking (but never finished implementing it) that we could simply make |
@bonzini Also it wouldn't solve one (though pretty niche) use-case of installing objects to I find the idea of such optimization for |
Maybe not, but it might be easier to first do all backend changes, and then introduce compiled_objects just for the install usecase. |
We tried to add thin archives, but ran into some issues with them. I still think it's possible to make them work, and that would basically be what you're suggesting. I still think that the object only option is still worth while, even if just for libc. |
@bonzini I think you might be right, that it would be best attack plan. What I am trying to achieve now is to add better support for getting list of objects Did not look at link_whole logic yet, at all. @dcbaker Do you have any pointers to disscussions/PRs that could shed some light on what were those issues? |
"I have a custom_target that tries to use a .a file but doesn't use the system linker and doesn't understand what a thin archive is". |
Thin archives are a hack that Meson doesn't need. link_whole also is hackish; static libraries force Meson to add --start-group/--end-group arguments and who knows which arguments end up in the group. Instead, all .o files are implicitly "grouped" ahead of static libraries. |
At this moment there is no straightforward way to create library/executable with
<lang>_args
defined per compilation unit.The idea to do that is to provide functionality that is close to cmake per source properties, but bit more powerful and convenient.
Example usage could be:
I am aware that can be achieved by using
build_target(target_type:'static_library')
but considering it simply might be single object creating ar archive to achieve that is bit suboptimal.That also could be helpful to improve/fix cmake.subproject() support which currently gets it wrong.
During compilation of OpenCV for entry from
cmake_trace.txt
:{"args":["SOURCE","/home/prak/DALI_deps/builddir/third_party/opencv/__CMake_build/modules/imgproc/sumpixels.avx2.cpp","PROPERTY","COMPILE_DEFINITIONS","CV_CPU_DISPATCH_MODE=AVX2"],"cmd":"set_property","file":"/home/prak/DALI_deps/builddir/meson-private/data/preload.cmake","frame":6,"line":69,"time":1637193286.2726841}
Library with union of all source files
COMPILE_DEFINITIONS
/ flags is created inmeson.build
This results in:
Which is not cool.
vs correct in case of cmake -GNinja
Wanted to ask first if such functionality is welcome/good idea, before I give a shot
build_target(target_type:'static_library')
workaround.Please note that I might not be not best person to implement it, but can try if no one else is willing to.
The text was updated successfully, but these errors were encountered: