Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve Robinson!)
authorSylvain Becker <sylvain.becker@gmail.com>
Fri, 15 May 2020 21:12:23 +0200
changeset 13810f1127e895e08
parent 13809 c40934185184
child 13811 eff2d605bef5
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
     1.1 --- a/CMakeLists.txt	Thu May 14 21:54:51 2020 -0400
     1.2 +++ b/CMakeLists.txt	Fri May 15 21:12:23 2020 +0200
     1.3 @@ -945,7 +945,7 @@
     1.4  # Platform-specific options and settings
     1.5  if(ANDROID)
     1.6    file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
     1.7 -  set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES})
     1.8 +  set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES} ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
     1.9  
    1.10    # SDL_spinlock.c Needs to be compiled in ARM mode.
    1.11    # There seems to be no better way currently to set the ARM mode.
    1.12 @@ -2136,7 +2136,9 @@
    1.13    set(_INSTALL_LIBS "SDL2" ${_INSTALL_LIBS})
    1.14    target_link_libraries(SDL2 ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
    1.15    target_include_directories(SDL2 PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
    1.16 -  if (NOT ANDROID)
    1.17 +  if(ANDROID)
    1.18 +    target_include_directories(SDL2 PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
    1.19 +  else()
    1.20      set_target_properties(SDL2 PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
    1.21    endif()
    1.22    if(IOS OR TVOS)
    1.23 @@ -2182,7 +2184,9 @@
    1.24    set(_INSTALL_LIBS "SDL2-static" ${_INSTALL_LIBS})
    1.25    target_link_libraries(SDL2-static ${EXTRA_LIBS} ${EXTRA_LDFLAGS})
    1.26    target_include_directories(SDL2-static PUBLIC "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
    1.27 -  if (NOT ANDROID)
    1.28 +  if(ANDROID)
    1.29 +    target_include_directories(SDL2-static PRIVATE ${ANDROID_NDK}/sources/android/cpufeatures)
    1.30 +  else()
    1.31      set_target_properties(SDL2-static PROPERTIES DEBUG_POSTFIX "${SDL_CMAKE_DEBUG_POSTFIX}")
    1.32    endif()
    1.33    if(IOS OR TVOS)