source: flair-dev/tags/0.2.0/scripts/flair_compile_all.sh

Last change on this file was 73, checked in by Sanahuja Guillaume, 7 years ago

add pidstandalone

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