summaryrefslogtreecommitdiff
path: root/setup.py
diff options
context:
space:
mode:
authorSylvain Corlay <sylvain.corlay@gmail.com>2016-01-28 05:51:30 -0500
committerSylvain Corlay <sylvain.corlay@gmail.com>2016-03-14 22:54:09 -0400
commite04dff53f90fa8e044c0fa6d1c352d7f4d336155 (patch)
tree688724a0c19a632132fec1bf0f833bf741b6a059 /setup.py
Example project built with pybind11
Diffstat (limited to 'setup.py')
-rw-r--r--setup.py43
1 files changed, 43 insertions, 0 deletions
diff --git a/setup.py b/setup.py
new file mode 100644
index 0000000..2b4067a
--- /dev/null
+++ b/setup.py
@@ -0,0 +1,43 @@
+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/SylvainCorlay/pbtest',
+ description='A test project using pybind11',
+ long_description='',
+ ext_modules=ext_modules,
+ install_requires=['pybind11'],
+ cmdclass={'build_ext': BuildExt},
+)