Add sensible defaults for Android to reduce clutter of command line

* The windows command will now be:
  cmake -G "MinGW Makefiles" -DBUILD_ANDROID=On <...>
* The linux command will just be:
  cmake -DBUILD_ANDROID=On <...>
* With the rest of the parameters specified as normal. An optional
  -DANDROID_ABI can be passed to specify the ABI
This commit is contained in:
baldurk
2016-09-27 14:29:40 +02:00
parent 966ffe9be4
commit 711860b338
+47
View File
@@ -1,5 +1,25 @@
cmake_minimum_required(VERSION 2.8.12)
# Configure some stuff that needs to be set really early
if(BUILD_ANDROID)
set(CMAKE_TOOLCHAIN_FILE
"${CMAKE_SOURCE_DIR}/scripts/android.toolchain.cmake"
CACHE STRING
"The Android toolchain file")
# Default to arm64 if nothing is specified on the command line.
set(ANDROID_ABI "arm64-v8a" CACHE STRING "The Android ABI to build for")
# This will be overridden later, we just need to set it now so that the
# configuration will continue on to where the toolchain is available
if(WIN32)
set(CMAKE_MAKE_PROGRAM
"android-make-not-found"
CACHE STRING
"The path to the NDK's make.exe to use")
endif()
endif()
# disallow in-source builds because we have a top-level wrapper Makefile
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
message(FATAL_ERROR "In-source builds not allowed")
@@ -34,6 +54,33 @@ if(WIN32)
message(FATAL_ERROR "CMake is not needed on Windows, just open and build renderdoc.sln")
endif()
if(ANDROID)
message(STATUS "Disabling GL driver on android - no support for EGL/GLES")
set(ENABLE_GL OFF CACHE BOOL "" FORCE)
# Android doesn't support the Qt UI for obvious reasons
message(STATUS "Disabling qrenderdoc for android build")
set(ENABLE_QRENDERDOC OFF CACHE BOOL "" FORCE)
message(STATUS "Using Android ABI ${ANDROID_ABI}")
message(STATUS "Using Android native API level ${ANDROID_NATIVE_API_LEVEL}")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
set(MAKE_SEARCH_DIRS "windows-x86_64" "windows")
# For windows, we need to use the make program in the NDK
foreach(dir ${MAKE_SEARCH_DIRS})
set(__makepath "${ANDROID_NDK}/prebuilt/${dir}/bin/make.exe")
if( EXISTS "${__makepath}" )
set(CMAKE_MAKE_PROGRAM "${__makepath}" CACHE STRING "" FORCE)
break()
endif()
endforeach()
message(STATUS "Using build tool ${CMAKE_MAKE_PROGRAM}")
endif()
endif()
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")