-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsetup.py
98 lines (85 loc) · 4.19 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
3# Copyright (c) 2012, Bayesian Logic, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of Bayesian Logic, Inc. nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
# Bayesian Logic, Inc. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
from distutils.core import setup, Extension
import numpy as np
import os
nonempty = lambda x: len(x) > 0
if os.getenv("C_INCLUDE_PATH") is not None:
sys_includes = filter(nonempty, os.getenv("C_INCLUDE_PATH").split(':'))
else:
sys_includes = []
if os.getenv("LIBRARY_PATH") is not None:
sys_libraries = filter(nonempty, os.getenv("LIBRARY_PATH").split(':'))
else:
sys_libraries = []
print sys_includes
print sys_libraries
extra_compile_args_cpp = ['-Wall', '-std=c++11', '-g', '-O3']
extra_compile_args_c = ['-Wall', '-std=c99', '-g', '-O3']
#extra_compile_args = ['-std=c99','-O3']
#extra_link_args = ['-Wl,--strip-all']
extra_link_args = ['-lrt', '-lcblas',]
priors_sources = [ 'EventLocationPrior.c',
'EarthModel.c',
'Poisson.c',
'Gaussian.c', 'Gamma.c']
main_sources = ['sigvisa.c',]
sigvisa_module = Extension('sigvisa_c',
sources=([os.path.join("priors", f)
for f in priors_sources]
+ [f for f in main_sources]),
library_dirs = sys_libraries,
runtime_library_dirs = sys_libraries,
extra_compile_args = extra_compile_args_c,
extra_link_args = extra_link_args,
)
ssm_sources = ['statespace.cc', 'python_wrappers.cc', 'transient_combined.cc',
'compact_support.cc',
'autoregression.cc']
from imp import find_module
f, pathname, descr = find_module("pyublas")
ssm_include_dirs = [os.path.join(pathname, "include"),]
#ssm_include_dirs = ["/home/dmoore/python/sigvisa/scratch/boost_1_57_0",] + ssm_include_dirs
ssm_libs = sys_libraries
#ssm_libs = ["/home/dmoore/python/sigvisa/scratch/boost_1_57_0/stage/lib",] + ssm_libs
statespacemodel_module = Extension('ssms_c',
sources=([os.path.join("models", "statespace", "fast_c", f)
for f in ssm_sources]
),
include_dirs=ssm_include_dirs,
library_dirs = ssm_libs,
libraries=['boost_python'],
runtime_library_dirs = ssm_libs,
extra_compile_args = extra_compile_args_cpp,
extra_link_args = extra_link_args,
)
setup(name='sigvisa',
version='1.0',
description='Signal-Based Vertically Integrated Seismological Processing',
include_dirs=[np.get_include()] + sys_includes,
ext_modules=[sigvisa_module, statespacemodel_module])