mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
meson: Mostly assume clang-cl is MSVC
We need to enable building the dirent and gnulib sources for clang-cl, as we are still using the Microsoft-style headers and lib's and CRT. We need to also do this for the following, for similar reasoning: -Symbol export (via __declspec(dllexport)) -Dependency discovery without pkg-config files -long long and ssize_t detection We do, however, enable the autoptr tests for clang-cl builds. Note that at this point real MSVC builds are still better supported than clang-cl builds, and it will likely remain so for at least the near future, alhtough real MSVC builds of the GTK stack are consumable and are usable by clang-cl.
This commit is contained in:
parent
b80c17e325
commit
e8d471f3e1
@ -97,7 +97,7 @@ test_env.set('GIO_LAUNCH_DESKTOP', meson.build_root() + '/gio/gio-launch-desktop
|
||||
# 1.2.14 required for dbus_message_set_serial
|
||||
dbus1_dep = dependency('dbus-1', required : false, version : '>= 1.2.14')
|
||||
if not dbus1_dep.found()
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
# MSVC: Search for the DBus library by the configuration, which corresponds
|
||||
# to the output of CMake builds of DBus. Note that debugoptimized
|
||||
# is really a Release build with .PDB files.
|
||||
@ -382,7 +382,7 @@ test_extra_programs += {
|
||||
},
|
||||
}
|
||||
|
||||
if cc.get_id() != 'msvc'
|
||||
if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
|
||||
test_extra_programs += {
|
||||
# These three are manual-run tests because they need a session bus but don't bring one up themselves
|
||||
# FIXME: these build but don't seem to work!
|
||||
|
@ -96,7 +96,7 @@ else
|
||||
gl_cv_func_frexp_works = false
|
||||
gl_cv_func_frexp_broken_beyond_repair = true
|
||||
elif host_system == 'windows'
|
||||
if cc.get_id () == 'msvc'
|
||||
if cc.get_id () == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
gl_cv_func_frexp_works = true
|
||||
gl_cv_func_frexp_broken_beyond_repair = false
|
||||
else
|
||||
|
@ -70,7 +70,7 @@ else
|
||||
gl_cv_func_printf_directive_f = false
|
||||
elif host_system == 'windows'
|
||||
# Guess yes on MSVC, no on mingw.
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
gl_cv_func_printf_directive_f = true
|
||||
else
|
||||
gl_cv_func_printf_directive_f = false
|
||||
|
@ -123,7 +123,7 @@ else
|
||||
gl_cv_func_printf_infinite = true
|
||||
elif host_system.startswith ('windows')
|
||||
# Guess yes on MSVC, no on mingw.
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
gl_cv_func_printf_infinite = true
|
||||
else
|
||||
gl_cv_func_printf_infinite = false
|
||||
|
@ -195,7 +195,7 @@ if gl_cv_func_printf_long_double
|
||||
gl_cv_func_printf_infinite_long_double = 'true'
|
||||
elif host_system == 'windows'
|
||||
# Guess yes on MSVC, no on mingw.
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
gl_cv_func_printf_infinite = 'true'
|
||||
else
|
||||
gl_cv_func_printf_infinite = 'false'
|
||||
|
@ -39,7 +39,7 @@ else
|
||||
gl_cv_func_printf_long_double = false
|
||||
elif host_system == 'windows'
|
||||
# Guess yes on MSVC, no on mingw.
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
gl_cv_func_printf_long_double = true
|
||||
else
|
||||
gl_cv_func_printf_long_double = false
|
||||
|
@ -309,7 +309,7 @@ if host_system == 'windows'
|
||||
glib_sources += [glib_win_res]
|
||||
glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c')
|
||||
platform_deps = [winsock2, cc.find_library('winmm')]
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
glib_sources += files('dirent/wdirent.c')
|
||||
endif
|
||||
else
|
||||
|
@ -45,7 +45,7 @@ if g_module_impl == 'G_MODULE_IMPL_DL'
|
||||
# FIXME: check for OSF1/5.0 RTLD_GLOBAL brokenness (is this still relevant?)
|
||||
|
||||
# Check whether we need preceding underscores
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
message('Building for MSVC: assuming that symbols are prefixed with underscore')
|
||||
g_module_need_uscore = 1
|
||||
elif meson.has_exe_wrapper()
|
||||
|
16
meson.build
16
meson.build
@ -117,7 +117,7 @@ if host_system == 'windows'
|
||||
glib_conf.set('BROKEN_POLL', true)
|
||||
endif
|
||||
|
||||
if host_system == 'windows' and cc.get_id() != 'msvc'
|
||||
if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
|
||||
# FIXME: Ideally we shouldn't depend on this on Windows and should use
|
||||
# 64 bit capable Windows API that also works with MSVC.
|
||||
# The autotools build did set this for mingw and while meson sets it
|
||||
@ -171,7 +171,7 @@ glib_hidden_visibility_args = []
|
||||
if get_option('default_library') != 'static'
|
||||
if host_system == 'windows' or host_system == 'cygwin'
|
||||
glib_conf.set('DLL_EXPORT', true)
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
glib_conf.set('_GLIB_EXTERN', '__declspec(dllexport) extern')
|
||||
elif cc.has_argument('-fvisibility=hidden')
|
||||
glib_conf.set('_GLIB_EXTERN', '__attribute__((visibility("default"))) __declspec(dllexport) extern')
|
||||
@ -773,7 +773,7 @@ have_good_vsnprintf = false
|
||||
have_good_snprintf = false
|
||||
have_good_printf = false
|
||||
|
||||
if host_system == 'windows' and cc.get_id() == 'msvc'
|
||||
if host_system == 'windows' and (cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl')
|
||||
# Unfortunately the Visual Studio 2015+ implementations of C99-style
|
||||
# snprintf and vsnprintf don't seem to be quite good enough.
|
||||
# (Sorry, I don't know exactly what is the problem,
|
||||
@ -1122,7 +1122,7 @@ else
|
||||
long_long_size = 0
|
||||
endif
|
||||
sizet_size = cc.sizeof('size_t')
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
ssizet_size = cc.sizeof('SSIZE_T', prefix : '#include <BaseTsd.h>')
|
||||
else
|
||||
ssizet_size = cc.sizeof('ssize_t')
|
||||
@ -1595,7 +1595,7 @@ atomicdefine = '''
|
||||
'''
|
||||
|
||||
# We know that we can always use real ("lock free") atomic operations with MSVC
|
||||
if cc.get_id() == 'msvc' or cc.links(atomictest, name : 'atomic ops')
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl' or cc.links(atomictest, name : 'atomic ops')
|
||||
have_atomic_lock_free = true
|
||||
if (host_system == 'android' or host_system == 'linux') and not cc.compiles(atomicdefine, name : 'atomic ops define')
|
||||
# When building for armv5 on Linux, gcc provides
|
||||
@ -1725,7 +1725,7 @@ if get_option('internal_pcre')
|
||||
else
|
||||
pcre = dependency('libpcre', version: '>= 8.31', required : false) # Should check for Unicode support, too. FIXME
|
||||
if not pcre.found()
|
||||
if cc.get_id() == 'msvc'
|
||||
if cc.get_id() == 'msvc' or cc.get_id() == 'clang-cl'
|
||||
# MSVC: Search for the PCRE library by the configuration, which corresponds
|
||||
# to the output of CMake builds of PCRE. Note that debugoptimized
|
||||
# is really a Release build with .PDB files.
|
||||
@ -1768,7 +1768,7 @@ libffi_dep = dependency('libffi', version : '>= 3.0.0', fallback : ['libffi', 'f
|
||||
# the system
|
||||
libz_dep = dependency('zlib', required : false)
|
||||
if not libz_dep.found()
|
||||
if cc.get_id() != 'msvc'
|
||||
if cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
|
||||
libz_dep = cc.find_library('z', required : false)
|
||||
else
|
||||
libz_dep = cc.find_library('zlib1', required : false)
|
||||
@ -1980,7 +1980,7 @@ endif
|
||||
|
||||
win32_cflags = []
|
||||
win32_ldflags = []
|
||||
if host_system == 'windows' and cc.get_id() != 'msvc'
|
||||
if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-cl'
|
||||
# Ensure MSVC-compatible struct packing convention is used when
|
||||
# compiling for Win32 with gcc. It is used for the whole project and exposed
|
||||
# in glib-2.0.pc.
|
||||
|
Loading…
Reference in New Issue
Block a user