python-3.xpython-sip

How can I give extra compiler parameters with SIP 5?


Trying to build Python bindings with SIP 5. But I can't figure out how I pass parameters to the compiler.

In SIP 4.x, there could be extra options to the compiler set in configure.py by doing

makefile = sipconfig.SIPModuleMakefile(config, build_file)

makefile.extra_libs = ["foo"]
makefile.extra_cxxflags = ["-std=c++17"]

With SIP 5 I can't figure out how I can do the same, since configure.py no longer is a part of it.

I have looked through, and search the docs, but to no avail.

Now I get warnings like warning: scoped enumerations are a C++11 extension [-Wc++11-extensions]

I wish to pass the right parameters to the compiler.


Solution

  • I believe this is done via the pyproject.toml file under the Bindings section.

    https://www.riverbankcomputing.com/static/Docs/sip/pyproject_toml.html#bindings-sections

    There is parameter extra-compile-args and libraries that may do what you want.