diff options
author | Chun-wei Fan <fanchunwei@src.gnome.org> | 2020-07-01 17:49:37 +0800 |
---|---|---|
committer | Carlos Garnacho <mrgarnacho@gmail.com> | 2020-07-21 10:09:42 +0000 |
commit | d6520c4813dc5536070b7a2138ade21436c0cafa (patch) | |
tree | cb66a4e248e438eb7cac39ae4270c4119052574a /headers | |
parent | 6570d5130437cda282d5ec033924dad05832d25f (diff) | |
download | gsettings-desktop-schemas-d6520c4813dc5536070b7a2138ade21436c0cafa.tar.gz |
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.
Diffstat (limited to 'headers')
-rw-r--r-- | headers/dummy-msvc.c | 5 | ||||
-rw-r--r-- | headers/meson.build | 10 |
2 files changed, 14 insertions, 1 deletions
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, |