Work around ARM64 Windows SDK arm_neon.h quirk
authorJon Kunkee <jkunkee@microsoft.com>
Thu, 15 Nov 2018 09:27:42 +0000 (01:27 -0800)
committerJon Kunkee <jkunkee@microsoft.com>
Fri, 16 Nov 2018 22:27:18 +0000 (22:27 +0000)
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

.gitignore
build/make/Makefile
build/make/configure.sh
configure

index bf5ffc713c83fce595d6ab995888076708b0a13d..5f26835386560b9e67dc02a02c75a8eac726ca5c 100644 (file)
@@ -20,6 +20,7 @@
 /.install-*
 /.libs
 /Makefile
+/arm_neon.h
 /config.log
 /config.mk
 /docs/
index f6b3f0630f14a0baf5eecdbb70ca1eec9b72b4e0..c070cd0e0c63ce819b893ccd09dfb713b57eeb3e 100644 (file)
@@ -99,6 +99,7 @@ distclean: clean
       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
index 179359e5dd9718827e4d77275368cc5f86361092..2622040531eb4d8fdf6eb0a0ccc6d1336a21739b 100644 (file)
@@ -546,6 +546,24 @@ EOF
   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 @@ EOF
               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)
index 966fedba4f7290bc4cded92bd2ceab6a161eb984..e0ffb55b4b5d9fca4c24b000f59f7f93d0e20d3f 100755 (executable)
--- a/configure
+++ b/configure
@@ -449,6 +449,7 @@ process_targets() {
     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=""