CMakeLists.txt
changeset 13186 9bf7f9ba2bf4
parent 13102 f54a77124843
child 13262 d6decc5d2464
     1.1 --- a/CMakeLists.txt	Thu Oct 24 21:51:55 2019 -0400
     1.2 +++ b/CMakeLists.txt	Thu Oct 24 23:17:19 2019 -0400
     1.3 @@ -329,6 +329,8 @@
     1.4  set_option(SSE2                "Use SSE2 assembly routines" ${OPT_DEF_SSEMATH})
     1.5  set_option(SSE3                "Use SSE3 assembly routines" ${OPT_DEF_SSEMATH})
     1.6  set_option(ALTIVEC             "Use Altivec assembly routines" ${OPT_DEF_ASM})
     1.7 +set_option(ARMSIMD             "use SIMD assembly blitters on ARM" ON)
     1.8 +set_option(ARMNEON             "use NEON assembly blitters on ARM" ON)
     1.9  set_option(DISKAUDIO           "Support the disk writer audio driver" ON)
    1.10  set_option(DUMMYAUDIO          "Support the dummy audio driver" ON)
    1.11  set_option(VIDEO_DIRECTFB      "Use DirectFB video driver" OFF)
    1.12 @@ -671,6 +673,61 @@
    1.13          endif()
    1.14        endif()
    1.15      endif()
    1.16 +
    1.17 +    if(ARMSIMD)
    1.18 +      set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
    1.19 +      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
    1.20 +      check_c_source_compiles("
    1.21 +        .text
    1.22 +        .arch armv6
    1.23 +        .object_arch armv4
    1.24 +        .arm
    1.25 +        .altmacro
    1.26 +        #ifndef __ARM_EABI__
    1.27 +        #error EABI is required (to be sure that calling conventions are compatible)
    1.28 +        #endif
    1.29 +        pld [r0]
    1.30 +        uqadd8 r0, r0, r0
    1.31 +      " ARMSIMD_FOUND)
    1.32 +      set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
    1.33 +
    1.34 +      if(ARMSIMD_FOUND)
    1.35 +        set(HAVE_ARMSIMD TRUE)
    1.36 +        set(SDL_ARM_SIMD_BLITTERS 1)
    1.37 +        file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S)
    1.38 +        set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES})
    1.39 +        set(WARN_ABOUT_ARM_SIMD_ASM_MIT TRUE)
    1.40 +      endif()
    1.41 +    endif()
    1.42 +
    1.43 +    if(ARMNEON)
    1.44 +      set(ORIG_CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS}")
    1.45 +      set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -x assembler-with-cpp")
    1.46 +      check_c_source_compiles("
    1.47 +        .text
    1.48 +        .fpu neon
    1.49 +        .arch armv7a
    1.50 +        .object_arch armv4
    1.51 +        .eabi_attribute 10, 0
    1.52 +        .arm
    1.53 +        .altmacro
    1.54 +        #ifndef __ARM_EABI__
    1.55 +        #error EABI is required (to be sure that calling conventions are compatible)
    1.56 +        #endif
    1.57 +        pld [r0]
    1.58 +        vmovn.u16 d0, q0
    1.59 +      " ARMNEON_FOUND)
    1.60 +      set(CMAKE_REQUIRED_FLAGS "${ORIG_CMAKE_REQUIRED_FLAGS}")
    1.61 +
    1.62 +      if(ARMNEON_FOUND)
    1.63 +        set(HAVE_ARMNEON TRUE)
    1.64 +        set(SDL_ARM_NEON_BLITTERS 1)
    1.65 +        file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S)
    1.66 +        set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES})
    1.67 +        set(WARN_ABOUT_ARM_NEON_ASM_MIT TRUE)
    1.68 +      endif()
    1.69 +    endif()
    1.70 +
    1.71    elseif(MSVC_VERSION GREATER 1500)
    1.72      # TODO: SDL_cpuinfo.h needs to support the user's configuration wish
    1.73      # for MSVC - right now it is always activated
    1.74 @@ -1927,6 +1984,24 @@
    1.75    message(STATUS "")
    1.76  endif()
    1.77  
    1.78 +if(WARN_ABOUT_ARM_SIMD_ASM_MIT)
    1.79 +  message(STATUS "")
    1.80 +  message(STATUS "SDL is being built with ARM SIMD optimizations, which")
    1.81 +  message(STATUS "uses code licensed under the MIT license. If this is a")
    1.82 +  message(STATUS "problem, please disable that code by rerunning CMake with:")
    1.83 +  message(STATUS "")
    1.84 +  message(STATUS "    -DARMSIMD=OFF")
    1.85 +endif()
    1.86 +
    1.87 +if(WARN_ABOUT_ARM_NEON_ASM_MIT)
    1.88 +  message(STATUS "")
    1.89 +  message(STATUS "SDL is being built with ARM NEON optimizations, which")
    1.90 +  message(STATUS "uses code licensed under the MIT license. If this is a")
    1.91 +  message(STATUS "problem, please disable that code by rerunning CMake with:")
    1.92 +  message(STATUS "")
    1.93 +  message(STATUS "    -DARMNEON=OFF")
    1.94 +endif()
    1.95 +
    1.96  # Ensure that the extra cflags are used at compile time
    1.97  set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
    1.98