From 68e5dbf5172f6a0897f875f1185ad3ec8c870623 Mon Sep 17 00:00:00 2001 From: Sacha Date: Sun, 8 Dec 2013 23:17:45 +1000 Subject: [PATCH] Turn b.sh in to a centralised CMake builder for Native(Linux/BSD), Android, iOS and Blackberry. --- .travis.yml | 2 +- Blackberry/build.sh | 23 ---------------- b.sh | 66 ++++++++++++++++++++++++++++++++++++++------- native | 2 +- 4 files changed, 59 insertions(+), 34 deletions(-) delete mode 100755 Blackberry/build.sh diff --git a/.travis.yml b/.travis.yml index 00b7bd8e9..99473a46b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,7 @@ script: - elif [ "$PPSSPP_BUILD_TYPE" == "Android" ]; then pushd android && ./ab.sh && popd; - elif [ "$PPSSPP_BUILD_TYPE" == "Blackberry" ]; then - pushd Blackberry && ./build.sh --no-package && popd; + ./b.sh --no-package; - elif [ "$PPSSPP_BUILD_TYPE" == "Symbian" ]; then pushd Qt && qmake -spec symbian-sbsv2 PPSSPPQt.pro && make release-gcce -j4 && make sis && popd; fi diff --git a/Blackberry/build.sh b/Blackberry/build.sh deleted file mode 100755 index a689c926a..000000000 --- a/Blackberry/build.sh +++ /dev/null @@ -1,23 +0,0 @@ -# Check Blackberry NDK -BB_OS=`cat ${QNX_TARGET}/etc/qversion 2>/dev/null` -if [ -z "$BB_OS" ]; then - echo "Could not find your Blackberry NDK. Please source bbndk-env.sh" - exit 1 -fi - -# Strict errors. Any non-zero return exits this script -set -e -echo "Building for Blackberry ${BB_OS}" - -if [[ "$1" == "--simulator" ]]; then - SIM="-DSIMULATOR=ON" -fi - -cmake ${SIM} -DCMAKE_TOOLCHAIN_FILE=bb.toolchain.cmake -DBLACKBERRY=${BB_OS} .. | (grep -v "^-- " || true) - -# Compile and create unsigned PPSSPP.bar with debugtoken -make -j4 -if [[ "$1" != "--no-package" ]]; then - DEBUG="-devMode -debugToken ${HOME}/debugtoken.bar" - blackberry-nativepackager -package PPSSPP.bar bar-descriptor.xml $DEBUG -fi diff --git a/b.sh b/b.sh index b5791561e..5806e5534 100755 --- a/b.sh +++ b/b.sh @@ -1,14 +1,62 @@ +#!/bin/bash +# Check Blackberry NDK +BB_OS=`cat ${QNX_TARGET}/etc/qversion 2>/dev/null` +if [ ! -z "$BB_OS" ]; then + CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=Blackberry/bb.toolchain.cmake -DBLACKBERRY=${BB_OS} ${CMAKE_ARGS}" + BUILD_EXT="-bb" + DEBUG_ARGS="-devMode -debugToken ${HOME}/debugtoken.bar" + BB_PACKAGE=1 +fi + +# Check arguments +while test $# -gt 0 +do + case "$1" in + --headless) echo "Headless mode enabled" + CMAKE_ARGS="-DHEADLESS=ON ${CMAKE_ARGS}" + ;; + --ios) CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=ios/ios.toolchain.cmake -GXcode ${CMAKE_ARGS}" + BUILD_EXT="-ios" + ;; + --android) CMAKE_ARGS="-DCMAKE_TOOLCHAIN_FILE=android/android.toolchain.cmake ${CMAKE_ARGS}" + BUILD_EXT="-android" + ;; + --no-package) echo "Blackberry packaging disabled" + BB_PACKAGE=0 + ;; + --release-package) echo "Blackberry release package enabled" + DEBUG_ARGS="" + ;; + --simulator) echo "Simulator mode enabled" + CMAKE_ARGS="-DSIMULATOR=ON ${CMAKE_ARGS}" + ;; + --*) echo "Bad option: $1" + exit 1 + ;; + *) MAKE_OPT="$1 ${MAKE_OPT}" + ;; + esac + shift +done + +if [ "$BUILD_EXT" == "-ios" ]; then + echo "Building for iOS" +elif [ "$BUILD_EXT" == "-android" ]; then + echo "Building for Android" +elif [ "$BUILD_EXT" == "-bb" ]; then + echo "Building for Blackberry ${BB_OS}" +else + echo "Building for native host." +fi + # Strict errors. Any non-zero return exits this script set -e -cp -r android/assets . -mkdir -p build -if [[ "$1" == "--headless" ]]; then - HEADLESS="-DHEADLESS=ON" -else - MAKE_OPT="$1" -fi -pushd build -cmake $HEADLESS .. | (grep -v "^-- " || true) +mkdir -p build${BUILD_EXT} +pushd build${BUILD_EXT} +cmake $HEADLESS $CMAKE_ARGS .. | (grep -v "^-- " || true) make -j4 $MAKE_OPT +if [ $BB_PACKAGE -eq 1 ]; then + blackberry-nativepackager -package PPSSPP.bar ../Blackberry/bar-descriptor.xml $DEBUG_ARGS +fi popd diff --git a/native b/native index 9e5df6028..1fbab7d72 160000 --- a/native +++ b/native @@ -1 +1 @@ -Subproject commit 9e5df6028ad08d796a4656a30fa532058aa9466d +Subproject commit 1fbab7d728b1a83398ef7a41131a0541d3f9f6a0