I currently use 'setuptools' to automatically cythonize and compile my Cython modules on Linux using gcc. From now on, I need more control over the build flags supplied to gcc. If I use the following in my setup.py
:
cythonize(
[Extension("*", ["project/*.pyx"])
nthreads=4
)
I get build flags, that look like:
gcc -pthread -Wno-unused-result -Wsign-compare -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt -fPIC -I./fastmat/core -I/home/seb/.local/lib/python3.6/site-packages/numpy/core/include -Iproject/core -Ifastmat/inspect -Iutil -I/usr/include/python3.6m -c project/BlockDiag.c -o build/temp.linux-x86_64-3.6/project/BlockDiag.o
Here I am totally flabbergasted by the fact that several build flags occur multiple times and without issuing this in any (to me obvious) way.
How can I clean up these build flags, such that they look like the ones suggested here? I hope to learn something about setuptools along the way to ultimately get full control over the build process without having to use a self-maintained makefile.