forked from wulwife/LOKI
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup.py
141 lines (117 loc) · 5.59 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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
import os
import numpy
from setuptools import setup, find_packages, Extension
with open("README.md", "r") as fh:
long_description = fh.read()
with open("requirements.txt") as f:
required_list = f.read().splitlines()
# =================================== DEFINE COMPILER PATH !!!
# os.environ["CC"] = 'gcc-mp-7'
os.environ["CC"] = "gcc"
# =================================== C - COMPILING
location = Extension('location',
sources=['loki/src_c/location_py3_omp.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
location_t0 = Extension('location_t0',
sources=['loki/src_c/location_t0_py3_omp.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
location_4D = Extension('location_4D',
sources=['loki/src_c/location_t0_py3_omp_4D.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
location_t0_tmax = Extension('location_t0_tmax',
sources=['loki/src_c/location_t0_py3_omp_tmax.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
location_t0_plus = Extension('location_t0_plus',
sources=['loki/src_c/location_t0_py3_omp_plus.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
detection = Extension('detection',
sources=['loki/src_c/detection_py3_omp.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
tt_processing = Extension('tt_processing',
sources=['loki/src_c/tt_processing_py3.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3', '-fopenmp'],
extra_link_args=['-lgomp'])
LOC_STALTA = Extension('LOC_STALTA',
sources=['loki/src_c/stalta_py3.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3'])
DET_STALTA = Extension('DET_STALTA',
sources=['loki/src_c/stalta_det_py3.c'],
include_dirs=[numpy.get_include()],
extra_compile_args=['-O3'])
# =================================== SETUP
setup(
name="loki",
version="1.0.0",
author="Francesco Grigoli",
author_email="[email protected]",
description="Location of seismic events through traveltime staking",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/wulwife/LOKI",
python_requires='>=3.6',
install_requires=required_list,
packages=find_packages(),
package_data={"loki": ['src_c/*.c']},
include_package_data=True,
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
"Operating System :: Unix, MacOS",
"Intended Audience :: Science/Research",
],
ext_modules=[location,
location_t0,
location_4D,
location_t0_tmax,
location_t0_plus,
detection,
tt_processing,
LOC_STALTA,
DET_STALTA]
)
# =================================== HELP
# In this example, setup() is called with additional meta-information,
# which is recommended when distribution packages have to be built.
# For the extension itself, it specifies preprocessor defines,
# include directories, library directories, and libraries.
# Depending on the compiler, distutils passes this information in
# different ways to the compiler.
# For example, on Unix, this may result in the compilation commands
# ```
# gcc -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -fPIC -DMAJOR_VERSION=1 \
# -DMINOR_VERSION=0 -I/usr/local/include \
# -I/usr/local/include/python2.2 -c demo.c \
# -o build/temp.linux-i686-2.2/demo.o
# gcc -shared build/temp.linux-i686-2.2/demo.o -L/usr/local/lib -ltcl83
# -o build/lib.linux-i686-2.2/demo.so
# ```
# These lines are for demonstration purposes only; distutils users
# should trust that distutils gets the invocations right.
# The manifest template has one command per line, where each command specifies a set of files to include or exclude from the source distribution. For an example, again we turn to the Distutils’ own manifest template:
# include *.txt
# recursive-include examples *.txt *.py
# prune examples/sample?/build
# The meanings should be fairly clear: include all files in the
# distribution root matching *.txt, all files anywhere under the examples
# directory matching *.txt or *.py, and exclude all directories matching
# examples/sample?/build. All of this is done after the standard include
# set, so you can exclude files from the standard set with explicit
# instructions in the manifest template. (Or, you can use the --no-defaults
# option to disable the standard set entirely.)
# There are several other commands available in the manifest template
# mini-language; see section Creating a source distribution:
# the sdist command.