forked from pyatb/pyatb
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
81 lines (69 loc) · 2.22 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
import os
from pathlib import Path
from glob import glob
from setuptools import setup, Extension, find_packages
from setuptools.command.build_ext import build_ext
import pybind11
from pybind11.setup_helpers import Pybind11Extension
compiler = 'icpc'
mkl_include_dir = None
mkl_library_dir = None
eigen_include_dir = None
include_dirs = []
library_dirs = []
libraries = ['mkl_intel_lp64', 'mkl_intel_thread', 'mkl_core', 'iomp5', 'm', 'dl', 'pthread']
runtime_library_dirs = []
temp_path = Path('siteconfig.py').expanduser()
exec(temp_path.read_text())
include_dirs.append(mkl_include_dir)
include_dirs.append(eigen_include_dir)
include_dirs += [
os.path.join("src", "cpp", "core"),
os.path.join("src", "cpp", "interface_python"),
]
library_dirs.append(mkl_library_dir)
runtime_library_dirs.append(mkl_library_dir)
extra_compile_args = []
extra_link_args = []
if compiler == 'g++':
extra_compile_args += ['-fopenmp']
elif compiler == 'icpc':
extra_compile_args += ['-qopenmp']
sources = sorted(glob("src/cpp/core/*.cpp")) + sorted(glob("src/cpp/interface_python/*.cpp"))
define_macros = []
undef_macros = []
os.environ["CXX"] = compiler
os.environ["CC"] = compiler
os.environ['CFLAGS'] = "-O2 -std=c++11 -fPIC -Wall -shared"
ext_modules = [
Pybind11Extension(
name="pyatb.interface_python",
sources=sources,
include_dirs=include_dirs,
define_macros=define_macros,
undef_macros=undef_macros,
library_dirs=library_dirs,
libraries=libraries,
runtime_library_dirs=runtime_library_dirs,
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
language = "c++",
),
]
setup(
name='pyatb',
version="1.0.0",
cmdclass={'build_ext': build_ext},
setup_requires=['numpy', 'pybind11', 'setuptools>=18.0'],
license='GPL v3.0',
description='This is the pyatb module.',
long_description='None',
author='PYATB Developer',
author_email='jingan@mail.ustc.edu.com',
url='https://github.com/pyatb/pyatb',
packages=find_packages('src'),
package_dir={'': 'src'},
install_requires=['numpy', 'scipy', 'matplotlib'],
ext_modules=ext_modules,
entry_points={'console_scripts': ['pyatb = pyatb.main:main']}
)