astropy / extension-helpers

Helpers to assist with building Python packages with compiled C/Cython extensions
https://extension-helpers.readthedocs.io
BSD 3-Clause "New" or "Revised" License
16 stars 12 forks source link

Request: adding checked arguments with fallbacks #51

Open david-cortes opened 1 year ago

david-cortes commented 1 year ago

Would be nice if this package offered some functionality to pass arbitrary compilation/linkage/include arguments to an extension, but to have those arguments checked beforehand for whether they are valid for the current compiler or not; and to be able to provide fallbacks in case they don't work.

For example, one might want to pass compilation argument -march=native if the compiler supports it, or fall back to -mcpu=native if it doesn't (e.g. GCC in platforms like aarch64 and ppc64), or leave it blank if neither is supported.

Same for example for something like -lmkl_rt, with a fallback to -lblas as another example.