From 802bbe87adc52daa92ddd963e498c6c5ab845bfc Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Fri, 10 Apr 2020 10:32:11 +0200 Subject: [PATCH] Fix extra warnings in Android build --- .travis.yml | 2 +- drivers/vulkan/SCsub | 8 ++++++++ platform/android/vulkan/vulkan_context_android.cpp | 8 -------- thirdparty/vulkan/android/vk_mem_alloc.cpp | 8 ++++++++ 4 files changed, 17 insertions(+), 9 deletions(-) create mode 100644 thirdparty/vulkan/android/vk_mem_alloc.cpp diff --git a/.travis.yml b/.travis.yml index 9a16dbc19bb..8cfd7a1a7f8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -57,7 +57,7 @@ matrix: - name: Android export template (release_debug, Clang) stage: build - env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="werror=yes" + env: PLATFORM=android TOOLS=no TARGET=release_debug CACHE_NAME=${PLATFORM}-clang EXTRA_ARGS="warnings=extra werror=yes" os: linux compiler: clang addons: diff --git a/drivers/vulkan/SCsub b/drivers/vulkan/SCsub index 35c2d61530b..91d0e42f80b 100644 --- a/drivers/vulkan/SCsub +++ b/drivers/vulkan/SCsub @@ -14,6 +14,14 @@ if env["platform"] == "android": thirdparty_dir + "/layers/generated", ] env.Prepend(CPPPATH=thirdparty_includes) + + # Build Vulkan memory allocator + env_thirdparty = env.Clone() + env_thirdparty.disable_warnings() + + thirdparty_dir = "#thirdparty/vulkan" + vma_sources = [thirdparty_dir + "/android/vk_mem_alloc.cpp"] + env_thirdparty.add_source_files(env.drivers_sources, vma_sources) elif env["builtin_vulkan"]: # Use bundled Vulkan headers thirdparty_dir = "#thirdparty/vulkan" diff --git a/platform/android/vulkan/vulkan_context_android.cpp b/platform/android/vulkan/vulkan_context_android.cpp index b238f849fc4..5fb7a83da4e 100644 --- a/platform/android/vulkan/vulkan_context_android.cpp +++ b/platform/android/vulkan/vulkan_context_android.cpp @@ -31,14 +31,6 @@ #include "vulkan_context_android.h" #include -#define VMA_IMPLEMENTATION -#ifdef DEBUG_ENABLED -#ifndef _DEBUG -#define _DEBUG -#endif -#endif -#include - const char *VulkanContextAndroid::_get_platform_surface_extension() const { return VK_KHR_ANDROID_SURFACE_EXTENSION_NAME; } diff --git a/thirdparty/vulkan/android/vk_mem_alloc.cpp b/thirdparty/vulkan/android/vk_mem_alloc.cpp new file mode 100644 index 00000000000..a28454cf6ed --- /dev/null +++ b/thirdparty/vulkan/android/vk_mem_alloc.cpp @@ -0,0 +1,8 @@ +#define VMA_IMPLEMENTATION +#ifdef DEBUG_ENABLED +#ifndef _DEBUG +#define _DEBUG +#endif +#endif +// Include memory allocator from Android NDK +#include