Я нашел решение для части. setup.py
from Cython.Build import cythonize
import os
ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) + '/'
test = Extension('test',
sources=[ROOT_DIR + 'test/my_test.pyx'],
extra_compile_args=["-std=c++11", "-O3"],
extra_link_args=["-std=c++11", "-O3"],
include_dirs=[ROOT_DIR, '.'],
language='c++')
volume = Extension('volume',
sources=[ROOT_DIR + 'test/my_volume.pyx'],
extra_compile_args=["-std=c++11", "-O3"],
extra_link_args=["-std=c++11", "-O3"],
include_dirs=[ROOT_DIR, '.'],
language='c++')
setup(
ext_modules=cythonize([test, volume])
)
Это решение дает контроль над компиляцией:
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/user/projects/python/service_core/c_optimized/ -I. -I/usr/include/python3.5m -c /home/user/projects/python/service_core/c_optimized/test/my_test.cpp -o build/temp.linux-x86_64-3.5/home/user/projects/python/service_core/c_optimized/test/my_test.o -std=c++11 -O3
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/home/user/projects/python/service_core/c_optimized/test/my_test.o -o /home/user/projects/python/service_core/test.cpython-35m-x86_64-linux-gnu.so -std=c++11 -O3
building 'volume' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/home/user/projects/python/service_core/c_optimized/ -I. -I/usr/include/python3.5m -c /home/user/projects/python/service_core/c_optimized/test/my_volume.cpp -o build/temp.linux-x86_64-3.5/home/user/projects/python/service_core/c_optimized/test/my_volume.o -std=c++11 -O3
cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid for C/ObjC but not for C++
x86_64-linux-gnu-g++ -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-Bsymbolic-functions -Wl,-z,relro -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-x86_64-3.5/home/user/projects/python/service_core/c_optimized/test/my_volume.o -o /home/user/projects/python/service_core/volume.cpython-35m-x86_64-linux-gnu.so -std=c++11 -O3