Unverified Commit 7628d844 authored by Nathaniel R. Lewis's avatar Nathaniel R. Lewis Committed by Jean-Marc Valin
Browse files

CMake Changes



    - Fix typo in OPUS_USE_NEON description.

    - Set OPUS_PRESUME_NEON for iOS platforms as all armv7 and higher
      iOS devices support NEON.

    - Fix detection of aarch64 for OPUS_CPU_ARM and adding sources from
      celt_sources_arm. (previously would miss armcpu.c and arm_celt_map.c)

    - Change "armv7-a" to "arm" in MATCHES checks against
      CMAKE_SYSTEM_PROCESSOR as systems like the RPi3 report as
      "armv7l".

    - Rename OPUS_MAY_SUPPORT_NEON to OPUS_MAY_HAVE_NEON as this name is
      used everywhere else in the CMake build system. Without this,
      runtime capability detection is broken on aarch64.
Signed-off-by: Jean-Marc Valin's avatarJean-Marc Valin <jmvalin@jmvalin.ca>
parent 4fc7d874
......@@ -353,7 +353,7 @@ if(MSVC)
endif()
endif()
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(armv7-a)")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm|aarch64)")
add_sources_group(opus celt ${celt_sources_arm})
endif()
......
......@@ -26,7 +26,7 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "(i[0-9]86|x86|X86|amd64|AMD64|x86_64)")
else()
set(OPUS_CPU_X86 1)
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm|aarch64)")
set(OPUS_CPU_ARM 1)
endif()
......@@ -37,11 +37,13 @@ if(OPUS_CPU_X86 OR OPUS_CPU_X64)
elseif(OPUS_CPU_ARM)
opus_detect_neon(COMPILER_SUPPORT_NEON)
if(COMPILER_SUPPORT_NEON)
option(OPUS_USE_NEON "Option to turn off SSE" ON)
option(OPUS_MAY_SUPPORT_NEON "Does runtime check for neon support" ON)
option(OPUS_USE_NEON "Option to enable NEON" ON)
option(OPUS_MAY_HAVE_NEON "Does runtime check for neon support" ON)
option(OPUS_PRESUME_NEON "Assume target CPU has NEON support" OFF)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64")
set(OPUS_PRESUME_NEON ON)
elseif(CMAKE_SYSTEM_NAME MATCHES "iOS")
set(OPUS_PRESUME_NEON ON)
endif()
endif()
endif()
......@@ -192,7 +192,7 @@ function(opus_detect_sse COMPILER_SUPPORT_SIMD)
endfunction()
function(opus_detect_neon COMPILER_SUPPORT_NEON)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(armv7-a|aarch64)")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm|aarch64)")
message(STATUS "Check NEON support by compiler")
check_include_file(arm_neon.h HAVE_ARM_NEON_H)
if(HAVE_ARM_NEON_H)
......@@ -209,6 +209,12 @@ function(opus_supports_cpu_detection RUNTIME_CPU_CAPABILITY_DETECTION)
endif()
if(HAVE_INTRIN_H OR HAVE_CPUID_H)
set(RUNTIME_CPU_CAPABILITY_DETECTION 1 PARENT_SCOPE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(arm|aarch64)")
# ARM cpu detection is implemented for Windows and anything
# using a Linux kernel (such as Android).
if (CMAKE_SYSTEM_NAME MATCHES "(Windows|Linux|Android)")
set(RUNTIME_CPU_CAPABILITY_DETECTION 1 PARENT_SCOPE)
endif ()
else()
set(RUNTIME_CPU_CAPABILITY_DETECTION 0 PARENT_SCOPE)
endif()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment