source: flair-dev/trunk/scripts/compile_flair_all.sh@ 8

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

simulator

  • Property svn:executable set to *
File size: 4.1 KB
Line 
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_flair() {
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
75function compile_examples() {
76 for projects in ex_framework ex_kalman_framework; do
77 configure $FLAIR_ROOT/uav_ex $projects
78 compile $FLAIR_ROOT/uav_ex $projects
79 cross_compile $FLAIR_ROOT/uav_ex $projects
80 done
81
82 for projects in ex_opencv; do
83 configure $FLAIR_ROOT/uav_ex $projects
84 compile $FLAIR_ROOT/uav_ex $projects
85 cross_compile $FLAIR_ROOT/uav_ex $projects
86 done
87
88 for projects in control simulator; do
89 configure $FLAIR_ROOT/uav_ex/ex_simulator_framework $projects
90 compile $FLAIR_ROOT/uav_ex/ex_simulator_framework $projects
91 cross_compile $FLAIR_ROOT/uav_ex/ex_simulator_framework $projects
92 done
93
94 for projects in simulator uav; do
95 configure $FLAIR_ROOT/uav_ex/demo_optitrack_framework $projects
96 compile $FLAIR_ROOT/uav_ex/demo_optitrack_framework $projects
97 cross_compile $FLAIR_ROOT/uav_ex/demo_optitrack_framework $projects
98 done
99
100 for projects in simulator uav; do
101 configure $FLAIR_ROOT/uav_ex/demo_fo_framework $projects
102 compile $FLAIR_ROOT/uav_ex/demo_fo_framework $projects
103 cross_compile $FLAIR_ROOT/uav_ex/demo_fo_framework $projects
104 done
105
106 for projects in simulator uav; do
107 configure $FLAIR_ROOT/uav_ex/demo_flotte_framework $projects
108 compile $FLAIR_ROOT/uav_ex/demo_flotte_framework $projects
109 cross_compile $FLAIR_ROOT/uav_ex/demo_flotte_framework $projects
110 done
111
112 for projects in uav; do
113 configure $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
114 compile $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
115 cross_compile $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
116 done
117
118 for projects in CustomReferenceAngles CustomTorques; do
119 configure $FLAIR_ROOT/uav_ex/skeletons_framework $projects
120 compile $FLAIR_ROOT/uav_ex/skeletons_framework $projects
121 cross_compile $FLAIR_ROOT/uav_ex/skeletons_framework $projects
122 done
123}
124
125sanity_check
126
127printf "Compile all from scratch [Y/n]?"
128read answer
129
130if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
131 from_scratch=yes
132fi
133
134printf "Compile Flair libs [Y/n]?"
135read answer
136
137if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
138 compile_flair
139fi
140exit 0
141printf "Compile Flair tools [Y/n]?"
142read answer
143
144if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
145 compile_tools
146fi
147
148printf "Compile Flair documentation [Y/n]?"
149read answer
150
151if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
152 cd $FLAIR_ROOT/flair-src/lib
153 doxygen Doxyfile.in
154fi
155
156printf "Compile examples [Y/n]?"
157read answer
158
159if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
160 compile_examples
161fi
162
163exit 0
Note: See TracBrowser for help on using the repository browser.