build_pizza_library


#!/bin/bash

# It is assumed the 'ceda' folder (the CEDA SDK) is a sibling of the 'pizza' folder
# E.g.
#      ~
#      +-- developer
#          +-- build_pizza_lib                <--- build artefacts folder
#              +-- build
#              +-- export
#              +-- include
#              +-- lib
#          +-- ceda                           <--- CEDA SDK
#          +-- pizza                          <--- pizza source code repository
#              +-- Acme
#                  +-- build_pizza_library    <--- this script
#                  +-- Pizza                  <--- Project directory for Pizza library
#                  |   +-- DateTime.h
#                  |   +-- PizzaDeliveries.h
#                  |   +-- Shapes.h
#                  |   +-- src
#                  |       +-- Pizza.cpp
#                  |       +-- Pizza.xcpj     <--- project file
#                  +-- wsPizza.xcpp           <--- config file for Xcpp
#                  +-- wsPizza.xcws           <--- workspace file

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

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
cp -r $CEDA_PKG/lib/$PLATFORM/Release/*.so $BUILD_ARTEFACTS/lib/$PLATFORM/Release

mkdir -p $BUILD_ARTEFACTS/build
cp $PIZZA_REPO_ROOT/Acme/wsPizza.xcpp $BUILD_ARTEFACTS/build
cd $BUILD_ARTEFACTS/build

# Generate make files
Xcpp wsPizza.xcpp mode=gen

echo "----------------- build the libPizza.so library --------------------"

# Make the release build (use d for the debug version)
make r

echo "----------------- install the pypizza Python module --------------------"
cp -r ../../pizza/Acme/pypizza_package ..
cp ../lib/$PLATFORM/Release/libPizza.so ../pypizza_package/pypizza/lib/linux
cd ../pypizza_package
sudo python setup.py install
cd $SAVE