Skip to content

Commit

Permalink
Build scripts: Use strict error checking to propogate errors to under…
Browse files Browse the repository at this point in the history
…lying shell (hint: travis).

Stops builds from showing success when there was an error.
Had to workaround grep's issue of returning '1' when there is no matches. There is unfortunately no alternative.
Removed bin/bash header as it could restrict alternative shells.
Used set -e to break script whenever a non-zero return is encountered.
CMake was returning non-zero on CMAKE_TOOLCHAIN_FILE not being required. Now check for that in CMake instead of platform/abi. If the abi is missing and toolchain is not, that would have been the wrong advice anyway.
  • Loading branch information
xsacha committed Dec 1, 2013
1 parent c1b43e1 commit 7821c8e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 17 deletions.
5 changes: 3 additions & 2 deletions Blackberry/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash
# Strict errors. Any non-zero return exits this script
set -e

BB_OS=`cat ${QNX_TARGET}/etc/qversion 2>/dev/null`
if [ -z "$BB_OS" ]; then
Expand All @@ -11,7 +12,7 @@ if [[ "$1" == "--simulator" ]]; then
SIM="-DSIMULATOR=ON"
fi

cmake ${SIM} -DCMAKE_TOOLCHAIN_FILE=bb.toolchain.cmake -DBLACKBERRY=${BB_OS} .. | grep -v '^-- '
cmake ${SIM} -DCMAKE_TOOLCHAIN_FILE=bb.toolchain.cmake -DBLACKBERRY=${BB_OS} .. | (grep -v "^-- " || true)

# Compile and create unsigned PPSSPP.bar with debugtoken
make -j4
Expand Down
29 changes: 15 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,24 +71,25 @@ option(HEADLESS "Set to OFF to not generate the PPSSPPHeadless target" ${HEADLES
option(SIMULATOR "Set to ON when targeting an x86 simulator of an ARM platform" ${SIMULATOR})
option(USE_FFMPEG "Build with FFMPEG support" ${USE_FFMPEG})

if(ANDROID)
if(NOT ANDROID_ABI)
if(ANDROID OR BLACKBERRY OR IOS)
if (NOT CMAKE_TOOLCHAIN_FILE)
if (ANDROID)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/android/android.toolchain.cmake)
elseif(BLACKBERRY)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/Blackberry/bb.toolchain.cmake)
elseif(IOS)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/ios/ios.toolchain.cmake)
endif()
message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was not set!\n"
"Delete the CMakeCache.txt file and CMakeFiles directory."
"Rerun ${CMAKE_COMMAND} with \"-DCMAKE_TOOLCHAIN_FILE"
"=${CMAKE_SOURCE_DIR}/android/android.toolchain.cmake\"")
"Delete the CMakeCache.txt file and CMakeFiles directory.\n"
"Re-run ${CMAKE_COMMAND} with:\n"
"\"-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}\"")
endif()
endif()

if(ANDROID)
set(CoreLibName ppsspp_jni)
set(CoreLinkType SHARED)
elseif(IOS)
if (NOT IOS_PLATFORM)
message(FATAL_ERROR "CMAKE_TOOLCHAIN_FILE was not set!\n"
"Delete the CMakeCache.txt file and CMakeFiles directory."
"Rerun ${CMAKE_COMMAND} with \"-DCMAKE_TOOLCHAIN_FILE"
"=${CMAKE_SOURCE_DIR}/ios/ios.toolchain.cmake\"")
endif()
set(CoreLibName Core)
set(CoreLinkType STATIC)
else()
set(CoreLibName Core)
set(CoreLinkType STATIC)
Expand Down
5 changes: 4 additions & 1 deletion b.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Strict errors. Any non-zero return exits this script
set -e

cp -r android/assets .
mkdir -p build
if [[ "$1" == "--headless" ]]; then
Expand All @@ -6,6 +9,6 @@ else
MAKE_OPT="$1"
fi
pushd build
cmake $HEADLESS .. | grep -v '^-- '
cmake $HEADLESS .. | (grep -v "^-- " || true)
make -j4 $MAKE_OPT
popd

0 comments on commit 7821c8e

Please sign in to comment.