From e9db26898b8aae8737dddb11f5ba2abb6ec6ca5f Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Wed, 24 Jul 2019 13:36:12 +0800 Subject: meson.build: Disable OpenMP on MSVC builds The implementation of OpenMP is not compliant for our uses, so disable it for now by just not checking for it on MSVC builds, as we implicitly add an /openmp switch to the build, which will cause linking the tests programs to fail, as the OpenMP implementation is not enough. --- meson.build | 23 +++++++++++++++-------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/meson.build b/meson.build index 966058c..8f062bc 100644 --- a/meson.build +++ b/meson.build @@ -365,14 +365,21 @@ if get_option('gnuplot') config.set('PIXMAN_GNUPLOT', 1) endif -dep_openmp = dependency('openmp', required : get_option('openmp')) -if dep_openmp.found() - config.set10('USE_OPENMP', true) -elif meson.version().version_compare('<0.51.0') -# In versions of meson before 0.51 the openmp dependency can still -# inject arguments in the the auto case when it is not found, the -# detection does work correctly in that case however, so we just -# replace dep_openmp with null_dep to work around this. +if cc.get_id() != 'msvc' + dep_openmp = dependency('openmp', required : get_option('openmp')) + if dep_openmp.found() + config.set10('USE_OPENMP', true) + elif meson.version().version_compare('<0.51.0') + # In versions of meson before 0.51 the openmp dependency can still + # inject arguments in the the auto case when it is not found, the + # detection does work correctly in that case however, so we just + # replace dep_openmp with null_dep to work around this. + dep_openmp = null_dep + endif +else + # the MSVC implementation of openmp is not compliant enough for our + # uses here, so we disable it here. + # Please see: https://stackoverflow.com/questions/12560243/using-threadprivate-directive-in-visual-studio dep_openmp = null_dep endif -- cgit v1.2.1