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

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

passage a codelite

  • Property svn:executable set to *
File size: 3.9 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 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 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
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
126}
127
128sanity_check
129
130printf "Compile all from scratch [Y/n]?"
131read answer
132
133if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
134 from_scratch=yes
135fi
136
137printf "Compile Flair libs [Y/n]?"
138read answer
139
140if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
141 compile_libs
142fi
143
144printf "Compile Flair libs documentation [Y/n]?"
145read answer
146
147if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
148 $OECORE_HOST_NATIVE_SYSROOT/usr/bin/doxygen $FLAIR_ROOT/flair-src/lib/Doxyfile.in
149fi
150
151printf "Compile Flair tools [Y/n]?"
152read answer
153
154if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
155 compile_tools
156fi
157
158printf "Compile demos [Y/n]?"
159read answer
160
161if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
162 compile_demos
163fi
164
165exit 0
166
167
168
169exit 0
Note: See TracBrowser for help on using the repository browser.