You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sometimes there is a need to propagate a flags throughout the build tree and force rebuilding of the whole dependency tree.
These flags are usually very specific - and compiler dependent.
For example: march on gcc: https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/x86-Options.html
We want to build a build that targets a sets of CPUs and using march would allow gcc to build the code with the extensions, unfortunatelly I dont think there is a good way of doing this in conan right now.
I think this could be solved by adding new setting: compiler.compilation_flags
compiler.compilation_flags : Any
compiler.linking_flags : Any
Yes I know that settings dont currently handle 'Any' but options do.. so settings could as well?
Anyway, not having 'Any' but a list of values would be fine like: compiler.compilation_flags : ["-march=x86-64 -xyz", ..]
With this enabled I would imagine the conan would propagate these flags to compilation flags and linking flags.
We could use a workaround and just add an option and somehow before every build recognize whether these settings are set and then export environmental variables, but there is no strict binding that people would remember to build their projects with this flag.
If conan instead was doing that - then that would create a reliable contract.
Use cases known by me where this would be useful:
sanitizers
lto enabling
defining arch.
This proposal could possibly affect these currently open issues: #1346 #847
First you need all your packages get a new packageID, so the build is triggered again (and those binaries are identified). Using a custom setting in the profile (adding it to settings.yml) seem the way to go.
Then you need to pass the proper flags to the compiler and here it is the tricky part. Our helpers cannot know about your custom setting so they won't take into account (does it make sense for Conan to have a compiler.cxx_flags and pass its value to the compiler?) but you can set an environment variable in your profile (CXX_FLAGS) that will be taken into account by your compiler.
Hello @jgsogo
Yes, I am very well aware of that.
I think your 1st point corresponds ot mine:
We could use a workaround and just add an option and somehow ...
I should have worded this differently (used setting word instead of option ) apologies.
But this is very brittle dont you think? And there is no contract at all between user setting setting and exporting variable.
I am using this for sanitizers build - but there are multiple cases and I think this is a common scenario, consider LTO.
If you want LTO to work properly all your projects have to be compiled with lto flag.
I was thinking of conan supported settings cxx_flags and ldd_flags that it would actually force to be environmental variables.
I think depending on the arch setting - it does sets some variables? but I may be wrong there.
Sometimes there is a need to propagate a flags throughout the build tree and force rebuilding of the whole dependency tree.
These flags are usually very specific - and compiler dependent.
For example: march on gcc:
https://gcc.gnu.org/onlinedocs/gcc-9.1.0/gcc/x86-Options.html
We want to build a build that targets a sets of CPUs and using march would allow gcc to build the code with the extensions, unfortunatelly I dont think there is a good way of doing this in conan right now.
I think this could be solved by adding new setting: compiler.compilation_flags
compiler.compilation_flags : Any
compiler.linking_flags : Any
Yes I know that settings dont currently handle 'Any' but options do.. so settings could as well?
Anyway, not having 'Any' but a list of values would be fine like:
compiler.compilation_flags : ["-march=x86-64 -xyz", ..]
With this enabled I would imagine the conan would propagate these flags to compilation flags and linking flags.
We could use a workaround and just add an option and somehow before every build recognize whether these settings are set and then export environmental variables, but there is no strict binding that people would remember to build their projects with this flag.
If conan instead was doing that - then that would create a reliable contract.
Use cases known by me where this would be useful:
This proposal could possibly affect these currently open issues:
#1346
#847
The text was updated successfully, but these errors were encountered: