From 3a56c238ee82604b2d420d858f4edfa28af4e6eb Mon Sep 17 00:00:00 2001 From: Jon Kunkee Date: Thu, 15 Nov 2018 01:27:42 -0800 Subject: [PATCH] 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 --- .gitignore | 1 + build/make/Makefile | 1 + build/make/configure.sh | 33 ++++++++++++++++++++++++++++++++- configure | 1 + 4 files changed, 35 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index bf5ffc713..5f2683538 100644 --- a/.gitignore +++ b/.gitignore @@ -20,6 +20,7 @@ /.install-* /.libs /Makefile +/arm_neon.h /config.log /config.mk /docs/ diff --git a/build/make/Makefile b/build/make/Makefile index f6b3f0630..c070cd0e0 100644 --- a/build/make/Makefile +++ b/build/make/Makefile @@ -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 diff --git a/build/make/configure.sh b/build/make/configure.sh index 179359e5d..262204053 100644 --- a/build/make/configure.sh +++ b/build/make/configure.sh @@ -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 +#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) diff --git a/configure b/configure index 966fedba4..e0ffb55b4 100755 --- 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="" -- 2.50.0