-
Notifications
You must be signed in to change notification settings - Fork 66
/
Copy pathsetup.py
39 lines (31 loc) · 1.14 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from setuptools import setup, Extension
from setuptools.command.build_ext import build_ext
import os
import subprocess
import sys
class CMakeBuild(build_ext):
def run(self):
# make sure cmake is run first
if not os.path.exists(self.build_temp):
os.makedirs(self.build_temp)
source_dir = os.path.abspath(os.path.dirname(__file__))
cmake_args = [
'-DCMAKE_BUILD_TYPE=Release',
'-DPYTHON_EXECUTABLE=' + sys.executable,
'-DMKVG_DO_PYTHON_BINDINGS=ON',
]
build_args = ['--config', 'Release', '--', '-j8']
subprocess.check_call(['cmake', source_dir] + cmake_args,
cwd=self.build_temp)
subprocess.check_call(['cmake', '--build', '.'] + build_args,
cwd=self.build_temp)
setup(
name='monkvg_py',
version='0.0.1',
author='Micah Pearlman',
author_email='[email protected]',
description='Python bindings for monkvg',
ext_modules=[Extension('monkvg_py', ['bindings/python/monkvg_py.cpp'])],
cmdclass=dict(build_ext=CMakeBuild),
zip_safe=False,
)