-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup.py
69 lines (61 loc) · 1.8 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
59
60
61
62
63
64
65
66
67
68
69
#!/usr/bin/env python
import os
import subprocess
from glob import glob
from setuptools import Extension, setup
import versioneer
# define scripts
scripts = ["bin/ginsp", "bin/gconv", "bin/gCache3", "bin/gCatalog3", "bin/gStarform3"]
# find all sub-packages
modules = []
setup_dir = os.path.dirname(os.path.realpath(__file__))
for root, dirs, files in os.walk(setup_dir):
submod = os.path.relpath(root, setup_dir).replace(os.sep, ".")
if not submod.startswith("pygad"):
continue
if "__init__.py" in files:
modules.append(submod)
# clean and make the cpygad.so library
subprocess.run(["make", "clean"], cwd=setup_dir + "/pygad/C", check=True)
gsl_include = ""
gsl_lib = ""
if os.getenv("GSL_HOME") is not None:
gsl_include = os.getenv("GSL_HOME") + "/include"
gsl_lib = os.getenv("GSL_HOME") + "/lib"
ext_module = Extension(
"pygad/C/cpygad",
language="c++",
sources=glob("pygad/C/src/*"),
include_dirs=[
"pygad/C/include",
"/usr/include",
gsl_include,
],
extra_compile_args=[
"-fPIC",
"-std=c++11",
"-O3",
"-fopenmp",
"-pedantic",
"-Wall",
"-Wextra",
],
libraries=["m", "gsl", "gslcblas", "gomp"],
extra_link_args=["-fopenmp"],
library_dirs=[gsl_lib],
)
setup(
name="pygadmpa",
description="analysis module for Gadget",
long_description="A light-weighted analysis module for galaxy \
simulations performed by the SPH code Gadget.",
author="Bernhard Roettgers",
author_email="[email protected]",
url="https://bitbucket.org/broett/pygad",
include_package_data=True,
packages=list(map(str, modules)),
scripts=scripts,
version=versioneer.get_version(),
cmdclass=versioneer.get_cmdclass(),
ext_modules=[ext_module],
)