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

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

add pidstandalone

  • Property svn:executable set to *
File size: 3.4 KB
RevLine 
[2]1#!/bin/bash
2ARCH_DIR=build_$(uname -m)
3NB_THREADS=$(nproc)
4from_scratch=no
[43]5IDE_SCRIPT=cmake_codelite.sh
[68]6toolchains=($OECORE_CMAKE_TOOLCHAINS)
[2]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
[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 compile () {
[68]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
[2]53}
54
[26]55function compile_libs() {
[44]56 for projects in FlairCore FlairSensorActuator FlairFilter FlairVisionFilter FlairMeta FlairSimulator ; do
[2]57 configure $FLAIR_ROOT/flair-src/lib $projects
[3]58 compile $FLAIR_ROOT/flair-src/lib $projects
[2]59 done
[26]60
61 if [ -d $FLAIR_ROOT/flair-hds ]; then
[71]62 for projects in FlairBebop FlairArdrone2 FlairMinidrones FlairMamboEdu VisionFilter; do
[26]63 configure $FLAIR_ROOT/flair-hds/src/lib $projects
64 compile $FLAIR_ROOT/flair-hds/src/lib $projects
65 done
66 fi
[2]67}
68
[9]69function compile_tools() {
[72]70 for projects in FlairGCS Controller/DualShock3 Controller/Mavlink Dbt2csv VrpnBridge; do
[9]71 configure $FLAIR_ROOT/flair-src/tools $projects
72 compile $FLAIR_ROOT/flair-src/tools $projects
73 done
74}
75
[23]76function compile_uav_and_simulator_demo() {
77 for projects in simulator uav; do
[26]78 configure $1/$2 $projects
79 compile $1/$2 $projects
[23]80 done
81}
82
[9]83function compile_demos() {
[12]84 for projects in Sinus; do
85 configure $FLAIR_ROOT/flair-src/demos $projects
86 compile $FLAIR_ROOT/flair-src/demos $projects
[2]87 done
[14]88
[73]89 for projects in OpticalFlow CircleFollower SimpleFleet Gps PidStandalone; do
[26]90 compile_uav_and_simulator_demo $FLAIR_ROOT/flair-src/demos $projects
[14]91 done
92
[27]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
[46]98 if [ -d $FLAIR_ROOT/flair-hds ]; then
[48]99 for projects in ApriltagFollower LineFollower; do
[46]100 compile_uav_and_simulator_demo $FLAIR_ROOT/flair-hds/src/demos $projects
101 done
102 fi
[26]103
[2]104}
105
106sanity_check
107
[46]108if [ -d $FLAIR_ROOT/flair-hds ]; then
109 printf "Found flair-hds repository\n"
110fi
111
[2]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
[26]123 compile_libs
[2]124fi
[9]125
[14]126printf "Compile Flair libs documentation [Y/n]?"
127read answer
128
129if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
[23]130 $OECORE_HOST_NATIVE_SYSROOT/usr/bin/doxygen $FLAIR_ROOT/flair-src/lib/Doxyfile.in
[14]131fi
132
[2]133printf "Compile Flair tools [Y/n]?"
134read answer
135
136if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
137 compile_tools
138fi
[12]139
140printf "Compile demos [Y/n]?"
141read answer
142
143if [ "$answer" = "" ] || [ "$answer" = "y" ] || [ "$answer" = "Y" ]; then
144 compile_demos
145fi
146
[9]147exit 0
[2]148
149
150
151exit 0
Note: See TracBrowser for help on using the repository browser.