|
NCBI Home IEB Home C++ Toolkit docs C Toolkit source browser C Toolkit source browser (2) |
NCBI C++ Toolkit Cross ReferenceC++/compilers/msvc800_prj/build.sh |
source navigation diff markup identifier search freetext search file search |
1 #! /bin/sh
2 # $Id: build.sh 152799 2009-02-19 18:36:14Z ivanov $
3 # Author: Vladimir Ivanov (ivanov@ncbi.nlm.nih.gov)
4 #
5 # Build C++ Toolkit.
6
7
8 ########### Arguments
9
10 script="$0"
11 cfgs="${1:-DebugDLL ReleaseDLL}"
12 arch="$2"
13
14
15 ########### Global variables
16
17 build_trees='static dll'
18 sol_static="ncbi_cpp.sln gui\ncbi_gui.sln"
19 sol_dll="ncbi_cpp_dll.sln gui\ncbi_gui_dll.sln"
20 timer="date +'%H:%M'"
21
22
23 ########## Functions
24
25 error()
26 {
27 echo "[`basename $script`] ERROR: $1"
28 exit 1
29 }
30
31 generate_msvc8_error_check_file() {
32 cat <<-EOF >$1
33 /.*--* (Reb|B)uild( All | )started: Project:/ {
34 expendable = ""
35 }
36
37 /^EXPENDABLE project/ {
38 expendable = \$0
39 }
40
41 /(^| : |^The source )([fatal error]* [CDULNKPRJVT]*[0-9]*: |The .* are both configured to produce |Error executing )/ {
42 if (!expendable) {
43 print \$0
44 exit
45 }
46 }
47 EOF
48 }
49
50
51 ########## Main
52
53 # Get build dir
54 build_dir=`dirname $script`
55 build_dir=`(cd "$build_dir"; pwd)`
56
57 if [ ! -d $build_dir ] ; then
58 error "Build directory $build_dir not found"
59 exit 1
60 fi
61 cd $build_dir
62
63 for cfg in $cfgs ; do
64 if [ $cfg = Release -o $cfg = Debug ] ; then
65 error "$cfg configuration is not buildable on this platform."
66 fi
67 done
68
69
70 # Configuration to build configure
71 cfg_configure='ReleaseDLL'
72 out=".build.$$"
73
74 # Get directory for build logfiles
75 log_dir="$build_dir/../../logs"
76 mkdir $log_dir >/dev/null 2>&1
77 log_dir=`(cd "$log_dir"; pwd)`
78 rm $log_dir/* >/dev/null 2>&1
79
80
81 chmod +x $build_dir/build_exec.bat
82 rm -f $build_dir/cfgs.log
83
84
85 # Configure
86
87 for tree in $build_trees ; do
88 if [ $tree = dll ] ; then
89 test $cfg_configure != ReleaseDLL -a $cfg_configure != DebugDLL && continue
90 fi
91 sols=`eval echo "$"sol_${tree}""`
92 for sol in $sols ; do
93 alias=`echo $sol | sed -e 's|\\\\.*$||g' -e 's|_.*$||g'`
94 start=`eval $timer`
95 echo Start time: $start
96 echo "INFO: Configure \"$tree\\$alias\""
97 if test ! -f "$tree/build/$sol" ; then
98 echo "INFO: Solution not found, skipped."
99 continue
100 fi
101 echo "Command line: " $build_dir/build_exec.bat "$tree\\build\\$sol" build "$arch" "$cfg_configure" "-CONFIGURE-" $out
102 $build_dir/build_exec.bat "$tree\\build\\$sol" build "$arch" "$cfg_configure" "-CONFIGURE-" $out
103 status=$?
104 cat $out >> ${log_dir}/${tree}_${cfg_configure}.log
105 rm -f $out >/dev/null 2>&1
106 if [ $status -ne 0 ] ; then
107 exit 3
108 fi
109 echo "Build time: $start - `eval $timer`"
110 done
111 done
112
113
114 # Generate errors check script
115
116 check_awk=$build_dir/build_check.awk
117 generate_msvc8_error_check_file $check_awk
118
119
120 # Build
121
122 for tree in $build_trees ; do
123 for cfg in $cfgs ; do
124 if [ $tree = dll ] ; then
125 test $cfg != ReleaseDLL -a $cfg != DebugDLL && continue
126 fi
127 sols=`eval echo "$"sol_${tree}""`
128 for sol in $sols ; do
129 if test ! -f "$tree/build/$sol" ; then
130 echo "INFO: Solution not found, skipped."
131 continue
132 fi
133 alias=`echo $sol | sed -e 's|\\\\.*$||g' -e 's|_.*$||g'`
134 start=`eval $timer`
135 echo Start time: $start
136 echo "$tree,$sol,$cfg" >> $build_dir/cfgs.log
137 echo "INFO: Building \"$tree\\$cfg\\$alias\""
138 echo "Command line: " $build_dir/build_exec.bat "$tree\\build\\$sol" build "$arch" "$cfg" "-BUILD-ALL-" $out
139 $build_dir/build_exec.bat "$tree\\build\\$sol" build "$arch" "$cfg" "-BUILD-ALL-" $out
140 status=$?
141 cat $out >> ${log_dir}/${tree}_${cfg}.log
142 echo "Build time: $start - `eval $timer`"
143 if [ $status -ne 0 ] ; then
144 # Check on errors (skip expendable projects)
145 failed="1"
146 grep '^==* Build: .* succeeded, .* failed' $out >/dev/null 2>&1 && \
147 awk -f $check_awk $out >$out.res 2>/dev/null && test ! -s $out.res && failed="0"
148 rm -f $out $out.res >/dev/null 2>&1
149 if [ "$failed" = "1" ]; then
150 exit 4
151 fi
152 fi
153 rm -f $out >/dev/null 2>&1
154 done
155 done
156 done
157
158 exit 0
|
This page was automatically generated by the
LXR engine.
Visit the LXR main site for more information. |