| guanghuafan | b91d5df | 2018-01-03 11:13:15 -0800 | [diff] [blame] | 1 | Build Validation Layers with Android CMake Plugin |
| 2 | ================================================= |
| 3 | Gradle project in this directory builds layers into AAR. |
| 4 | The project could be directly added into application's gradle projects. |
| 5 | [Android Studio 3.0.0+](https://developer.android.com/studio/index.html) |
| 6 | IS required: earlier versions only publish release libs by default. |
| guanghuafan | d6eea09 | 2017-04-28 12:02:24 -0700 | [diff] [blame] | 7 | |
| 8 | Pre-requirements |
| 9 | ---------------- |
| 10 | Build ShaderC binary |
| 11 | - Building from Github Repo source |
| 12 | 1. cd android-build |
| 13 | 2. ./update_external_sources_android.sh |
| 14 | 3. ./android-generate.sh |
| 15 | |
| 16 | Extra Steps if building from NDK's source tree |
| 17 | ``` |
| 18 | cd ${your ANDROID_NDK_ROOT}/sources/third_party/shaderc |
| guanghuafan | b91d5df | 2018-01-03 11:13:15 -0800 | [diff] [blame] | 19 | ndk-build APP_ABI=all APP_STL=c++_static NDK_TOOLCHAIN_VERSION=clang NDK_PROJECT_PATH=. APP_BUILD_SCRIPT=Android.mk libshaderc_combined |
| guanghuafan | d6eea09 | 2017-04-28 12:02:24 -0700 | [diff] [blame] | 20 | ``` |
| 21 | |
| 22 | Adding layer module into Android Studio application project |
| 23 | -------------------------------------------------------- |
| 24 | 1. app's settings.gradle, add |
| guanghuafan | b91d5df | 2018-01-03 11:13:15 -0800 | [diff] [blame] | 25 | ``` |
| guanghuafan | d6eea09 | 2017-04-28 12:02:24 -0700 | [diff] [blame] | 26 | include ':layerLib' |
| 27 | project(':layerLib').projectDir = new File('/path/to/cmake/layerlib') |
| 28 | ``` |
| 29 | 2. app's build.gradle: |
| guanghuafan | b91d5df | 2018-01-03 11:13:15 -0800 | [diff] [blame] | 30 | ``` |
| guanghuafan | d6eea09 | 2017-04-28 12:02:24 -0700 | [diff] [blame] | 31 | dependencies { |
| guanghuafan | b91d5df | 2018-01-03 11:13:15 -0800 | [diff] [blame] | 32 | // Android Studio 3.0.0+ is required |
| 33 | implementation project(':layerLib') |
| guanghuafan | d6eea09 | 2017-04-28 12:02:24 -0700 | [diff] [blame] | 34 | } |
| 35 | ``` |
| 36 | BUILD_IN_NDK variable in layerlib/CMakeLists.txt could detect whether the source is |
| 37 | from NDK or github repo clone, and would configure the file paths accordingly |
| 38 | |
| 39 | Tested |
| 40 | ----- |
| guanghuafan | b91d5df | 2018-01-03 11:13:15 -0800 | [diff] [blame] | 41 | Build on Mac OS, tested on Google Pixel XL with Android Oreo. |
| 42 | Equvilaent build scripts for Windows OS are at the same directory. |
| guanghuafan | d6eea09 | 2017-04-28 12:02:24 -0700 | [diff] [blame] | 43 | |