diff options
author | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-10-18 21:59:59 +0200 |
---|---|---|
committer | Marco Trevisan (Treviño) <mail@3v1n0.net> | 2022-10-20 03:37:03 +0200 |
commit | e85635daa07e9c669ded75c476d67d02aa85c7c1 (patch) | |
tree | 4f2de6fdcf4ef1a7686fd59d0623f27d02556dce | |
parent | 4b6cc2d87bc788eff3edca55c1c6e05a9d97d33d (diff) | |
download | glib-e85635daa07e9c669ded75c476d67d02aa85c7c1.tar.gz |
meson: Define G_OS_DARWIN when compiling under OSX or iOS
It has enough differences to expose it as an unix-subtype.
-rw-r--r-- | docs/reference/glib/glib-overrides.txt | 5 | ||||
-rw-r--r-- | docs/reference/glib/glib-sections.txt.in | 1 | ||||
-rw-r--r-- | glib/docs.c | 11 | ||||
-rw-r--r-- | glib/tests/macros.c | 11 | ||||
-rw-r--r-- | meson.build | 3 |
5 files changed, 31 insertions, 0 deletions
diff --git a/docs/reference/glib/glib-overrides.txt b/docs/reference/glib/glib-overrides.txt index 991fcf2d0..8f29a48d4 100644 --- a/docs/reference/glib/glib-overrides.txt +++ b/docs/reference/glib/glib-overrides.txt @@ -197,6 +197,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 </MACRO> diff --git a/docs/reference/glib/glib-sections.txt.in b/docs/reference/glib/glib-sections.txt.in index 35a20efcb..90b0f3258 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 a8e31fb87..f93ce8048 100644 --- a/glib/docs.c +++ b/glib/docs.c @@ -1648,6 +1648,17 @@ */ /** + * G_OS_DARWIN: + * + * This macro is defined only on Apple operating systems (macOS 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: * * This macro is defined only on Windows. So you can bracket diff --git a/glib/tests/macros.c b/glib/tests/macros.c index efe632b52..cbbc0f6de 100644 --- a/glib/tests/macros.c +++ b/glib/tests/macros.c @@ -20,8 +20,19 @@ * Author: Philip Withnall <withnall@endlessm.com> */ +#include "config.h" + #include <glib.h> +#if defined (__APPLE__) || defined (HAVE_COCOA) || defined (HAVE_CARBON) +# ifndef G_OS_UNIX + G_STATIC_ASSERT (FALSE); +# endif +# ifndef G_OS_DARWIN + G_STATIC_ASSERT (FALSE); +# endif +#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 ddcdc028d..54445db69 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 in ['darwin', 'ios'] + glib_os = '''#define G_OS_UNIX +#define G_OS_DARWIN''' else glib_os = '#define G_OS_UNIX' endif |