from setuptools import setup, Extension from setuptools.command.build_ext import build_ext import sys ext_modules = [ Extension( 'pbtest', ['py/main.cpp'], include_dirs=['include'], language='c++', ), ] class BuildExt(build_ext): """A custom build extension for adding compiler-specific options.""" c_opts = { 'msvc': ['/EHsc'], 'unix': ['-std=c++11'], } if sys.platform == 'darwin': c_opts['unix'] += ['-stdlib=libc++', '-mmacosx-version-min=10.7'] def build_extensions(self): ct = self.compiler.compiler_type opts = self.c_opts.get(ct, []) for ext in self.extensions: ext.extra_compile_args = opts build_ext.build_extensions(self) setup( name='pbtest', version='0.0.1', author='Sylvain Corlay', author_email='sylvain.corlay@gmail.com', url='https://github.com/pybind/pbtest', description='A test project using pybind11', long_description='', ext_modules=ext_modules, install_requires=['pybind11'], cmdclass={'build_ext': BuildExt}, zip_safe=False, )