shithub: libvpx

Download patch

ref: 3a56c238ee82604b2d420d858f4edfa28af4e6eb
parent: fa1e85b095d08d7a5408652c86dd50700114d36a
author: Jon Kunkee <jkunkee@microsoft.com>
date: Wed Nov 14 20:27:42 EST 2018

Work around ARM64 Windows SDK arm_neon.h quirk

Since the Windows SDK has an ARM32-only arm_neon.h, files including it
during ARM64 Windows builds need to be redirected to arm64_neon.h.

Instead of editing many files to include ARM64-Windows-specific ifdef
logic, this commit introduces an ARM64-Windows-specific version of
arm_neon.h that performs the needed redirection and lands earlier in
the header search path than the ARM32-only arm_neon.h.

Change-Id: Idc63947a238ca1bd0c479d8f4ad68950487947c6

--- a/.gitignore
+++ b/.gitignore
@@ -20,6 +20,7 @@
 /.install-*
 /.libs
 /Makefile
+/arm_neon.h
 /config.log
 /config.mk
 /docs/
--- a/build/make/Makefile
+++ b/build/make/Makefile
@@ -99,6 +99,7 @@
       rm -f Makefile; \
       rm -f config.log config.mk; \
       rm -f vpx_config.[hc] vpx_config.asm; \
+      rm -f arm_neon.h; \
     else \
       rm -f $(target)-$(TOOLCHAIN).mk; \
     fi
--- a/build/make/configure.sh
+++ b/build/make/configure.sh
@@ -546,6 +546,24 @@
   cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1"
 }
 
+write_win_arm64_neon_h_workaround() {
+  print_webm_license ${TMP_H} "/*" " */"
+  cat >> ${TMP_H} << EOF
+/* This file automatically generated by configure. Do not edit! */
+#ifndef VPX_WIN_ARM_NEON_H_WORKAROUND
+#define VPX_WIN_ARM_NEON_H_WORKAROUND
+/* The Windows SDK has arm_neon.h, but unlike on other platforms it is
+ * ARM32-only. ARM64 NEON support is provided by arm64_neon.h, a proper
+ * superset of arm_neon.h. Work around this by providing a more local
+ * arm_neon.h that simply #includes arm64_neon.h.
+ */
+#include <arm64_neon.h>
+#endif /* VPX_WIN_ARM_NEON_H_WORKAROUND */
+EOF
+  mkdir -p `dirname "$1"`
+  cmp "$1" ${TMP_H} >/dev/null 2>&1 || mv ${TMP_H} "$1"
+}
+
 process_common_cmdline() {
   for opt in "$@"; do
     optval="${opt#*=}"
@@ -1027,12 +1045,25 @@
               disable_feature examples
               disable_feature tools
             fi
-          #else
+          else
             # Windows 10 on ARM, on the other hand, has full Windows SDK support
             # for building Win32 ARM64 applications in addition to ARM64
             # Windows Store apps. It is the only 64-bit ARM ABI that
             # Windows supports, so it is the default definition of 'win64'.
             # ARM64 build support officially shipped in Visual Studio 15.9.0.
+
+            # Because the ARM64 Windows SDK's arm_neon.h is ARM32-specific
+            # while LLVM's is not, probe its validity.
+            if enabled neon; then
+              if [ -n "${CC}" ]; then
+                check_header arm_neon.h || check_header arm64_neon.h && \
+                    enable_feature win_arm64_neon_h_workaround
+              else
+                # If a probe is not possible, assume this is the pure Windows
+                # SDK and so the workaround is necessary.
+                enable_feature win_arm64_neon_h_workaround
+              fi
+            fi
           fi
           ;;
         rvct)
--- a/configure
+++ b/configure
@@ -449,6 +449,7 @@
     enabled child || write_common_config_banner
     write_common_target_config_h ${BUILD_PFX}vpx_config.h
     write_common_config_targets
+    enabled win_arm64_neon_h_workaround && write_win_arm64_neon_h_workaround ${BUILD_PFX}arm_neon.h
 
     # Calculate the default distribution name, based on the enabled features
     cf=""