[vala/meson-msvc: 12/15] build: Add Visual Studio compat headers




commit d3de9cda6aaafc5d234b1b00defc7aacb6fc9559
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Jan 24 19:35:40 2022 +0800

    build: Add Visual Studio compat headers
    
    Visual Studio does not come with unistd.h and utime.h, so building items
    that originate from glib-2.0.vapi et al will fail if items that depend
    on these headers are used.
    
    Do overcome this, add compat headers for them that will include the
    appropriate headers from Visual Studio (or the Windows SDK), to fix the
    build.

 msvc/unistd.h | 10 ++++++++++
 msvc/utime.h  |  7 +++++++
 2 files changed, 17 insertions(+)
---
diff --git a/msvc/unistd.h b/msvc/unistd.h
new file mode 100644
index 000000000..7ba841347
--- /dev/null
+++ b/msvc/unistd.h
@@ -0,0 +1,10 @@
+/* Compatbility header for Visual Studio-like builds */
+
+#ifndef _MSC_VER
+# error This header is for Visual Studio-like builds only
+#endif
+
+#include <direct.h>
+#include <io.h>
+#include <process.h>
+
diff --git a/msvc/utime.h b/msvc/utime.h
new file mode 100644
index 000000000..3fdf86fa8
--- /dev/null
+++ b/msvc/utime.h
@@ -0,0 +1,7 @@
+/* compat header for MSVC builds */
+
+#ifndef _MSC_VER
+#error This compat header is for Visual Studio-like builds only
+#endif
+
+#include <sys/utime.h>


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]