From f28f03afe27b398688a35e7bcff555775f9b5fcf Mon Sep 17 00:00:00 2001 From: Dirk Hohndel Date: Sun, 17 Jan 2016 10:44:00 -0800 Subject: build.sh: make it easier to build Subsurface-mobile The script now takes a -mobile argument, or -both and then builds the mobile version or both versions. To make things more consistent across different invocations the desktop version is built in the "build" directory and the mobile version is built in "build-mobile". Signed-off-by: Dirk Hohndel --- scripts/build.sh | 70 +++++++++++++++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 24 deletions(-) (limited to 'scripts/build.sh') diff --git a/scripts/build.sh b/scripts/build.sh index b28cffd83..134aa1c7d 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -23,10 +23,25 @@ exec 1> >(tee build.log) 2>&1 SRC=$(pwd) PLATFORM=$(uname) -# to build Subsurface-mobile on the desktop change this to -# SUBSURFACE_EXECUTABLE=MobileExecutable -SUBSURFACE_EXECUTABLE=DesktopExecutable - +# normally this script builds the desktop version in subsurface/build +# if the first argument is "-mobile" then build Subsurface-mobile in subsurface/build-mobile +# if the first argument is "-both" then build both in subsurface/build and subsurface/build-mobile +BUILD="Desktop" +if [ "$1" = "-mobile" ] ; then + echo "building Subsurface-mobile in subsurface/build-mobile" + BUILDS=( "MobileExecutable" ) + BUILDDIRS=( "build-mobile" ) + shift +elif [ "$1" = "-both" ] ; then + echo "building both Subsurface and Subsurface-mobile in subsurface/build and subsurface/build-mobile, respectively" + BUILDS=( "DesktopExecutable" "MobileExecutable" ) + BUILDDIRS=( "build" "build-mobile" ) + shift +else + echo "building Subsurface in subsurface/build" + BUILDS=( "DesktopExecutable" ) + BUILDDIRS=( "build" ) +fi if [[ ! -d "subsurface" ]] ; then echo "please start this script from the directory containing the Subsurface source directory" @@ -183,25 +198,32 @@ else fi cd $SRC/subsurface -mkdir -p build -cd build -export CMAKE_PREFIX_PATH=$INSTALL_ROOT/lib/cmake -cmake -DCMAKE_BUILD_TYPE=Debug .. \ - -DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \ - -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \ - -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT \ - -DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \ - -DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \ - -DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \ - -DMARBLE_LIBRARIES=$INSTALL_ROOT/lib/libssrfmarblewidget.$SH_LIB_EXT \ - -DNO_PRINTING=OFF - -if [ $PLATFORM = Darwin ] ; then - rm -rf Subsurface.app -fi +for (( i=0 ; i < ${#BUILDS[@]} ; i++ )) ; do + SUBSURFACE_EXECUTABLE=${BUILDS[$i]} + BUILDDIR=${BUILDDIRS[$i]} + echo "build $SUBSURFACE_EXECUTABLE in $BUILDDIR" + + mkdir -p $SRC/subsurface/$BUILDDIR + cd $SRC/subsurface/$BUILDDIR + export CMAKE_PREFIX_PATH=$INSTALL_ROOT/lib/cmake + cmake -DCMAKE_BUILD_TYPE=Debug .. \ + -DSUBSURFACE_TARGET_EXECUTABLE=$SUBSURFACE_EXECUTABLE \ + -DLIBGIT2_INCLUDE_DIR=$INSTALL_ROOT/include \ + -DLIBGIT2_LIBRARIES=$INSTALL_ROOT/lib/libgit2.$SH_LIB_EXT \ + -DLIBDIVECOMPUTER_INCLUDE_DIR=$INSTALL_ROOT/include \ + -DLIBDIVECOMPUTER_LIBRARIES=$INSTALL_ROOT/lib/libdivecomputer.a \ + -DMARBLE_INCLUDE_DIR=$INSTALL_ROOT/include \ + -DMARBLE_LIBRARIES=$INSTALL_ROOT/lib/libssrfmarblewidget.$SH_LIB_EXT \ + -DNO_PRINTING=OFF + + if [ $PLATFORM = Darwin ] ; then + rm -rf Subsurface.app + rm -rf Subsurface-mobile.app + fi -LIBRARY_PATH=$INSTALL_ROOT/lib make -j4 + LIBRARY_PATH=$INSTALL_ROOT/lib make -j4 -if [ $PLATFORM = Darwin ] ; then - LIBRARY_PATH=$INSTALL_ROOT/lib make install -fi + if [ $PLATFORM = Darwin ] ; then + LIBRARY_PATH=$INSTALL_ROOT/lib make install + fi +done -- cgit v1.2.3-70-g09d2