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

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

vision filter

  • Property svn:executable set to *
File size: 3.7 KB
RevLine 
[2]1#!/bin/bash
2ARCH_DIR=build_$(uname -m)
3NB_THREADS=$(nproc)
4from_scratch=no
[43]5IDE_SCRIPT=cmake_codelite.sh
[2]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
[36]34 rm -f build_arm/CMakeCache.txt
[43]35 $FLAIR_ROOT/flair-dev/scripts/$IDE_SCRIPT > /dev/null
[2]36
37 check_error
38 else
39 green_echo "Not configuring $1/$2"
40 fi
41}
42
43function cross_compile () {
[36]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
[2]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
[26]61function compile_libs() {
[44]62 for projects in FlairCore FlairSensorActuator FlairFilter FlairVisionFilter FlairMeta FlairSimulator ; do
[2]63 configure $FLAIR_ROOT/flair-src/lib $projects
[3]64 compile $FLAIR_ROOT/flair-src/lib $projects
[2]65 cross_compile $FLAIR_ROOT/flair-src/lib $projects
66 done
[26]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
[2]75}
76
[9]77function compile_tools() {
[35]78 for projects in FlairGCS Controller/DualShock3 Controller/Mavlink Dbt2csv; do
[9]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
[23]85function compile_uav_and_simulator_demo() {
86 for projects in simulator uav; do
[26]87 configure $1/$2 $projects
88 compile $1/$2 $projects
89 cross_compile $1/$2 $projects
[23]90 done
91}
92
[9]93function compile_demos() {
[12]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
[2]98 done
[14]99
[45]100 for projects in OpticalFlow CircleFollower SimpleFleet Gps; do
[26]101 compile_uav_and_simulator_demo $FLAIR_ROOT/flair-src/demos $projects
[14]102 done
103
[27]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
[12]110exit 0
[26]111
[2]112
113 for projects in uav; do
114 configure $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
115 compile $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
116 cross_compile $FLAIR_ROOT/uav_ex/demo_ligne_framework $projects
117 done
118
[27]119
[2]120}
121
122sanity_check
123
124printf "Compile all from scratch [Y/n]?"
125read answer
126
127if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
128 from_scratch=yes
129fi
130
131printf "Compile Flair libs [Y/n]?"
132read answer
133
134if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
[26]135 compile_libs
[2]136fi
[9]137
[14]138printf "Compile Flair libs documentation [Y/n]?"
139read answer
140
141if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
[23]142 $OECORE_HOST_NATIVE_SYSROOT/usr/bin/doxygen $FLAIR_ROOT/flair-src/lib/Doxyfile.in
[14]143fi
144
[2]145printf "Compile Flair tools [Y/n]?"
146read answer
147
148if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
149 compile_tools
150fi
[12]151
152printf "Compile demos [Y/n]?"
153read answer
154
155if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
156 compile_demos
157fi
158
[9]159exit 0
[2]160
161
162
163exit 0
Note: See TracBrowser for help on using the repository browser.