meson: Only check for _MSC_FULL_VER once

Prevents the log from filling with repeated calls to check the
value of the define.
This commit is contained in:
robxnano authored and Khaled Hosny committed 2025-04-13 02:59:31 +02:00
1 parent efcb7d3de1
commit e2a865f024
2 files changed
+9 -4

No files matched your search

+6 -1
View File
@@ -32,11 +32,16 @@ pkgmod = import('pkgconfig')
cpp = meson.get_compiler('cpp')
null_dep = dependency('', required: false)
# Includes Microsoft Clang compiler with GNU arguments, see
# https://github.com/harfbuzz/harfbuzz/pull/4394
cpp_is_microsoft_compiler = host_machine.system() == 'windows' and cpp.get_define('_MSC_FULL_VER') != ''
# Only perform these checks if cpp_std is c++11 as setting -std directly
# produces a warning from meson.
if get_option('cpp_std') == 'c++11'
# Enforce C++14 requirement for MSVC STL
if cpp.get_id() == 'clang' and cpp.get_define('_MSC_FULL_VER') != ''
if cpp.get_id() == 'clang' and cpp_is_microsoft_compiler
add_project_arguments('-std=c++14', language: 'cpp')
elif cpp.get_id() == 'clang-cl'
# Clang-cl produces a warning when using -std=c++14, but not when using /std:c++14
+3 -3
View File
@@ -599,7 +599,7 @@ defs_list = [harfbuzz_def]
version = '0.@0@.0'.format(hb_version_int)
extra_hb_cpp_args = []
if cpp.get_define('_MSC_FULL_VER') != ''
if cpp_is_microsoft_compiler
if get_option('default_library') != 'static'
extra_hb_cpp_args += '-DHB_DLL_EXPORT'
endif
@@ -721,7 +721,7 @@ if get_option('tests').enabled()
# TODO: Microsoft LINK gives the following because extern, non dllexport
# symbols can only be used when linking against a static library
# error LNK2019: unresolved external symbol "unsigned __int64 const * const _hb_NullPool"
if cpp.get_define('_MSC_FULL_VER') == ''
if not cpp_is_microsoft_compiler
noinst_programs = {
'main': 'main.cc',
'test-basics': 'test.cc',
@@ -768,7 +768,7 @@ if get_option('tests').enabled()
'test-unicode-ranges': ['test-unicode-ranges.cc'],
}
foreach name, source : compiled_tests
if cpp.get_define('_MSC_FULL_VER') != '' and source.contains('hb-static.cc')
if cpp_is_microsoft_compiler and source.contains('hb-static.cc')
# TODO: Microsoft compilers cannot link tests using hb-static.cc, fix them
continue
endif