-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.py
More file actions
40 lines (33 loc) · 1.03 KB
/
setup.py
File metadata and controls
40 lines (33 loc) · 1.03 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
import os
import platform
import pybind11
from setuptools import Extension, setup
def get_openmp_flags():
if platform.system() == "Darwin":
# Apple clang does not support -fopenmp directly.
conda_prefix = os.environ.get("CONDA_PREFIX", "")
if not conda_prefix:
raise RuntimeError(
"CONDA_PREFIX is not set. Activate your conda environment first."
)
compile_args = ["-Xpreprocessor", "-fopenmp", f"-I{conda_prefix}/include"]
link_args = [f"-L{conda_prefix}/lib", "-lomp"]
else:
compile_args = ["-fopenmp"]
link_args = ["-fopenmp"]
return compile_args, link_args
_omp_compile, _omp_link = get_openmp_flags()
ext_modules = [
Extension(
"pyxdm.core.exchange_hole_cpp",
["pyxdm/cpp/exchange_hole.cpp"],
include_dirs=[pybind11.get_include()],
extra_compile_args=["-O3"] + _omp_compile,
extra_link_args=_omp_link,
language="c++",
)
]
setup(
name="pyxdm",
ext_modules=ext_modules,
)