summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
authorChun-wei Fan <fanchunwei@src.gnome.org>2020-01-14 16:59:45 +0800
committerChun-wei Fan <fanchunwei@src.gnome.org>2020-01-15 11:02:48 +0800
commitad937bca10be979cc468b8da0d31f40f86ce0851 (patch)
tree32039d6ea9b00ff35ffe20ab10c837b7dfbde7ce /meson.build
parentfbc3657b769bfa156927a6a116d5967d58b5e75e (diff)
downloadgobject-introspection-ad937bca10be979cc468b8da0d31f40f86ce0851.tar.gz
Visual Studio builds: Use -utf-8 where available
This avoids compilation erroring out on C4819 (Unicode handling issue in the Visual Studio compiler), notably when running on Chinese, Japanese and Korean (CJK) locales. This also applies -utf-8 into the cflags passed into the various g-ir-scanner command lines that are used to generate the *.gir files, where -utf-8 is available, so that we don't get flooded with C4819 warnings during the build, and therefore avoid potential mishaps, as C4819 is a real warning that warngs us the code may be incorrectly built.
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build9
1 files changed, 9 insertions, 0 deletions
diff --git a/meson.build b/meson.build
index 031af630..1c232750 100644
--- a/meson.build
+++ b/meson.build
@@ -66,12 +66,21 @@ if cc.get_id() != 'msvc'
else
project_c_args += [
'-FImsvc_recommended_pragmas.h',
+ '-utf-8',
]
endif
project_c_args = cc.get_supported_arguments(project_c_args)
add_project_arguments(project_c_args, language: 'c')
+if cc.get_id() == 'msvc' and project_c_args.contains('-utf-8')
+ extra_giscanner_cflags = ['-utf-8']
+ extra_giscanner_args = ['--cflags-begin'] + extra_giscanner_cflags + ['--cflags-end']
+else
+ extra_giscanner_cflags = []
+ extra_giscanner_args = []
+endif
+
config = configuration_data()
config.set('GI_MAJOR_VERSION', gi_versions[0])