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

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

m

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