[gsettings-desktop-schemas/msvc-introspection: 6/6] build: Fix introspection on Visual Studio
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gsettings-desktop-schemas/msvc-introspection: 6/6] build: Fix introspection on Visual Studio
- Date: Fri, 10 Jul 2020 07:15:04 +0000 (UTC)
commit e47bba9f794cf7af5002454f1a46fbc25c4eedda
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jul 1 17:49:37 2020 +0800
build: Fix introspection on Visual Studio
Meson requires a library or an executable for building introspection files, but
unfortunately Visual Studio requires at least an object file to be built in
order to create a library or executable, which means a source file must be
present.
To satisfy this requirement, just use a dummy C source file on Visual Studio
builds and use it also to build our dummy library, so that we can generate the
introspection files properly, out of the box.
headers/dummy-msvc.c | 5 +++++
headers/meson.build | 10 +++++++++-
2 files changed, 14 insertions(+), 1 deletion(-)
---
diff --git a/headers/dummy-msvc.c b/headers/dummy-msvc.c
new file mode 100644
index 0000000..8da963c
--- /dev/null
+++ b/headers/dummy-msvc.c
@@ -0,0 +1,5 @@
+/* dummy source file required for building Introspection files on Visual Studio */
+void dummy()
+{
+ return;
+}
diff --git a/headers/meson.build b/headers/meson.build
index 3ce8b61..16dd7bd 100644
--- a/headers/meson.build
+++ b/headers/meson.build
@@ -20,8 +20,16 @@ enums_xml = custom_target(
install_dir: schemasdir)
if not meson.is_cross_build() and get_option('introspection')
+ gir_sources = headers
+
+ # Use a dummy .c source for Visual Studio builds-it is not enough
+ # to send in just a header file to build a dummy library on MSVC
+ if cc.get_id() == 'msvc'
+ gir_sources += ['dummy-msvc.c']
+ endif
+
noinst_lib = shared_library('noinst',
- headers,
+ gir_sources,
install: false)
gnome.generate_gir(noinst_lib,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]