[glib/wip/3v1n0/add-darwin-os: 1/2] meson: Define G_OS_DARWIN when compiling under OSX or iOS
- From: Marco Trevisan <marcotrevi src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib/wip/3v1n0/add-darwin-os: 1/2] meson: Define G_OS_DARWIN when compiling under OSX or iOS
- Date: Wed, 19 Oct 2022 15:30:41 +0000 (UTC)
commit 055c2ad1e4499a790bf116131b30d816f1b150ad
Author: Marco Trevisan (TreviƱo) <mail 3v1n0 net>
Date: Tue Oct 18 21:59:59 2022 +0200
meson: Define G_OS_DARWIN when compiling under OSX or iOS
It has enough differences to expose it as an unix-subtype.
docs/reference/glib/glib-overrides.txt | 5 +++++
docs/reference/glib/glib-sections.txt.in | 1 +
glib/docs.c | 11 +++++++++++
glib/tests/macros.c | 5 +++++
meson.build | 3 +++
5 files changed, 25 insertions(+)
---
diff --git a/docs/reference/glib/glib-overrides.txt b/docs/reference/glib/glib-overrides.txt
index 991fcf2d0a..8f29a48d4b 100644
--- a/docs/reference/glib/glib-overrides.txt
+++ b/docs/reference/glib/glib-overrides.txt
@@ -196,6 +196,11 @@ GCond *cond
# Definitions for different operating systems
+<MACRO>
+<NAME>G_OS_DARWIN</NAME>
+#define G_OS_DARWIN
+</MACRO>
+
<MACRO>
<NAME>G_OS_UNIX</NAME>
#define G_OS_UNIX
diff --git a/docs/reference/glib/glib-sections.txt.in b/docs/reference/glib/glib-sections.txt.in
index 35a20efcbc..90b0f32585 100644
--- a/docs/reference/glib/glib-sections.txt.in
+++ b/docs/reference/glib/glib-sections.txt.in
@@ -140,6 +140,7 @@ GLIB_VERSION_PREV_STABLE
<TITLE>Standard Macros</TITLE>
<FILE>macros</FILE>
<SUBSECTION>
+G_OS_DARWIN
G_OS_WIN32
G_OS_UNIX
diff --git a/glib/docs.c b/glib/docs.c
index a8e31fb873..e2d164625b 100644
--- a/glib/docs.c
+++ b/glib/docs.c
@@ -1647,6 +1647,17 @@
* These macros provide a few commonly-used features.
*/
+/**
+ * G_OS_DARWIN:
+ *
+ * This macro is defined only on macOS (OS X or iOS). So you can bracket
+ * Apple-specific code in `\#ifdef G_OS_DARWIN`.
+ *
+ * Note that %G_OS_UNIX is also set.
+ *
+ * Since: 2.76
+ */
+
/**
* G_OS_WIN32:
*
diff --git a/glib/tests/macros.c b/glib/tests/macros.c
index efe632b521..813d608cd1 100644
--- a/glib/tests/macros.c
+++ b/glib/tests/macros.c
@@ -22,6 +22,11 @@
#include <glib.h>
+#if defined (__APPLE__) || defined (HAVE_COCOA) || defined (HAVE_CARBON)
+G_STATIC_ASSERT (defined (G_OS_UNIX))
+G_STATIC_ASSERT (defined (G_OS_DARWIN))
+#endif
+
/* Test that G_STATIC_ASSERT_EXPR can be used as an expression */
static void
test_assert_static (void)
diff --git a/meson.build b/meson.build
index ddcdc028d4..bd30f53d7a 100644
--- a/meson.build
+++ b/meson.build
@@ -235,6 +235,9 @@ if host_system == 'windows'
elif host_system == 'cygwin'
glib_os = '''#define G_OS_UNIX
#define G_WITH_CYGWIN'''
+elif host_system == 'darwin'
+ glib_os = '''#define G_OS_UNIX
+#define G_OS_DARWIN'''
else
glib_os = '#define G_OS_UNIX'
endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]