forked from mhm-ufz/mHM
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
31 lines (26 loc) · 884 Bytes
/
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
"""Python bindings for mHM."""
import os
from skbuild import setup
# maybe overwrite the default version
mhm_build_type = os.getenv("MHM_BUILD_TYPE", "Release")
forces_path = os.getenv("MHM_BUILD_FORCES_PATH", "")
# init cmake args
cmake_args = [
f"-DCMAKE_BUILD_TYPE={mhm_build_type}",
"-DBUILD_MHM_PYBIND=ON",
]
print(f"## mHM Python setup: build-type '{mhm_build_type}'")
# you can set MHM_BUILD_PARALLEL=0 or MHM_BUILD_PARALLEL=1
if int(os.getenv("MHM_BUILD_PARALLEL", "0")):
cmake_args += ["-DCMAKE_WITH_OpenMP=ON"]
print("## mHM Python setup: OpenMP used by env-var.")
if forces_path:
cmake_args += [f"-DCPM_forces_SOURCE={forces_path}"]
print(f"## mHM Python setup: using forces path '{forces_path}'")
setup(
packages=["mhm"],
package_dir={"": "pybind"},
cmake_install_dir="pybind/mhm",
cmake_args=cmake_args,
zip_safe=False,
)