close Warning: Can't use blame annotator:
svn blame failed on trunk/scripts/flair_compile_all.sh: 200029 - Couldn't perform atomic initialization

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

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

m

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