Skip to content

Commit 711860b

Browse files
committed
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
1 parent 966ffe9 commit 711860b

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

CMakeLists.txt

+47
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,25 @@
11
cmake_minimum_required(VERSION 2.8.12)
22

3+
# Configure some stuff that needs to be set really early
4+
if(BUILD_ANDROID)
5+
set(CMAKE_TOOLCHAIN_FILE
6+
"${CMAKE_SOURCE_DIR}/scripts/android.toolchain.cmake"
7+
CACHE STRING
8+
"The Android toolchain file")
9+
10+
# Default to arm64 if nothing is specified on the command line.
11+
set(ANDROID_ABI "arm64-v8a" CACHE STRING "The Android ABI to build for")
12+
13+
# This will be overridden later, we just need to set it now so that the
14+
# configuration will continue on to where the toolchain is available
15+
if(WIN32)
16+
set(CMAKE_MAKE_PROGRAM
17+
"android-make-not-found"
18+
CACHE STRING
19+
"The path to the NDK's make.exe to use")
20+
endif()
21+
endif()
22+
323
# disallow in-source builds because we have a top-level wrapper Makefile
424
if(CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR)
525
message(FATAL_ERROR "In-source builds not allowed")
@@ -34,6 +54,33 @@ if(WIN32)
3454
message(FATAL_ERROR "CMake is not needed on Windows, just open and build renderdoc.sln")
3555
endif()
3656

57+
if(ANDROID)
58+
message(STATUS "Disabling GL driver on android - no support for EGL/GLES")
59+
set(ENABLE_GL OFF CACHE BOOL "" FORCE)
60+
61+
# Android doesn't support the Qt UI for obvious reasons
62+
message(STATUS "Disabling qrenderdoc for android build")
63+
set(ENABLE_QRENDERDOC OFF CACHE BOOL "" FORCE)
64+
65+
message(STATUS "Using Android ABI ${ANDROID_ABI}")
66+
message(STATUS "Using Android native API level ${ANDROID_NATIVE_API_LEVEL}")
67+
68+
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Windows")
69+
set(MAKE_SEARCH_DIRS "windows-x86_64" "windows")
70+
71+
# For windows, we need to use the make program in the NDK
72+
foreach(dir ${MAKE_SEARCH_DIRS})
73+
set(__makepath "${ANDROID_NDK}/prebuilt/${dir}/bin/make.exe")
74+
if( EXISTS "${__makepath}" )
75+
set(CMAKE_MAKE_PROGRAM "${__makepath}" CACHE STRING "" FORCE)
76+
break()
77+
endif()
78+
endforeach()
79+
80+
message(STATUS "Using build tool ${CMAKE_MAKE_PROGRAM}")
81+
endif()
82+
endif()
83+
3784
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
3885
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin")
3986

0 commit comments

Comments
 (0)