From 5b65e0af01873e26673c11da43001e7075986290 Mon Sep 17 00:00:00 2001 From: Sylvain Becker Date: Fri, 15 May 2020 21:12:23 +0200 Subject: [PATCH] Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve Robinson!) fatal error: 'cpu-features.h' file not found on CMake Android armeabi-v7a --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 64bf067eb..b5f1d55ab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -945,7 +945,7 @@ endif() # Platform-specific options and settings if(ANDROID) file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c) - set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES}) + set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) # SDL_spinlock.c Needs to be compiled in ARM mode. # There seems to be no better way currently to set the ARM mode. @@ -2136,7 +2136,9 @@ if(SDL_SHARED) set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS}) target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_include_directories(SDL2 PUBLIC "$" $ $) - if (NOT ANDROID) + if(ANDROID) + target_include_directories(SDL2 PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures) + else() set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() if(IOS OR TVOS) @@ -2182,7 +2184,9 @@ if(SDL_STATIC) set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS}) target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS}) target_include_directories(SDL2-static PUBLIC "$" $ $) - if (NOT ANDROID) + if(ANDROID) + target_include_directories(SDL2-static PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures) + else() set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}") endif() if(IOS OR TVOS)