-
Notifications
You must be signed in to change notification settings - Fork 2
/
sourceme-external-prefix.sh
91 lines (77 loc) · 2.43 KB
/
sourceme-external-prefix.sh
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
#!/bin/bash
# This defines some Bash functions which help simply development of
# WCT on the assumption that externals are installed in a Spack view
# (or equivalent) and that WCT itself is installed in some other
# directory (although the two may be degenerate)
# This file can be sourced with paths to externals and WCT
# installation prefix:
#
# source sourceme-external-prefix.sh /path/to/externals /path/to/prefix
#
# or define WCT_EXTERNALS and WCT_PREFIX to each path, respectively.
export WCT_EXTERNALS=${WCT_EXTERNALS:-$1}
export WCT_PREFIX=${WCT_PREFIX:-$2}
addpath ()
{
local pathvar=${2:-PATH}
local pathval="${!pathvar}"
pathval=${pathval//":$1"/}
pathval=${pathval//"$1:"/}
export $pathvar="$1:$pathval"
}
wct-configure () {
addpath "$WCT_EXTERNALS/lib/pkgconfig" PKG_CONFIG_PATH
addpath "$WCT_EXTERNALS/share/pkgconfig" PKG_CONFIG_PATH
local mydir=$(dirname $(readlink -f $BASH_SOURCE))
cd $mydir
./wcb configure \
--prefix=$WCT_PREFIX \
--boost-includes=$WCT_EXTERNALS/include \
--boost-libs=$WCT_EXTERNALS/lib \
--boost-mt \
--with-eigen=$WCT_EXTERNALS \
--with-jsoncpp=$WCT_EXTERNALS \
--with-tbb=$WCT_EXTERNALS \
--with-root=$WCT_EXTERNALS \
--with-fftw=$WCT_EXTERNALS \
--with-jsonnet=$WCT_EXTERNALS \
"$@"
}
wct-test () {
local name=$1 ; shift
local mydir=$(dirname $(readlink -f $BASH_SOURCE))
local old_ld_library_path="$LD_LIBRARY_PATH"
addpath $WCT_EXTERNALS/lib LD_LIBRARY_PATH
for maybe in $mydir/build/* ;
do
maybe="$(readlink -f $maybe)"
if [ -d "$maybe" ] ; then
addpath $maybe LD_LIBRARY_PATH
fi
done
$mydir/build/*/test_$name $@
LD_LIBRARY_PATH=$old_ld_library_path
}
wct-run () {
local mydir=$(dirname $(readlink -f $BASH_SOURCE))
local old_ld_library_path="$LD_LIBRARY_PATH"
local old_path="$PATH"
addpath $WCT_EXTERNALS/lib LD_LIBRARY_PATH
addpath $WCT_EXTERNALS/bin PATH
addpath $WCT_PREFIX/lib LD_LIBRARY_PATH
addpath $WCT_PREFIX/bin PATH
# configuration and field/wire data files
addpath $WCT_PREFIX/share/wirecell/data WIRECELL_PATH
addpath $WCT_PREFIX/share/wirecell/config WIRECELL_PATH
addpath $WCT_PREFIX/data WIRECELL_PATH
for maybe in $mydir/build/* ;
do
maybe="$(readlink -f $maybe)"
if [ -d "$maybe" ] ; then
addpath $maybe LD_LIBRARY_PATH
fi
done
$@
LD_LIBRARY_PATH=$old_ld_library_path
PATH=$old_path
}