source: flair-dev/trunk/scripts/flair_compile_all.sh@ 45

Last change on this file since 45 was 45, checked in by Sanahuja Guillaume, 8 years ago

vision filter

  • Property svn:executable set to *
File size: 3.7 KB
Line 
1#!/bin/bash
2ARCH_DIR=build_$(uname -m)
3NB_THREADS=$(nproc)
4from_scratch=no
5IDE_SCRIPT=cmake_codelite.sh
6
7function green_echo () {
8 echo -e "\033[32m$1\033[0m"
9}
10
11function red_echo () {
12 echo -e "\033[31m$1\033[0m"
13}
14
15function check_error () {
16 if [ "$?" != "0" ]; then
17 red_echo "Error, exiting"
18 exit 1
19 fi
20}
21
22function sanity_check () {
23 if [ -z $FLAIR_ROOT ]; then
24 red_echo "You must set the FLAIR_ROOT environement variable"
25 exit 1
26 fi
27}
28
29function configure () {
30 if [ "$from_scratch" = "yes" ]; then
31 green_echo "Configuring $1/$2"
32 cd $1/$2
33
34 rm -f build_arm/CMakeCache.txt
35 $FLAIR_ROOT/flair-dev/scripts/$IDE_SCRIPT > /dev/null
36
37 check_error
38 else
39 green_echo "Not configuring $1/$2"
40 fi
41}
42
43function cross_compile () {
44 green_echo "Cross compiling and installing $2"
45 cd $1/$2/build_arm
46 if [ "$from_scratch" = "yes" ]; then make clean > /dev/null; fi
47 make -j$NB_THREADS > /dev/null
48 check_error
49 make install
50}
51
52function compile () {
53 green_echo "Compiling and installing $2"
54 cd $1/$2/$ARCH_DIR
55 if [ "$from_scratch" = "yes" ]; then make clean > /dev/null; fi
56 make -j$NB_THREADS > /dev/null
57 check_error
58 make install
59}
60
61function compile_libs() {
62 for projects in FlairCore FlairSensorActuator FlairFilter FlairVisionFilter FlairMeta FlairSimulator ; do
63 configure $FLAIR_ROOT/flair-src/lib $projects
64 compile $FLAIR_ROOT/flair-src/lib $projects
65 cross_compile $FLAIR_ROOT/flair-src/lib $projects
66 done
67
68 if [ -d $FLAIR_ROOT/flair-hds ]; then
69 for projects in FlairArdrone2 VisionFilter; do
70 configure $FLAIR_ROOT/flair-hds/src/lib $projects
71 compile $FLAIR_ROOT/flair-hds/src/lib $projects
72 cross_compile $FLAIR_ROOT/flair-hds/src/lib $projects
73 done
74 fi
75}
76
77function compile_tools() {
78 for projects in FlairGCS Controller/DualShock3 Controller/Mavlink Dbt2csv; do
79 configure $FLAIR_ROOT/flair-src/tools $projects
80 compile $FLAIR_ROOT/flair-src/tools $projects
81 cross_compile $FLAIR_ROOT/flair-src/tools $projects
82 done
83}
84
85function compile_uav_and_simulator_demo() {
86 for projects in simulator uav; do
87 configure $1/$2 $projects
88 compile $1/$2 $projects
89 cross_compile $1/$2 $projects
90 done
91}
92
93function compile_demos() {
94 for projects in Sinus; do
95 configure $FLAIR_ROOT/flair-src/demos $projects
96 compile $FLAIR_ROOT/flair-src/demos $projects
97 cross_compile $FLAIR_ROOT/flair-src/demos $projects
98 done
99
100 for projects in OpticalFlow CircleFollower SimpleFleet Gps; do
101 compile_uav_and_simulator_demo $FLAIR_ROOT/flair-src/demos $projects
102 done
103
104 for projects in CustomReferenceAngles CustomTorques; do
105 configure $FLAIR_ROOT/flair-src/demos/Skeletons $projects
106 compile $FLAIR_ROOT/flair-src/demos/Skeletons $projects
107 cross_compile $FLAIR_ROOT/flair-src/demos/Skeletons $projects
108 done
109
110exit 0
111
112
113 for projects in uav; do
114 configure $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
115 compile $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
116 cross_compile $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
117 done
118
119
120}
121
122sanity_check
123
124printf "Compile all from scratch [Y/n]?"
125read answer
126
127if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
128 from_scratch=yes
129fi
130
131printf "Compile Flair libs [Y/n]?"
132read answer
133
134if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
135 compile_libs
136fi
137
138printf "Compile Flair libs documentation [Y/n]?"
139read answer
140
141if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
142 $OECORE_HOST_NATIVE_SYSROOT/usr/bin/doxygen $FLAIR_ROOT/flair-src/lib/Doxyfile.in
143fi
144
145printf "Compile Flair tools [Y/n]?"
146read answer
147
148if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
149 compile_tools
150fi
151
152printf "Compile demos [Y/n]?"
153read answer
154
155if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
156 compile_demos
157fi
158
159exit 0
160
161
162
163exit 0
Note: See TracBrowser for help on using the repository browser.