forked from bigd4/PyNEP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
58 lines (50 loc) · 1.81 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
import os, sys
from setuptools import setup, find_packages
from setuptools.command.build_ext import build_ext
from pynep import __version__
DIR = os.path.abspath(os.path.dirname(__file__))
sys.path.append(os.path.join(DIR, "pybind11"))
from pybind11.setup_helpers import Pybind11Extension
del sys.path[-1]
# Avoid a gcc warning below:
# cc1plus: warning: command line option ‘-Wstrict-prototypes’ is valid
# for C/ObjC but not for C++
class BuildExt(build_ext):
def build_extensions(self):
# Check if the compiler is a GCC variant
if self.compiler.compiler_type == "unix":
if "-Wstrict-prototypes" in self.compiler.compiler_so:
self.compiler.compiler_so.remove("-Wstrict-prototypes")
if "-Wsign-compare" in self.compiler.compiler_so:
self.compiler.compiler_so.remove("-Wsign-compare")
self.compiler.compiler_so.append("-Wno-sign-compare")
# Add conditions for other compiler types if necessary
super().build_extensions()
# generatenew
module_Nep = Pybind11Extension(
"pynep.nep",
sources=["nep_cpu/src/pynep.cpp", "nep_cpu/src/nep.cpp"],
extra_compile_args=["-std=c++11"],
)
with open("README.md") as f:
long_description = f.read()
setup(
name="pynep",
version=__version__,
author="Fan ZheYong, Wang Junjie",
author_email="[email protected]",
url="https://git.nju.edu.cn/gaaooh/magus",
packages=find_packages(),
python_requires=">=3.8",
install_requires=[
"numpy>=2.0",
"ase>=3.18",
],
license="MIT",
description="PyNEP: Python tools for NEP",
long_description=long_description,
long_description_content_type="text/markdown",
ext_modules=[module_Nep],
cmdclass={"build_ext": BuildExt},
# entry_points={"console_scripts": [""]},
)