forked from Illumina/hap.py
-
Notifications
You must be signed in to change notification settings - Fork 0
/
configure.sh
executable file
·140 lines (121 loc) · 3.43 KB
/
configure.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
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
#!/bin/bash
#
# Configuration script for creating a CMake build directory.
#
# Takes one parameter, which can be:
#
# Debug -- make a debug build (default)
# Release -- make a release build
# install -- installation build (install directory is derived from version)
#
# The optional second parameter determines the configuration script to use
# chuk / ussd / ussd-services / auto
#
# A third parameter can be used to set an installation path.
#
# Here are some examples:
#
# Make Debug version, autodetect config,
# install to /illumina/development/haplocompare/haplocompare-master-debug
#
# configure.sh Debug
#
# Make Release version, autodetect config,
# install to $HOME/haplotypes_testing
#
# configure.sh Release auto $HOME/haplotypes_testing
#
# Make Release version, Illumina config install to $HOME/haplotypes_testing
#
# configure.sh Release illumina $HOME/haplotypes_testing
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
MYDIR=$DIR
unset SPECIALCONFIG
if [[ $2 == "auto" ]]; then
unset CONFIGTYPE
else
CONFIGTYPE="$2"
fi
PLATFORM='unknown'
UNAMESTR=`uname`
if [[ "$UNAMESTR" == 'Linux' ]]; then
PLATFORM='linux'
elif [[ "$UNAMESTR" == 'FreeBSD' ]]; then
PLATFORM='freebsd'
fi
if [[ -z $CONFIGTYPE ]]; then
if [[ "$PLATFORM" == "linux" ]] && [[ -d /illumina ]]; then
if [[ "$(hostname)" == *.illumina.com ]] || \
[[ "$(hostname)" == ukch-* ]] || \
[[ "$(hostname)" == ussd-prd-lndt* ]]; then
echo "using Illumina configuration."
SPECIALCONFIG="${DIR}/src/sh/illumina-setup.sh"
. ${DIR}/src/sh/illumina-setup.sh
fi
fi
else
echo "using $CONFIGTYPE configuration."
SPECIALCONFIG="${DIR}/src/sh/$CONFIGTYPE-setup.sh"
. ${DIR}/src/sh/$CONFIGTYPE-setup.sh
fi
# DIR gets overwritten above
DIR=$MYDIR
if [[ -z $1 ]]; then
BT=Debug
else
BT=$1
fi
shift 1
if [[ -z $1 ]]; then
echo "Configuration detected automatically"
else
shift 1
fi
if [[ "$(echo ${BT} | awk '{print tolower($0)}')" == "install" ]]; then
BV=$(cd ${DIR} ; git describe)
BT=Release
PREFIX=/illumina/development/haplocompare/haplocompare-${BV}
else
TARGET=$(echo ${BT} | awk '{print tolower($0)}')
PREFIX=/illumina/development/haplocompare/haplocompare-master-${TARGET}
fi
if [[ ! -z $1 ]]; then
PREFIX=$1
shift 1
fi
if [[ -z ${CC} ]]; then
CC=`which gcc`
fi
if [[ -z ${CXX} ]]; then
CXX=`which g++`
fi
echo "Build from ${DIR}, type is $BT / installation directory: $PREFIX"
if [[ -z ${BOOST_ROOT} ]]; then
echo "Using system Boost"
cmake ${DIR} -DCMAKE_BUILD_TYPE=$BT \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
$EXTRA_CMAKE_OPTS $@
else
echo "Using Boost: $BOOST_ROOT"
cmake ${DIR} -DCMAKE_BUILD_TYPE=$BT \
-DCMAKE_INSTALL_PREFIX=${PREFIX} \
-DCMAKE_C_COMPILER=$CC -DCMAKE_CXX_COMPILER=$CXX \
-DBOOST_ROOT=$BOOST_ROOT \
$EXTRA_CMAKE_OPTS $@
fi
if [[ ! -z $SPECIALCONFIG ]]; then
echo ""
echo "*********************** NOTICE ****************************"
echo ""
echo "You need to use the correct version of binutils, this may "
echo "not get set up by cmake."
echo ""
echo "The easiest way to do this is by doing "
echo ""
echo " . ${SPECIALCONFIG} "
echo ""
echo "before compiling."
echo ""
echo "***********************************************************"
fi