Make android compile friendly for Windows 10 WSL

This commit is contained in:
baldurk
2018-08-18 16:45:01 +01:00
parent 3f2862bcd3
commit c599ab96e6
2 changed files with 43 additions and 8 deletions
+41 -8
View File
@@ -39,6 +39,23 @@ fi
popd; # docs
# Transform ANDROID_SDK / ANDROID_NDK to native paths if needed
if echo "${ANDROID_SDK}" | grep -q :; then
NATIVE_ANDROID_SDK_PATH=$(echo "${ANDROID_SDK}" | sed -e '{s#^\(.\):[/\]#\1/#g}' | tr '\\' '/')
# Add on wherever windows drives are
ANDROID_SDK="${WIN_ROOT}${NATIVE_ANDROID_SDK_PATH}"
export ANDROID_SDK
fi
if echo "${ANDROID_NDK}" | grep -q :; then
NATIVE_ANDROID_NDK_PATH=$(echo "${ANDROID_NDK}" | sed -e '{s#^\(.\):[/\]#\1/#g}' | tr '\\' '/')
# Add on wherever windows drives are
ANDROID_NDK="${WIN_ROOT}${NATIVE_ANDROID_NDK_PATH}"
export ANDROID_NDK
fi
# if we didn't produce a chm file, bail out even if sphinx didn't return an error code above
if [ ! -f ./Documentation/htmlhelp/renderdoc.chm ]; then
echo >> /tmp/sphinx.log
@@ -47,10 +64,10 @@ if [ ! -f ./Documentation/htmlhelp/renderdoc.chm ]; then
exit 1;
fi
export PATH=$PATH:$(cygpath -u $ANDROID_SDK/tools/)
export PATH=$PATH:"${ANDROID_SDK}/tools"
# Check that we're set up to build for android
if [ ! -d $ANDROID_SDK/tools ] ; then
if [ ! -d "${ANDROID_SDK}"/tools ] ; then
echo "\$ANDROID_SDK is not correctly configured: '$ANDROID_SDK'" > /tmp/android.log
cat /tmp/android.log
$ERROR_SCRIPT /tmp/android.log
@@ -58,6 +75,16 @@ if [ ! -d $ANDROID_SDK/tools ] ; then
exit 0;
fi
if ! which cmake > /dev/null 2>&1; then
echo "Don't have cmake, can't build android";
exit 0;
fi
if ! which make > /dev/null 2>&1; then
echo "Don't have make, can't build android";
exit 0;
fi
if [ ! -d $LLVM_ARM32 ] || [ ! -d $LLVM_ARM64 ] ; then
echo "llvm is not available, expected $LLVM_ARM32 and $LLVM_ARM64 respectively." > /tmp/android.log
cat /tmp/android.log
@@ -66,12 +93,18 @@ if [ ! -d $LLVM_ARM32 ] || [ ! -d $LLVM_ARM64 ] ; then
exit 0;
fi
GENERATOR="Unix Makefiles"
if uname -a | grep -iq msys; then
GENERATOR="MSYS Makefiles"
fi
# Build the arm32 variant
mkdir build-android-arm32
mkdir -p build-android-arm32
pushd build-android-arm32
cmake -G "MSYS Makefiles" -DBUILD_ANDROID=1 -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DSTRIP_ANDROID_LIBRARY=On -DLLVM_DIR=$LLVM_ARM32/lib/cmake/llvm -DUSE_INTERCEPTOR_LIB=On .. 2>&1 | tee /tmp/cmake.log
make -j8 2>&1 | tee -a /tmp/cmake.log
cmake -G "${GENERATOR}" -DBUILD_ANDROID=1 -DANDROID_ABI=armeabi-v7a -DCMAKE_BUILD_TYPE=Release -DSTRIP_ANDROID_LIBRARY=On -DLLVM_DIR=$LLVM_ARM32/lib/cmake/llvm -DUSE_INTERCEPTOR_LIB=On .. 2>&1 | tee /tmp/cmake.log
make -j$(nproc) 2>&1 | tee -a /tmp/cmake.log
if ! ls bin/*.apk; then
echo >> /tmp/cmake.log
@@ -81,11 +114,11 @@ fi
popd # build-android-arm32
mkdir build-android-arm64
mkdir -p build-android-arm64
pushd build-android-arm64
cmake -G "MSYS Makefiles" -DBUILD_ANDROID=1 -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DSTRIP_ANDROID_LIBRARY=On -DLLVM_DIR=$LLVM_ARM64/lib/cmake/llvm -DUSE_INTERCEPTOR_LIB=On .. | tee /tmp/cmake.log
make -j8 2>&1 | tee -a /tmp/cmake.log
cmake -G "${GENERATOR}" -DBUILD_ANDROID=1 -DANDROID_ABI=arm64-v8a -DCMAKE_BUILD_TYPE=Release -DSTRIP_ANDROID_LIBRARY=On -DLLVM_DIR=$LLVM_ARM64/lib/cmake/llvm -DUSE_INTERCEPTOR_LIB=On .. | tee /tmp/cmake.log
make -j$(nproc) 2>&1 | tee -a /tmp/cmake.log
if ! ls bin/*.apk; then
echo >> /tmp/cmake.log
@@ -81,6 +81,8 @@ fi
# Generate a debug key for signing purposes
if [ -f "$JAVA_HOME/bin/keytool.exe" ] && [ -d dist/Release64/plugins/android ]; then
"$JAVA_HOME/bin/keytool.exe" -genkey -keystore dist/Release64/plugins/android/renderdoc.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=, OU=, O=, L=, S=, C="
elif [ -f "$JAVA_HOME/bin/keytool" ] && [ -d dist/Release64/plugins/android ]; then
"$JAVA_HOME/bin/keytool" -genkey -keystore dist/Release64/plugins/android/renderdoc.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=, OU=, O=, L=, S=, C="
fi
if [ -d dist/Release64/plugins/android ]; then