]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
gobject-introspection: Don't include unistd.h on MSVC
authorChun-wei Fan <fanchunwei@src.gnome.org>
Wed, 26 Jan 2022 05:07:29 +0000 (13:07 +0800)
committerChun-wei Fan <fanchunwei@src.gnome.org>
Fri, 28 Jan 2022 08:16:43 +0000 (16:16 +0800)
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
gobject-introspection/scanner.c

index 0318aac800f2149e9026c24e50ec373bc0f021d2..1319b5bd230a849e567a25050909bca2f778bbab 100644 (file)
@@ -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],
index 58133f968616469ad63a778aa21ae5f0187cd7d6..de28c282eaa541ed1fbc5e11772a8b7ba7d458aa 100644 (file)
@@ -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