mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-10 03:16:17 +01:00
Use meson dependency to link against apple framework
Using ld_flags would work, but that does not propagate ldflags to users of glib. Meson's dependency() call will propagate apple framework dependencies to downstream users.
This commit is contained in:
parent
d5ebd6af70
commit
2a4422b0f2
@ -390,6 +390,8 @@ if host_system != 'windows'
|
|||||||
settings_sources += files('gnextstepsettingsbackend.m')
|
settings_sources += files('gnextstepsettingsbackend.m')
|
||||||
contenttype_sources += files('gosxcontenttype.m')
|
contenttype_sources += files('gosxcontenttype.m')
|
||||||
appinfo_sources += files('gosxappinfo.m')
|
appinfo_sources += files('gosxappinfo.m')
|
||||||
|
framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit'])
|
||||||
|
platform_deps += [framework_dep]
|
||||||
if glib_have_os_x_9_or_later
|
if glib_have_os_x_9_or_later
|
||||||
unix_sources += files('gcocoanotificationbackend.m')
|
unix_sources += files('gcocoanotificationbackend.m')
|
||||||
endif
|
endif
|
||||||
@ -815,7 +817,6 @@ libgio_dep = declare_dependency(link_with : libgio,
|
|||||||
include_directories : [gioinc])
|
include_directories : [gioinc])
|
||||||
|
|
||||||
pkg.generate(libgio,
|
pkg.generate(libgio,
|
||||||
libraries_private : [osx_ldflags],
|
|
||||||
requires : ['glib-2.0', 'gobject-2.0'],
|
requires : ['glib-2.0', 'gobject-2.0'],
|
||||||
variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')),
|
variables : ['datadir=' + join_paths('${prefix}', get_option('datadir')),
|
||||||
'schemasdir=' + join_paths('${datadir}', schemas_subdir),
|
'schemasdir=' + join_paths('${datadir}', schemas_subdir),
|
||||||
|
@ -310,6 +310,8 @@ glib_sources = files(
|
|||||||
'gprintf.c',
|
'gprintf.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
platform_deps = []
|
||||||
|
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
glib_win_rc = configure_file(
|
glib_win_rc = configure_file(
|
||||||
input: 'glib.rc.in',
|
input: 'glib.rc.in',
|
||||||
@ -330,6 +332,13 @@ endif
|
|||||||
|
|
||||||
if glib_have_cocoa
|
if glib_have_cocoa
|
||||||
glib_sources += files('gosxutils.m')
|
glib_sources += files('gosxutils.m')
|
||||||
|
framework_dep = dependency('appleframeworks', modules : ['Foundation', 'CoreFoundation', 'AppKit'])
|
||||||
|
platform_deps += [framework_dep]
|
||||||
|
endif
|
||||||
|
|
||||||
|
if glib_have_carbon
|
||||||
|
framework_dep = dependency('appleframeworks', modules : 'Carbon')
|
||||||
|
platform_deps += [framework_dep]
|
||||||
endif
|
endif
|
||||||
|
|
||||||
glib_sources += files('gthread-@0@.c'.format(threads_implementation))
|
glib_sources += files('gthread-@0@.c'.format(threads_implementation))
|
||||||
@ -373,7 +382,7 @@ libglib_dep = declare_dependency(
|
|||||||
|
|
||||||
pkg.generate(libglib,
|
pkg.generate(libglib,
|
||||||
libraries : [libintl_deps],
|
libraries : [libintl_deps],
|
||||||
libraries_private : [osx_ldflags, win32_ldflags],
|
libraries_private : [win32_ldflags],
|
||||||
subdirs : ['glib-2.0'],
|
subdirs : ['glib-2.0'],
|
||||||
extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
|
extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
|
||||||
variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
|
variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
|
||||||
|
20
meson.build
20
meson.build
@ -759,7 +759,6 @@ if host_system == 'linux'
|
|||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
osx_ldflags = []
|
|
||||||
glib_have_os_x_9_or_later = false
|
glib_have_os_x_9_or_later = false
|
||||||
glib_have_carbon = false
|
glib_have_carbon = false
|
||||||
glib_have_cocoa = false
|
glib_have_cocoa = false
|
||||||
@ -769,8 +768,6 @@ if host_system == 'darwin'
|
|||||||
|
|
||||||
add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc')
|
add_project_arguments(objcc.get_supported_arguments(warning_objc_args), language: 'objc')
|
||||||
|
|
||||||
osx_ldflags += ['-Wl,-framework,CoreFoundation']
|
|
||||||
|
|
||||||
# Mac OS X Carbon support
|
# Mac OS X Carbon support
|
||||||
glib_have_carbon = objcc.compiles('''#include <Carbon/Carbon.h>
|
glib_have_carbon = objcc.compiles('''#include <Carbon/Carbon.h>
|
||||||
#include <CoreServices/CoreServices.h>''',
|
#include <CoreServices/CoreServices.h>''',
|
||||||
@ -778,7 +775,6 @@ if host_system == 'darwin'
|
|||||||
|
|
||||||
if glib_have_carbon
|
if glib_have_carbon
|
||||||
glib_conf.set('HAVE_CARBON', true)
|
glib_conf.set('HAVE_CARBON', true)
|
||||||
osx_ldflags += '-Wl,-framework,Carbon'
|
|
||||||
glib_have_os_x_9_or_later = objcc.compiles('''#include <AvailabilityMacros.h>
|
glib_have_os_x_9_or_later = objcc.compiles('''#include <AvailabilityMacros.h>
|
||||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
|
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1090
|
||||||
#error Compiling for minimum OS X version before 10.9
|
#error Compiling for minimum OS X version before 10.9
|
||||||
@ -795,13 +791,7 @@ if host_system == 'darwin'
|
|||||||
|
|
||||||
if glib_have_cocoa
|
if glib_have_cocoa
|
||||||
glib_conf.set('HAVE_COCOA', true)
|
glib_conf.set('HAVE_COCOA', true)
|
||||||
osx_ldflags += ['-Wl,-framework,Foundation', '-Wl,-framework,AppKit']
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# 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
|
endif
|
||||||
|
|
||||||
if host_system == 'qnx'
|
if host_system == 'qnx'
|
||||||
@ -2061,13 +2051,13 @@ endif
|
|||||||
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
|
# FIXME: glib-gettext.m4 has much more checks to detect broken/uncompatible
|
||||||
# implementations. This could be extended if issues are found in some platforms.
|
# implementations. This could be extended if issues are found in some platforms.
|
||||||
libintl_deps = []
|
libintl_deps = []
|
||||||
if cc.has_function('ngettext', args : osx_ldflags)
|
if cc.has_function('ngettext')
|
||||||
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
|
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset')
|
||||||
else
|
else
|
||||||
# First just find the bare library.
|
# First just find the bare library.
|
||||||
libintl = cc.find_library('intl', required : false)
|
libintl = cc.find_library('intl', required : false)
|
||||||
# The bare library probably won't link without help if it's static.
|
# The bare library probably won't link without help if it's static.
|
||||||
if libintl.found() and not cc.has_function('ngettext', args : osx_ldflags, dependencies : libintl)
|
if libintl.found() and not cc.has_function('ngettext', dependencies : libintl)
|
||||||
libintl_iconv = cc.find_library('iconv', required : false)
|
libintl_iconv = cc.find_library('iconv', required : false)
|
||||||
# libintl supports different threading APIs, which may not
|
# libintl supports different threading APIs, which may not
|
||||||
# require additional flags, but it defaults to using pthreads if
|
# require additional flags, but it defaults to using pthreads if
|
||||||
@ -2077,10 +2067,10 @@ else
|
|||||||
# also defining the macros with the -pthread flag.
|
# also defining the macros with the -pthread flag.
|
||||||
libintl_pthread = cc.find_library('pthread', required : false)
|
libintl_pthread = cc.find_library('pthread', required : false)
|
||||||
# Try linking with just libiconv.
|
# Try linking with just libiconv.
|
||||||
if libintl_iconv.found() and cc.has_function('ngettext', args : osx_ldflags, dependencies : [libintl, libintl_iconv])
|
if libintl_iconv.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv])
|
||||||
libintl_deps += [libintl_iconv]
|
libintl_deps += [libintl_iconv]
|
||||||
# Then also try linking with pthreads.
|
# Then also try linking with pthreads.
|
||||||
elif libintl_iconv.found() and libintl_pthread.found() and cc.has_function('ngettext', args : osx_ldflags, dependencies : [libintl, libintl_iconv, libintl_pthread])
|
elif libintl_iconv.found() and libintl_pthread.found() and cc.has_function('ngettext', dependencies : [libintl, libintl_iconv, libintl_pthread])
|
||||||
libintl_deps += [libintl_iconv, libintl_pthread]
|
libintl_deps += [libintl_iconv, libintl_pthread]
|
||||||
else
|
else
|
||||||
libintl = disabler()
|
libintl = disabler()
|
||||||
@ -2092,7 +2082,7 @@ else
|
|||||||
have_bind_textdomain_codeset = true # proxy-libintl supports it
|
have_bind_textdomain_codeset = true # proxy-libintl supports it
|
||||||
else
|
else
|
||||||
libintl_deps = [libintl] + libintl_deps
|
libintl_deps = [libintl] + libintl_deps
|
||||||
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset', args : osx_ldflags,
|
have_bind_textdomain_codeset = cc.has_function('bind_textdomain_codeset',
|
||||||
dependencies : libintl_deps)
|
dependencies : libintl_deps)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
Loading…
Reference in New Issue
Block a user