From 72095ff35c269ef9c7643d3b444265c0d2df23a3 Mon Sep 17 00:00:00 2001 From: baldurk Date: Fri, 26 Mar 2021 12:00:53 +0000 Subject: [PATCH] Update cmake strip scripts on android to work with latest NDK --- CMakeLists.txt | 9 +++++++++ renderdoc/CMakeLists.txt | 5 ++--- renderdoccmd/CMakeLists.txt | 5 ++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c56b0e24a..2d854659e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -313,6 +313,15 @@ if(cmake_build_type_lower STREQUAL "release" OR set(RELEASE_MODE 1) endif() +if(STRIP_ANDROID_LIBRARY AND BUILD_ANDROID AND RELEASE_MODE) + set(ANDROID_STRIP_TOOL "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-strip${ANDROID_TOOLCHAIN_SUFFIX}") + if(NOT EXISTS "${ANDROID_STRIP_TOOL}") + set(ANDROID_STRIP_TOOL "${CMAKE_STRIP}") + endif() + + message(STATUS "libraries will be stripped with ${ANDROID_STRIP_TOOL}") +endif() + if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-strict-aliasing") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden -fvisibility-inlines-hidden") diff --git a/renderdoc/CMakeLists.txt b/renderdoc/CMakeLists.txt index f061e6c13..07989423e 100644 --- a/renderdoc/CMakeLists.txt +++ b/renderdoc/CMakeLists.txt @@ -607,12 +607,11 @@ if(ANDROID) # rename output library set_target_properties(renderdoc PROPERTIES OUTPUT_NAME "VkLayer_GLES_RenderDoc") - if(STRIP_ANDROID_LIBRARY AND CMAKE_STRIP AND RELEASE_MODE) - message(STATUS "renderdoc library will be stripped") + if(STRIP_ANDROID_LIBRARY AND ANDROID_STRIP_TOOL AND RELEASE_MODE) add_custom_command(TARGET renderdoc POST_BUILD COMMAND echo Stripping $ COMMAND ${CMAKE_COMMAND} -E copy $ $.dbg - COMMAND ${CMAKE_STRIP} --strip-unneeded $) + COMMAND ${ANDROID_STRIP_TOOL} --strip-unneeded $) endif() endif() diff --git a/renderdoccmd/CMakeLists.txt b/renderdoccmd/CMakeLists.txt index 737599332..29036f346 100644 --- a/renderdoccmd/CMakeLists.txt +++ b/renderdoccmd/CMakeLists.txt @@ -85,12 +85,11 @@ if(ANDROID) endif() message(STATUS "Using Java of version ${Java_VERSION}") - if(STRIP_ANDROID_LIBRARY AND CMAKE_STRIP AND RELEASE_MODE) - message(STATUS "renderdoccmd library will be stripped") + if(STRIP_ANDROID_LIBRARY AND ANDROID_STRIP_TOOL AND RELEASE_MODE) add_custom_command(TARGET renderdoccmd POST_BUILD COMMAND echo Stripping $ COMMAND ${CMAKE_COMMAND} -E copy $ $.dbg - COMMAND ${CMAKE_STRIP} --strip-unneeded $) + COMMAND ${ANDROID_STRIP_TOOL} --strip-unneeded $) endif() set(ANDROID_BUILD_TOOLS_VERSION "" CACHE STRING "Version of Android build-tools to use instead of the default")