Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
#cython: language_level=3, boundscheck=False
# distutils: language = c++
from setuptools import setup
from setuptools.extension import Extension
from Cython.Distutils import build_ext
import os
import numpy
from Cython.Build import cythonize
extensions = cythonize([
Extension(name="calibmertis", # output py-mportable compiled module name: must match source code file name!!
sources=[ "calibmertis.pyx"],
libraries=["MertisCalibFull"], # refers to "libMertisCalibFull.{so,a}"
library_dirs=[os.getcwd()+'/LibCalibMertis'], # path to .a or .so file(s)
include_dirs=[os.getcwd()+'/LibCalibMertis', numpy.get_include()], # path to .h file(s)
"-install_name @rpath/LibCalibMertis/",
'-Wno-#warnings', # disable warning, Cython uses deprecated Numpy C API
# '-std=c++11',
# '-std=gnu++11',
# '-Wl,-no_compact_unwind', # only using .a on mac
# differences between C and C++ is the name mangling, C++ mangles it.
# make clear to compiler that C++-convention is used by adding language="c++" to the setup
cmdclass = {'build_ext': build_ext},
ext_modules = extensions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment