build_pizza_library_android


#!/bin/bash

# It is assumed the 'ceda-android' folder (the CEDA SDK) is a sibling of the 'pizza' folder
# E.g.
#      ~
#      +-- developer
#          +-- build_pizza_lib_android              <--- build artefacts folder
#              +-- build
#              +-- export
#              +-- include
#              +-- lib
#          +-- ceda-android                         <--- CEDA SDK for Android
#          +-- pizza                                <--- pizza source code repository
#              +-- Acme
#                  +-- build_pizza_library_android  <--- this script
#                  +-- Pizza                        <--- Project directory for Pizza library
#                  |   +-- DateTime.h
#                  |   +-- PizzaDeliveries.h
#                  |   +-- Shapes.h
#                  |   +-- src
#                  |       +-- Pizza.cpp
#                  |       +-- Pizza.xcpj           <--- project file
#                  +-- wsPizza_android.xcpp         <--- config file for Xcpp
#                  +-- wsPizza.xcws                 <--- workspace file
# Instructions
# ------------
#
# 1.    Download ceda-android-0.7.tar.gz from the cedanet website and unzip such that the ceda-android folder 
#       appears under ~/developer
#
# 2.    Download pizza-0.7.tar.gz and unzip such that the pizza folder appears under ~/developer
#
# 3.    Run the following commands:
#           cd ~/developer/pizza/Acme
#           ./build_pizza_library_android
#
# 4.    Run Android Studio and open project ~/developer/CedaAndroidExample


SAVE=`pwd`
DIR_CONTAINING_THIS_SCRIPT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
PLATFORM=Android
CEDA_PKG="$DIR_CONTAINING_THIS_SCRIPT/../../ceda-android"
PIZZA_REPO_ROOT="$DIR_CONTAINING_THIS_SCRIPT/.."
BUILD_ARTEFACTS="$DIR_CONTAINING_THIS_SCRIPT/../../build_pizza_lib_android"

if [[ ! -d "$CEDA_PKG" ]] ; then
    echo "CEDA SDK not at expected location ($CEDA_PKG), aborting."
    exit
fi

echo "----------------- generate make files to build the Pizza library --------------------"

#mkdir -p $BUILD_ARTEFACTS/lib/$PLATFORM/Release

mkdir -p $BUILD_ARTEFACTS/build

cp $PIZZA_REPO_ROOT/Acme/selectcompiler_android.xcpp $BUILD_ARTEFACTS/build/selectcompiler.xcpp
cp $PIZZA_REPO_ROOT/Acme/build_local_android.xcpp $BUILD_ARTEFACTS/build/build_local.xcpp
cp $PIZZA_REPO_ROOT/Acme/wsPizza_android.xcpp $BUILD_ARTEFACTS/build/wsPizza.xcpp
cd $BUILD_ARTEFACTS/build

# Generate make files
Xcpp wsPizza.xcpp mode=gen

echo "----------------- Run Xcpp to generate the translated files (i.e. standard C++) --------------------"

make rxcppclean
make rtranslate

cd $SAVE