diff options
author | Dirk Hohndel <dirk@hohndel.org> | 2016-01-17 10:44:00 -0800 |
---|---|---|
committer | Dirk Hohndel <dirk@hohndel.org> | 2016-01-17 10:44:00 -0800 |
commit | f28f03afe27b398688a35e7bcff555775f9b5fcf (patch) | |
tree | f0ceded000eb172085121f259c74bb4266716600 /scripts | |
parent | 69eeb2bf5bb7870d8462a95f4a9a30455f27537a (diff) | |
download | subsurface-f28f03afe27b398688a35e7bcff555775f9b5fcf.tar.gz |
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 <dirk@hohndel.org>
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/build.sh | 70 |
1 files changed, 46 insertions, 24 deletions
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 |