diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-07-24 11:31:14 +0800 |
---|---|---|
committer | Chun-wei Fan <fanchunwei@src.gnome.org> | 2019-11-18 16:19:36 +0800 |
commit | f251c12f8a64146ae698fc640b243c3d57450197 (patch) | |
tree | e9ac6a9fd50ea00a7790ba5f3ea1184baf469fcb | |
parent | 32a55aa8acb4048720e18fbbeaa6c7b398b1a081 (diff) | |
download | pixman-f251c12f8a64146ae698fc640b243c3d57450197.tar.gz |
meson.build: Fix MMX, SSE2 and SSSE3 checks on MSVC
-For MSVC builds, do not use the GCC-specific CFlags when checking for
these features.
-For the MMX check, assume that we have good enough MMX intrinsics and
inline assembly support (on ix86), since MSVC provides sufficient
support for those since before the times of MSVC 2008, and 2008 is the
oldest version that we can support, as with the pre-C99 GTK+ stack.
Unfortunately due to x64 compiler issues, pre-Visual Studio 2010 will
crash when building SSSE3 code, so we do not enable building SSSE3 code
on pre-2010 Visual Studio.
Also, for all x64 Visual Studio builds, we do not enable USE_X86_MMX
as inline assembly is not allowed for x64 Visual Studio builds, and
instead use the compatibility instrinsics that we already have in the
code.
-rw-r--r-- | meson.build | 27 |
1 files changed, 21 insertions, 6 deletions
diff --git a/meson.build b/meson.build index 2118abf..966058c 100644 --- a/meson.build +++ b/meson.build @@ -85,9 +85,12 @@ endif use_mmx = get_option('mmx') have_mmx = false -mmx_flags = ['-mmmx', '-Winline'] +mmx_flags = [] +if cc.get_id() != 'msvc' + mmx_flags = ['-mmmx', '-Winline'] +endif if not use_mmx.disabled() - if host_machine.cpu_family() == 'x86_64' + if host_machine.cpu_family() == 'x86_64' or cc.get_id() == 'msvc' have_mmx = true elif host_machine.cpu_family() == 'x86' and cc.compiles(''' #include <mmintrin.h> @@ -128,14 +131,21 @@ if not use_mmx.disabled() endif if have_mmx - config.set10('USE_X86_MMX', true) + # Inline assembly do not work on X64 MSVC, so we use + # compatibility intrinsics there + if cc.get_id() != 'msvc' or host_machine.cpu_family() != 'x86_64' + config.set10('USE_X86_MMX', true) + endif elif use_mmx.enabled() error('MMX Support unavailable, but required') endif use_sse2 = get_option('sse2') have_sse2 = false -sse2_flags = ['-msse2', '-Winline'] +sse2_flags = [] +if cc.get_id() != 'msvc' + sse2_flags = ['-msse2', '-Winline'] +endif if not use_sse2.disabled() if host_machine.cpu_family() == 'x86' if cc.compiles(''' @@ -170,8 +180,13 @@ endif use_ssse3 = get_option('ssse3') have_ssse3 = false -ssse3_flags =['-mssse3', '-Winline'] -if not use_ssse3.disabled() +ssse3_flags = [] +if cc.get_id() != 'msvc' + ssse3_flags = ['-mssse3', '-Winline'] +endif + +# x64 pre-2010 MSVC compilers crashes when building the ssse3 code +if not use_ssse3.disabled() and not (cc.get_id() == 'msvc' and cc.version().version_compare('<16') and host_machine.cpu_family() == 'x86_64') if host_machine.cpu_family().startswith('x86') if cc.compiles(''' #include <mmintrin.h> |