Skip to content

Commit

Permalink
Updated androidbuild.sh to enable parallel builds and ndk-build param…
Browse files Browse the repository at this point in the history
…eters
  • Loading branch information
gabomdq committed Nov 13, 2013
1 parent ad4ba2d commit f8e1d35
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion build-scripts/androidbuild.sh
Expand Up @@ -25,6 +25,7 @@ if [ -z "$1" ] || [ -z "$SOURCES" ]; then
echo "Usage: androidbuild.sh com.yourcompany.yourapp < sources.list"
echo "Usage: androidbuild.sh com.yourcompany.yourapp source1.c source2.c ...sourceN.c"
echo "To copy SDL source instead of symlinking: COPYSOURCE=1 androidbuild.sh ... "
echo "You can pass additional arguments to ndk-build with the NDKARGS variable: NDKARGS=\"-s\" androidbuild.sh ..."
exit 1
fi

Expand All @@ -51,6 +52,19 @@ if [ -z "$ANT" ];then
exit 1
fi

NCPUS="1"
case "$OSTYPE" in
darwin*)
NCPU=`sysctl -n hw.ncpu`
;;
linux*)
if [ -n `which nproc` ]; then
NCPUS=`nproc`
fi
;;
*);;
esac

APP="$1"
APPARR=(${APP//./ })
BUILDPATH="$SDLPATH/build/$APP"
Expand Down Expand Up @@ -102,7 +116,7 @@ echo "public class $ACTIVITY extends SDLActivity {}" >> "$ACTIVITY.java"
# Update project and build
cd $BUILDPATH
android update project --path $BUILDPATH
$NDKBUILD
$NDKBUILD -j $NCPUS $NDKARGS
$ANT debug

cd $CURDIR
Expand Down

0 comments on commit f8e1d35

Please sign in to comment.