-
Notifications
You must be signed in to change notification settings - Fork 10
/
setup.in.py
65 lines (51 loc) · 1.69 KB
/
setup.in.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#
# Copyright 2012-2019 CNRS-UM LIRMM, CNRS-AIST JRL
#
from __future__ import print_function
import pkg_resources
requirements_file = "@CMAKE_CURRENT_SOURCE_DIR@/requirements.txt"
with open(requirements_file) as fd:
for pkg in fd:
pkg = pkg.strip()
pkg_resources.require(pkg)
try:
from setuptools import setup
from setuptools import Extension
except ImportError:
from distutils.core import setup
from distutils.extension import Extension
from Cython.Build import cythonize
import numpy
import os
import subprocess
import sys
win32_build = os.name == 'nt'
from utils import generate_eigen_pyx
this_path = os.path.dirname(os.path.realpath(__file__))
src_files = ['eigen/c_eigen.pxd', 'eigen/c_eigen_private.pxd', 'include/eigen_wrapper.hpp']
src_files.extend(['utils/angleaxis.in.pyx', 'utils/generate_eigen_pyx.py', 'utils/quaternion.in.pyx'])
src_files = [ '{}/{}'.format(this_path, f) for f in src_files ]
generate_eigen_pyx(this_path + "/eigen", this_path + "/utils")
def GenExtension(name):
pyx_src = name.replace('.', '/')
cpp_src = pyx_src + '.cpp'
pyx_src = pyx_src + '.pyx'
ext_src = pyx_src
include_dirs = [os.path.join(os.getcwd(), "include"), "@EIGEN3_INCLUDE_DIR@", numpy.get_include()]
compile_args = ['-std=c++11']
if win32_build:
compile_args = ['-DWIN32']
return Extension(name, [ext_src], extra_compile_args = compile_args, include_dirs = include_dirs)
extensions = [
GenExtension('eigen.eigen')
]
packages = ['eigen']
data = ['__init__.py', 'c_eigen.pxd', 'eigen.pxd']
extensions = cythonize(extensions)
setup(
name = 'eigen',
version='@PROJECT_VERSION@',
ext_modules = extensions,
packages = packages,
package_data = { 'eigen': data },
)