[vala/meson-msvc: 13/15] gobject-introspection: Don't include unistd.h on MSVC
- From: Chun-wei Fan <fanchunwei src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/meson-msvc: 13/15] gobject-introspection: Don't include unistd.h on MSVC
- Date: Wed, 26 Jan 2022 05:35:21 +0000 (UTC)
commit 949eace26dd623b119b38d3de629f62f27ab0f6b
Author: Chun-wei Fan <fanchunwei src gnome org>
Date: Wed Jan 26 13:07:29 2022 +0800
gobject-introspection: Don't include unistd.h on MSVC
Visual Studio does not come with this header, so don't try to include it
in C code when building for Visual Studio.
gobject-introspection/meson.build | 7 +++++++
gobject-introspection/scanner.c | 2 +-
2 files changed, 8 insertions(+), 1 deletion(-)
---
diff --git a/gobject-introspection/meson.build b/gobject-introspection/meson.build
index 0318aac80..1319b5bd2 100644
--- a/gobject-introspection/meson.build
+++ b/gobject-introspection/meson.build
@@ -35,10 +35,17 @@ gen_introspect_sources = files(
'scanner.c',
)
+extra_gen_introspect_c_args = []
+
+if cc.get_argument_syntax() == 'msvc'
+ extra_gen_introspect_c_args += '-DYY_NO_UNISTD_H'
+endif
+
gen_introspect_name = 'gen-introspect@0@'.format(vala_version_suffix)
gen_introspect_exe = executable(gen_introspect_name,
[gen_introspect_sources, lfiles, pfiles],
+ c_args: extra_gen_introspect_c_args,
install: true,
install_dir: pkglibdir,
dependencies: [gobject_dep, gmodule_dep, gidl_dep],
diff --git a/gobject-introspection/scanner.c b/gobject-introspection/scanner.c
index 58133f968..de28c282e 100644
--- a/gobject-introspection/scanner.c
+++ b/gobject-introspection/scanner.c
@@ -24,7 +24,6 @@
#include <string.h>
#include <stdlib.h>
-#include <unistd.h>
#include <ctype.h>
#include <errno.h>
#include <glib.h>
@@ -40,6 +39,7 @@
#include "grealpath.h"
#ifndef _WIN32
+#include <unistd.h>
#include <sys/wait.h> /* waitpid */
#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]