diff options
author | Paul Thomson <paulthomson@users.noreply.github.com> | 2021-09-28 13:28:55 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-28 14:28:55 +0100 |
commit | 93e89eed2c22deb62b2d0a46a2e376c5132775cd (patch) | |
tree | 638dac80320509529d7e7be043a92e28a7b17194 /third_party | |
parent | 6b3fcb0353533d1236035c4aa3b587be5d8b37cd (diff) | |
download | amber-93e89eed2c22deb62b2d0a46a2e376c5132775cd.tar.gz |
Update and improve android_gradle (#965)
* Update CMakeLists.txt files so we can build libamber_ndk.so for
Android via CMake.
* `android_gradle/`:
* Update Gradle version, settings, and build files to match the latest
Android sample. Importantly, this removes the use of jcenter and
bintray repositories, which were shut down.
* Specify NDK version so that Gradle can install required native build
tools automatically.
* Define externalNativeBuild so Gradle can perform the Android CMake
build automatically.
* Replace `main` with `android_main` when building the Amber tool as a
library for Android to avoid compiler warnings, and rename other
Android-related symbols to avoid confusion.
Fixes #964
Diffstat (limited to 'third_party')
-rw-r--r-- | third_party/CMakeLists.txt | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 897c666..410dc02 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -52,24 +52,28 @@ endif() if (${AMBER_USE_LOCAL_VULKAN}) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vulkan-headers) - set(BUILD_TESTS FALSE) - - # The vulkan-loader CMake file assumes that directory exists if - # Wayland support is to be built. - if(NOT EXISTS ${WAYLAND_CLIENT_INCLUDE_DIR}) - message(STATUS "Amber: Disabling Wayland support in Vulkan-Loader") - set(BUILD_WSI_WAYLAND_SUPPORT OFF CACHE BOOL "" FORCE) - endif() - message(STATUS "Amber: Disabling X11 support in Vulkan-Loader") - set(BUILD_WSI_XLIB_SUPPORT OFF CACHE BOOL "" FORCE) - - set(ROBIN_HOOD_HASHING_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/robin-hood-hashing" CACHE STRING "" FORCE) - - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vulkan-loader) - if (MSVC) - option(BUILD_WERROR "Treat compiler warnings as errors" OFF) + # Skip adding the validation layers and the Vulkan loader on Android. + if (NOT ANDROID) + + set(BUILD_TESTS FALSE) + + # The vulkan-loader CMake file assumes that directory exists if + # Wayland support is to be built. + if(NOT EXISTS ${WAYLAND_CLIENT_INCLUDE_DIR}) + message(STATUS "Amber: Disabling Wayland support in Vulkan-Loader") + set(BUILD_WSI_WAYLAND_SUPPORT OFF CACHE BOOL "" FORCE) + endif() + message(STATUS "Amber: Disabling X11 support in Vulkan-Loader") + set(BUILD_WSI_XLIB_SUPPORT OFF CACHE BOOL "" FORCE) + + set(ROBIN_HOOD_HASHING_INSTALL_DIR "${CMAKE_CURRENT_SOURCE_DIR}/robin-hood-hashing" CACHE STRING "" FORCE) + + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vulkan-loader) + if (MSVC) + option(BUILD_WERROR "Treat compiler warnings as errors" OFF) + endif() + add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vulkan-validationlayers) endif() - add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/vulkan-validationlayers) endif() if (${AMBER_ENABLE_VK_DEBUGGING}) |