Update android-build/cmake scripts to build with Android Studio 3.0.0+
diff --git a/build-android/cmake/README.md b/build-android/cmake/README.md
index 70f68cd..149966c 100644
--- a/build-android/cmake/README.md
+++ b/build-android/cmake/README.md
@@ -1,7 +1,9 @@
-Build Validation Layers with Android CMake
-=========================================
-Gradle's CMake library project in this directory builds layers into AAR;
-the project could be directly added into application's gradle projects
+Build Validation Layers with Android CMake Plugin
+=================================================
+Gradle project in this directory builds layers into AAR.
+The project could be directly added into application's gradle projects.
+[Android Studio 3.0.0+](https://developer.android.com/studio/index.html)
+IS required: earlier versions only publish release libs by default.
Pre-requirements
----------------
@@ -14,21 +16,21 @@
Extra Steps if building from NDK's source tree
```
cd ${your ANDROID_NDK_ROOT}/sources/third_party/shaderc
- ndk-build APP_ABI=armeabi-v7a APP_STL=gnustl_static NDK_TOOLCHAIN_VERSION=clang NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk libshaderc_combined
+ ndk-build APP_ABI=all APP_STL=c++_static NDK_TOOLCHAIN_VERSION=clang NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk libshaderc_combined
```
Adding layer module into Android Studio application project
--------------------------------------------------------
1. app's settings.gradle, add
-```java
+```
include ':layerLib'
project(':layerLib').projectDir = new File('/path/to/cmake/layerlib')
```
2. app's build.gradle:
-```java
+```
dependencies {
- // force debug layer lib for packing
- compile project(path: ':layerlib', configuration: 'debug')
+ // Android Studio 3.0.0+ is required
+ implementation project(':layerLib')
}
```
BUILD_IN_NDK variable in layerlib/CMakeLists.txt could detect whether the source is
@@ -36,5 +38,6 @@
Tested
-----
- Build on Mac OS, Nexus 5X test phone. Equvilaent build scripts for Windows OS are at the same directory.
+Build on Mac OS, tested on Google Pixel XL with Android Oreo.
+Equvilaent build scripts for Windows OS are at the same directory.
diff --git a/build-android/cmake/layerlib/CMakeLists.txt b/build-android/cmake/layerlib/CMakeLists.txt
index cb586cd..3981e31 100644
--- a/build-android/cmake/layerlib/CMakeLists.txt
+++ b/build-android/cmake/layerlib/CMakeLists.txt
@@ -32,9 +32,9 @@
# ${SRC_DIR}
# ${SRC_DIR}/build-android/external (for glslang, spirv-tools & shaderc )
get_filename_component(SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../.." ABSOLUTE)
- set(EXTERNAL_DIR "${SRC_DIR}/build-android/third_party")
+ set(EXTERNAL_DIR "${SRC_DIR}/build-android/third_party/shaderc/third_party")
set(SPIRV_LIB
- "${EXTERNAL_DIR}/shaderc/android_test/obj/local/${ANDROID_ABI}/libSPIRV-Tools.a")
+ "${SRC_DIR}/build-android/third_party/shaderc/android_test/obj/local/${ANDROID_ABI}/libSPIRV-Tools.a")
endif()
set(COMMON_DIR "${SRC_DIR}/build-android/generated")
@@ -90,6 +90,7 @@
add_library(VkLayer_object_tracker SHARED
${COMMON_DIR}/include/object_tracker.cpp
+ ${SRC_DIR}/layers/object_tracker_utils.cpp
${SRC_DIR}/layers/vk_layer_table.cpp)
target_include_directories(VkLayer_object_tracker PRIVATE
${SRC_DIR}/include
diff --git a/build-android/cmake/layerlib/build.gradle b/build-android/cmake/layerlib/build.gradle
index efa8472..889d232 100644
--- a/build-android/cmake/layerlib/build.gradle
+++ b/build-android/cmake/layerlib/build.gradle
@@ -2,16 +2,9 @@
android {
/*
- * we are interested in only the debug version of layers, so ONLY publish debug version
- * library, which will enforce building ONLY debug version, and packing only the debug
- * version of layers. The document is at:
- * https://developer.android.com/studio/build/build-variants.html
- * http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Library-Publication
+ * Required: Android Studio 3.0.0+!
*/
- publishNonDefault true
-
compileSdkVersion 25
- buildToolsVersion "25.0.2"
defaultConfig {
minSdkVersion 24
@@ -21,7 +14,7 @@
ndk.abiFilters 'armeabi-v7a', 'arm64-v8a', 'x86', 'x86_64'
externalNativeBuild {
cmake.arguments '-DANDROID_TOOLCHAIN=clang',
- '-DANDROID_STL=gnustl_static',
+ '-DANDROID_STL=c++_static',
'-DANDROID_PLATFORM=android-24'
}
}