-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathsetup.py
More file actions
44 lines (38 loc) · 1.22 KB
/
setup.py
File metadata and controls
44 lines (38 loc) · 1.22 KB
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
import glob
import platform
import sys
import eigency
import numpy as np
from Cython.Build import cythonize
from setuptools import setup
from setuptools.extension import Extension
extra_compile_args = []
extra_link_args = []
if sys.platform == "linux":
extra_compile_args.extend(["-std=c++17", "-fopenmp"])
if platform.machine() in ("x86_64", "AMD64", "i686", "i386"):
extra_compile_args.append("-msse3")
extra_link_args.extend(["-lgomp", "-fopenmp"])
elif sys.platform == "darwin":
extra_compile_args.append("-std=c++17")
elif sys.platform == "win32":
extra_compile_args.extend(["/std:c++17", "/openmp"])
sources = ["NonlinearTMM/src/SecondOrderNLTMM.pyx"] + glob.glob("NonlinearTMM/src/cpp/*.cpp")
extensions = cythonize(
[
Extension(
"NonlinearTMM._SecondOrderNLTMMCython",
sources=sources,
include_dirs=[
np.get_include(),
"NonlinearTMM/src/cpp",
"third_party/eigen",
]
+ eigency.get_includes(include_eigen=False),
language="c++",
extra_compile_args=extra_compile_args,
extra_link_args=extra_link_args,
),
],
)
setup(ext_modules=extensions)