-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathsetup.py
59 lines (44 loc) · 1.49 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
from setuptools.command.build_ext import build_ext
from distutils.core import setup, Extension
import platform
import sys
from sysconfig import get_config_var, get_paths
import logging
__version__ = '0.0.5'
def get_include(): # TODO
info = get_paths()
Eigen_path = '/'.join(info['include'].split('/')[:-1])
Eigen_path += '/eigen3'
return Eigen_path
def __extra_compile_args():
extra_compile_args = []
if platform.system() == 'Darwin':
extra_compile_args = ["-std=c++11"]
else:
extra_compile_args = ["-fopenmp", "-std=c++11"]
return extra_compile_args
def __extra_link_args():
extra_link_args = []
if platform.system() != 'Darwin':
extra_link_args = ["-lgomp", "-lm", "-lrt"]
return extra_link_args
sources_list = ['src/krbalancing.cpp']
kr_module = Extension('krbalancing',
sources=sources_list,
include_dirs=[
# Path to eigen3 headers
get_include()
],
extra_link_args=__extra_link_args(),
extra_compile_args=__extra_compile_args()
)
setup(
name='krbalancing',
version=__version__,
author='Leily Rabbani',
author_email='[email protected]',
description='A c++ extension for python to balance a matrix using KR method',
ext_modules=[kr_module],
install_requires=['pybind11>=2.2'],
# headers = ['src/krbalancing.hpp']
)