summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2018-05-17 14:32:23 -0400
committerXavier Claessens <xavier.claessens@collabora.com>2018-05-22 11:51:59 -0400
commit2e3769a4f79e563a4a0630587a7c486919cf3d88 (patch)
tree0fdcbd8cfcff374b994e201ed2367c9f4137f720
parente400af99d436b003b93479e4892623f336f58a6b (diff)
downloadglib-2e3769a4f79e563a4a0630587a7c486919cf3d88.tar.gz
Meson: Fix cocoa and carbon support
- Compiler checks were failing because it were using C compiler to build objc code. - xdgmime is needed on osx too. - -DGIO_COMPILATION must be passed to objc compiler too. - gapplication doesn't build on osx, it is excluded in autotools too. We have to be careful when we use add_project_link_arguments(): All targets are built using link arguments for the C language, except for libgio on osx which use the objc language, because it contains some ".m" source files. See https://github.com/mesonbuild/meson/issues/3585. https://bugzilla.gnome.org/show_bug.cgi?id=796214
-rw-r--r--gio/meson.build8
-rw-r--r--meson.build60
2 files changed, 41 insertions, 27 deletions
diff --git a/gio/meson.build b/gio/meson.build
index 8d542bcfe..b8baaa639 100644
--- a/gio/meson.build
+++ b/gio/meson.build
@@ -417,10 +417,11 @@ if host_system != 'windows'
contenttype_sources += files('gcontenttype.c')
appinfo_sources += files('gdesktopappinfo.c')
gio_unix_include_headers += files('gdesktopappinfo.h')
- subdir('xdgmime')
- internal_deps += [xdgmime_lib]
endif
+ subdir('xdgmime')
+ internal_deps += [xdgmime_lib]
+
install_headers(gio_unix_include_headers, subdir : 'gio-unix-2.0/gio')
if glib_conf.has('HAVE_NETLINK')
@@ -794,6 +795,7 @@ libgio = library('gio-2.0',
libgobject_dep, libgmodule_dep, selinux_dep, xattr_dep,
platform_deps, network_libs],
c_args : gio_c_args,
+ objc_args : gio_c_args,
# intl.lib is not compatible with SAFESEH
link_args : [noseh_link_args, glib_link_flags],
)
@@ -939,7 +941,7 @@ executable('gdbus', 'gdbus-tool.c',
link_args : noseh_link_args,
dependencies : [libgio_dep, libgobject_dep, libgmodule_dep, libglib_dep])
-if host_system != 'windows'
+if host_system != 'windows' and not glib_have_cocoa
executable('gapplication', 'gapplication-tool.c',
install : true,
c_args : gio_c_args,
diff --git a/meson.build b/meson.build
index f0ffe77a5..b36b177e6 100644
--- a/meson.build
+++ b/meson.build
@@ -572,36 +572,48 @@ if host_system == 'linux'
endif
osx_ldflags = []
+glib_have_os_x_9_or_later = false
+glib_have_carbon = false
+glib_have_cocoa = false
+if host_system == 'darwin'
+ add_languages('objc')
+ objcc = meson.get_compiler('objc')
-# Mac OS X Carbon support
-glib_have_carbon = cc.compiles('''#include <Carbon/Carbon.h>
- #include <CoreServices/CoreServices.h>''',
- name : 'Mac OS X Carbon support')
+ # FIXME: Should this be conditional? glib-gettext.m4 has some checks
+ osx_ldflags += ['-Wl,-framework,CoreFoundation']
-glib_have_os_x_9_or_later = false
+ # Mac OS X Carbon support
+ glib_have_carbon = objcc.compiles('''#include <Carbon/Carbon.h>
+ #include <CoreServices/CoreServices.h>''',
+ name : 'Mac OS X Carbon support')
-if glib_have_carbon
- glib_conf.set('HAVE_CARBON', true)
- osx_ldflags += '-Wl,-framework,Carbon'
- glib_have_os_x_9_or_later = cc.compiles('''#include <AvailabilityMacros.h>
- #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
- #error Compiling for minimum OS X version before 10.9
- #endif''', name : 'OS X 9 or later')
-endif
+ if glib_have_carbon
+ glib_conf.set('HAVE_CARBON', true)
+ osx_ldflags += '-Wl,-framework,Carbon'
+ glib_have_os_x_9_or_later = objcc.compiles('''#include <AvailabilityMacros.h>
+ #if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
+ #error Compiling for minimum OS X version before 10.9
+ #endif''',
+ name : 'OS X 9 or later')
+ endif
-# Mac OS X Cocoa support
-glib_have_cocoa = cc.compiles('''#include <Cocoa/Cocoa.h>
- #ifdef GNUSTEP_BASE_VERSION
- #error "Detected GNUstep, not Cocoa"
- #endif''',
- name : 'Mac OS X Cocoa support')
+ # Mac OS X Cocoa support
+ glib_have_cocoa = objcc.compiles('''#include <Cocoa/Cocoa.h>
+ #ifdef GNUSTEP_BASE_VERSION
+ #error "Detected GNUstep, not Cocoa"
+ #endif''',
+ name : 'Mac OS X Cocoa support')
-if glib_have_cocoa
- glib_conf.set('HAVE_COCOA', true)
- osx_ldflags += ['-Wl,-framework,Foundation', '-Wl,-framework,AppKit']
-endif
+ if glib_have_cocoa
+ glib_conf.set('HAVE_COCOA', true)
+ osx_ldflags += ['-Wl,-framework,Foundation', '-Wl,-framework,AppKit']
+ endif
-add_project_link_arguments(osx_ldflags, language : 'c')
+ # FIXME: libgio mix C and objC source files and there is no way to reliably
+ # know which language flags it's going to use to link. Add to both languages
+ # for now. See https://github.com/mesonbuild/meson/issues/3585.
+ add_project_link_arguments(osx_ldflags, language : ['objc', 'c'])
+endif
# Check for futex(2)
if cc.links('''#include <linux/futex.h>