#!/bin/bash #setup environment # project pro file pro_path=application/application.pro pro_debug="CONFIG+=debug CONFIG+=qml_debug" pro_release="CONFIG+=qtquickcompiler" # gcc env gcc_qmake="/opt/Qt/5.12.4/gcc_64/bin/qmake" gcc_make="/usr/bin/make" gcc_out="gcc_64" gcc_spec="-spec linux-g++" # poky env poky_qmake="/opt/b2qt/2.5.3/sysroots/x86_64-pokysdk-linux/usr/bin/qmake" poky_make="/opt/b2qt/2.5.3/sysroots/x86_64-pokysdk-linux/usr/bin/make" poky_out="poky_64" poky_spec="-spec devices/linux-oe-generic-g++" #build type detection and set function (debug/release) function buildType() { echo if [[ "$1" = "debug" ]]; then pro_build=$pro_debug echo "----- DEBUG BUILD --------------------------" else pro_build=$pro_release echo "----- RELASE BUILD --------------------------" fi echo } #check if the out folders already exists if [[ -e $gcc_out ]]; then rm -frd $gcc_out fi if [[ -e $poky_out ]]; then rm -frd $poky_out fi # check if user prefers another folder for the application project if [[ ! -z "$1" ]]; then pro_path=$1 fi # check if the folder exist if [[ ! -e "$pro_path" ]]; then echo "folder $pro_path does not exists" exit 1 fi #set the build type (debug/release) buildType "$2" #build for gcc echo "---------------------------------------------" echo "Start building ---------- gcc_64 ------------" echo "---------------------------------------------" mkdir $gcc_out cd $gcc_out $gcc_qmake ../$pro_path $gcc_spec $pro_build $gcc_make -j4 cd .. #build for poky echo "---------------------------------------------" echo "Start building ---------- poky_64 -----------" echo "---------------------------------------------" mkdir $poky_out cd $poky_out $poky_qmake ../$pro_path $poky_spec $pro_build $poky_make -j4 cd ..