[gobject-introspection/msvc.fixes: 1/3] Visual Studio builds: Use -utf-8 where available
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/msvc.fixes: 1/3] Visual Studio builds: Use -utf-8 where available
- Date: Wed, 15 Jan 2020 07:48:45 +0000 (UTC)
commit ad937bca10be979cc468b8da0d31f40f86ce0851
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Tue Jan 14 16:59:45 2020 +0800
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.
gir/meson.build | 10 +++++-----
meson.build | 9 +++++++++
tests/meson.build | 2 ++
tests/offsets/meson.build | 1 +
tests/scanner/meson.build | 11 +++++++++++
5 files changed, 28 insertions(+), 5 deletions(-)
---
diff --git a/gir/meson.build b/gir/meson.build
index 4ee224c7..a0b96cfd 100644
--- a/gir/meson.build
+++ b/gir/meson.build
@@ -196,7 +196,7 @@ glib_gir = custom_target('gir-glib',
install: true,
install_dir: girdir,
command: glib_command + [
- '--cflags-begin'] + glib_includes + [
+ '--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
'-DGLIB_COMPILATION',
'-D__G_I18N_LIB_H__',
'-DGETTEXT_PACKAGE=Dummy',
@@ -260,7 +260,7 @@ gobject_gir = custom_target('gir-gobject',
install_dir: girdir,
command: gobject_command + [
'--include-uninstalled=' + glib_gir.full_path(),
- '--cflags-begin'] + glib_includes + [
+ '--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
'-DGOBJECT_COMPILATION',
'--cflags-end',
'@INPUT@',
@@ -307,7 +307,7 @@ gir_files += custom_target('gir-gmodule',
install_dir: girdir,
command: gmodule_command + [
'--include-uninstalled=' + glib_gir.full_path(),
- '--cflags-begin'] + glib_includes + [
+ '--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
'--cflags-end',
'@INPUT@',
]
@@ -396,7 +396,7 @@ gio_gir = custom_target('gir-gio',
install_dir: girdir,
command: gio_command + [
'--include-uninstalled=' + gobject_gir.full_path(),
- '--cflags-begin'] + glib_includes + [
+ '--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
'-DGIO_COMPILATION',
'-DG_SETTINGS_ENABLE_BACKEND',
'--cflags-end',
@@ -433,7 +433,7 @@ gir_files += custom_target('gir-girepository',
install_dir: girdir,
command: girepository_command + [
'--include-uninstalled=' + gobject_gir.full_path(),
- '--cflags-begin'] + glib_includes + [
+ '--cflags-begin'] + glib_includes + extra_giscanner_cflags + [
'-I' + meson.current_source_dir() + '/../girepository',
'-I' + meson.current_build_dir() + '/../girepository',
'-DGI_COMPILATION',
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])
diff --git a/tests/meson.build b/tests/meson.build
index 369abac8..f4c57ed7 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -125,6 +125,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--library=everything-1.0',
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -151,6 +152,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--library=gimarshallingtests-1.0',
'-L' + meson.current_build_dir(),
'--c-include="tests/gimarshallingtests.h"',
+ extra_giscanner_args,
'@INPUT@',
]
)
diff --git a/tests/offsets/meson.build b/tests/offsets/meson.build
index 6670f21a..71f4c8a4 100644
--- a/tests/offsets/meson.build
+++ b/tests/offsets/meson.build
@@ -35,6 +35,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.source_root(), 'tests'),
+ extra_giscanner_args,
'@INPUT@',
]
)
diff --git a/tests/scanner/meson.build b/tests/scanner/meson.build
index a82a6135..50ca5a2b 100644
--- a/tests/scanner/meson.build
+++ b/tests/scanner/meson.build
@@ -137,6 +137,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -175,6 +176,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', join_paths(meson.build_root(), 'girepository'),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -212,6 +214,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -247,6 +250,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -284,6 +288,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -322,6 +327,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -359,6 +365,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -387,6 +394,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--nsversion=1.0',
'--header-only',
'--symbol-filter-cmd=' + python_path + ' ' + join_paths(meson.current_source_dir(),
'symbolfilter.py'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -415,6 +423,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--nsversion=1.0',
'--header-only',
'--identifier-filter-cmd=' + python_path + ' ' + join_paths(meson.current_source_dir(),
'identfilter.py'),
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -443,6 +452,7 @@ if glib_dep.type_name() == 'pkgconfig'
'--namespace=Headeronly',
'--nsversion=1.0',
'--header-only',
+ extra_giscanner_args,
'@INPUT@',
]
)
@@ -485,6 +495,7 @@ if glib_dep.type_name() == 'pkgconfig'
'-L', meson.current_build_dir(),
'-I', meson.current_source_dir(),
'-I', join_paths(meson.current_source_dir(), '..'),
+ extra_giscanner_args,
] + regress_scanner_cairo_args + [
'@INPUT@',
]
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]