Skip to content

Commit

Permalink
Fixed bug 5100 - compilation CMake Android armeabi-v7a (Thanks Steve …
Browse files Browse the repository at this point in the history
…Robinson!)

fatal error: 'cpu-features.h' file not found on CMake Android armeabi-v7a
  • Loading branch information
1bsyl committed May 15, 2020
1 parent d31dac1 commit 5b65e0a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions CMakeLists.txt
Expand Up @@ -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.
Expand Down Expand Up @@ -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 "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
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)
Expand Down Expand Up @@ -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 "$<BUILD_INTERFACE:${SDL2_SOURCE_DIR}/include>" $<INSTALL_INTERFACE:include> $<INSTALL_INTERFACE:include/SDL2>)
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)
Expand Down

0 comments on commit 5b65e0a

Please sign in to comment.