Fix Android build script on Windows 64 bit (NDK r10e)
authorMaciej Jesionowski <maciej.jesionowski@mobica.com>
Mon, 4 Jan 2016 09:45:10 +0000 (10:45 +0100)
committerMaciej Jesionowski <maciej.jesionowski@mobica.com>
Tue, 5 Jan 2016 09:42:47 +0000 (10:42 +0100)
- Correct Host OS name on Windows 64 bit in common.py
- Add the missing Host OS in toolchain file for NDK r10e
- Downgrade to LLVM 3.5 when using Windows NDK r10e,
  because the prebuilt version 3.6 is missing the llvm-ar
  utility which is needed by the build script.

android/scripts/common.py
framework/delibs/cmake/toolchain-android-r10e.cmake

index 2611d9e..777d23f 100644 (file)
@@ -211,7 +211,7 @@ def getExtraBuildArgs (generator):
 
 NDK_HOST_OS_NAMES = [
        "windows",
-       "windows_x86-64",
+       "windows-x86_64",
        "darwin-x86",
        "darwin-x86_64",
        "linux-x86",
index 15245d8..dbba207 100644 (file)
@@ -140,7 +140,17 @@ if (DE_COMPILER STREQUAL "DE_COMPILER_GCC")
        set(TARGET_C_FLAGS              "-mandroid ${TARGET_C_FLAGS}")
 
 elseif (DE_COMPILER STREQUAL "DE_COMPILER_CLANG")
-       set(LLVM_PATH "${ANDROID_NDK_PATH}/toolchains/llvm-3.6/prebuilt/${ANDROID_NDK_HOST_OS}/")
+       if (NOT DEFINED LLVM_VERSION)
+               if (ANDROID_NDK_HOST_OS STREQUAL "windows" OR
+                       ANDROID_NDK_HOST_OS STREQUAL "windows-x86_64")
+                       # Windows NDK prebuilts don't include llvm-ar tool in version 3.6
+                       set(LLVM_VERSION "3.5")
+               else ()
+                       set(LLVM_VERSION "3.6")
+               endif ()
+       endif ()
+
+       set(LLVM_PATH "${ANDROID_NDK_PATH}/toolchains/llvm-${LLVM_VERSION}/prebuilt/${ANDROID_NDK_HOST_OS}/")
 
        if (ANDROID_NDK_HOST_OS STREQUAL "linux-x86" OR
                ANDROID_NDK_HOST_OS STREQUAL "linux-x86_64" OR
@@ -150,7 +160,8 @@ elseif (DE_COMPILER STREQUAL "DE_COMPILER_CLANG")
                cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++"              Clang)
                set(CMAKE_AR "${LLVM_PATH}/bin/llvm-ar" CACHE FILEPATH "Archiver")
                set(CMAKE_RANLIB "${CROSS_COMPILE}ranlib" CACHE FILEPATH "Indexer")
-       elseif (ANDROID_NDK_HOST_OS STREQUAL "windows")
+       elseif (ANDROID_NDK_HOST_OS STREQUAL "windows" OR
+                       ANDROID_NDK_HOST_OS STREQUAL "windows-x86_64")
                cmake_force_c_compiler("${LLVM_PATH}bin/clang.exe"              Clang)
                cmake_force_cxx_compiler("${LLVM_PATH}bin/clang++.exe"  Clang)
                set(CMAKE_AR "${LLVM_PATH}bin/llvm-ar.exe" CACHE FILEPATH "Archiver")