-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
35 lines (30 loc) · 1.12 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
import os
import sys
import subprocess
from setuptools import dist
from distutils.core import setup, Extension
from Cython.Build import cythonize
from Cython.Distutils import build_ext
args = sys.argv[1:]
if "clean" in args:
print("Deleting Cython files")
subprocess.Popen("rm -rf build", shell=True, executable="/bin/bash")
subprocess.Popen("rm -rf __pycache__", shell=True, executable="/bin/bash")
subprocess.Popen("rm -rf *.c", shell=True, executable="/bin/bash")
subprocess.Popen("rm -rf *.so", shell=True, executable="/bin/bash")
elif "build_ext" in args:
dist.Distribution().fetch_build_eggs(['Cython>=0.15.1', 'numpy>=1.10'])
#python3 setup.py build_ext --inplace
os.environ['CFLAGS'] = '-Wall -std=c99 -O3 -march=native -mtune=native -ftree-vectorize'
os.environ['LDFLAGS'] = '-fopenmp -lm'
os.environ['ARCHFLAGS'] = "-arch x86_64"
extensions = [
Extension("npbc_cy",["npbc_cy.pyx"],
#include_dirs=[...],
#libraries=[...],
#library_dirs=[...],
)
]
setup(
ext_modules=cythonize(extensions),
)