Currently parse only returns a limited numbers of flags. We need to provide extra flags.
Currently the parse deals with the following
- Macros (starting with
-D) - include directories (starting with
-I) - library paths (starting with
-L) - libraries (starting with
-l)
And any other flags is ignored by parse and the only way to get them is to parse more generic output of either pkgconfig.libs or pkgconfig.cflags. But those flags, which can include -fopenmp or -pthread, would be useful to populate extra_link_args (and/or possibly extra_compile_args as well).
Could we have parse output these as well?
Could we have parse output these as well?
Sure. But it might take a few days unless you want to open a pull request.
I don't have anything ready myself. Just thinking about it and I am not expecting instant delivery of the feature either.
It was motivated by https://trac.sagemath.org/ticket/27205
While the feature is definitely something that should be provided, I think they shoot themselves in the foot some other way in the first place.
The parse function was not introduced by me and I somewhat detest it because it mixes both compile and lib flags. Do you mind if I come up with a way that returns the regular cflags as well as extra ones without going the parse route?
I don't mind.
I just had a look at Extension building in setup.py and pkgconfig.parse: the latter seems to return exactly what's needed for building, in the right format to be used as kwargs.
For Extension building, perhaps it would be simpler to simply dump everything returned by pkgconfig.cflags into extra_compile_args and everything returned by pkg_config.libs into extra_link_args? Sure, you lose a bit of semantic information about what flag does what, but for the purpose of actually building the Extension, that seems good enough...