forked from janelia-flyem/NeuTu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·146 lines (123 loc) · 2.48 KB
/
build.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
140
141
142
143
144
145
#!/bin/bash
#Example:
#sh build.sh /Users/zhaot/local/lib/Trolltech/Qt-4.8.5/bin/qmake /Users/zhaot/local/lib/Trolltech/Qt-4.8.5/mkspecs/macx-g++
set -e
if [ $# -lt 2 ]
then
echo "Usage: sh build.sh <qmake_path> <qmake_spec_path> [-d cxx_define] [-e edition] [-c debug|release]"
echo "Example: "
echo 'sh build.sh $HOME/local/lib/Trolltech/Qt-4.8.5/bin/qmake $HOME/local/lib/Trolltech/Qt-4.8.5/mkspecs/macx-g++'
exit 1
fi
QMAKE=$1
QMAKE_SPEC=$2
shift
shift
edition=general
debug_config=release
make_args='-j3'
while getopts d:e:c:q:m: option
do
echo $option
echo $OPTARG
case $option in
d)
cxx_define=$OPTARG;;
e)
edition=$OPTARG;;
c)
debug_config=$OPTARG;;
q)
ext_qmake_args=$OPTARG;;
m)
make_args=$OPTARG;;
esac
done
if [ -n "$cxx_define" ]
then
if [ $edition = "flyem" ]
then
cxx_define="_FLYEM_ $cxx_define"
fi
if [ $edition = "biocytin" ]
then
cxx_define="_BIOCYTIN_ $cxx_define"
fi
else
if [ $edition = "flyem" ]
then
cxx_define="_FLYEM_"
fi
if [ $edition = "biocytin" ]
then
cxx_define="_BIOCYTIN_"
fi
fi
qmake_args="-spec $QMAKE_SPEC CONFIG+=$debug_config CONFIG+=x86_64 -o Makefile ../gui/gui.pro"
if [ -n "$cxx_define" ]
then
qmake_args="$qmake_args DEFINES+=\"$cxx_define\""
fi
if [ -n "$ext_qmake_args" ]
then
echo $ext_qmake_args
qmake_args="$qmake_args $ext_qmake_args"
fi
#exit 1
echo $qmake_args
cd neurolabi
echo 'Building 3rd-party libraries ...'
cd lib
sh build.sh
cd ..
echo 'Building libneurolabi ...'
build_dir=build
if [ $debug_config = "debug" ]
then
./update_library
build_dir=build_debug
else
./update_library --release
fi
if [ ! -d $build_dir ]
then
mkdir $build_dir
fi
cd $build_dir
echo $qmake_args > source.qmake
$QMAKE $qmake_args
make -j3
bin_dir=.
if [ -d $bin_dir/neuTube.app ]
then
bin_dir=$bin_dir/neuTube.app/Contents/MacOS
fi
if [ $edition = "flyem" ]
then
cp ../gui/config_flyem.xml $bin_dir/config.xml
cp -r ../json $bin_dir
fi
if [ $edition = "biocytin" ]
then
cp ../gui/biocytin_config.xml $bin_dir/config.xml
fi
if [ $edition = "general" ]
then
cp ../gui/config.xml $bin_dir/config.xml
fi
#echo "Deploying ..."
#if [ -d neuTube.app ]
#then
# qtbin_dir=`dirname $QMAKE`
# cd ..
# if [ -f $qtbin_dir/macdeployqt ]
# then
# $qtbin_dir/macdeployqt `pwd`/build/neuTube.app -no-plugins
# else
# sh gui/deploy_neutube.sh `pwd`/build
# fi
# echo "build/neuTube.app deployed."
#else
# echo "neuTube deployed."
#mv neuTube ../../
#fi