mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-11-09 19:06:15 +01:00
meson: Expose library build type as global variables
Given that it can be computed using an error-prone strings comparisons it is better to provide a variable everywhere, so that we don't have the risk of comparing values that are always false.
This commit is contained in:
parent
914bb06ab4
commit
b9e085537d
@ -45,12 +45,12 @@ if get_option('gtk_doc')
|
||||
dependency('gtk-doc', version : '>=1.32.1',
|
||||
fallback : ['gtk-doc', 'dummy_dep'],
|
||||
default_options : ['tests=false'])
|
||||
endif
|
||||
|
||||
# We cannot built the API reference off of a static library,
|
||||
# as symbols might get dropped by the linker
|
||||
if get_option('gtk_doc') and get_option('default_library') == 'static'
|
||||
error('The API reference can only be built against a shared library')
|
||||
# We cannot built the API reference off of a static library,
|
||||
# as symbols might get dropped by the linker
|
||||
if not glib_build_shared
|
||||
error('The API reference can only be built against a shared library')
|
||||
endif
|
||||
endif
|
||||
|
||||
subdir('gio')
|
||||
|
@ -601,7 +601,7 @@ gio_sources = files(
|
||||
'gliststore.c',
|
||||
)
|
||||
|
||||
if get_option('default_library') != 'static'
|
||||
if glib_build_shared
|
||||
gio_sources += files ('../glib/gtrace.c')
|
||||
endif
|
||||
|
||||
|
@ -39,7 +39,7 @@ gdbus_example_objectmanager_rst_gen = custom_target('objectmanager-rst-gen',
|
||||
)
|
||||
|
||||
extra_c_args = []
|
||||
if get_option('default_library') == 'static'
|
||||
if glib_build_static_only
|
||||
extra_c_args = '-DGDBUS_OBJECT_MANAGER_EXAMPLE_STATIC_COMPILATION'
|
||||
endif
|
||||
|
||||
|
@ -223,7 +223,7 @@ if host_machine.system() != 'windows'
|
||||
}
|
||||
|
||||
# LD_PRELOAD modules don't work so well with AddressSanitizer
|
||||
if have_rtld_next and get_option('default_library') != 'static' and get_option('b_sanitize') == 'none'
|
||||
if have_rtld_next and glib_build_shared and get_option('b_sanitize') == 'none'
|
||||
gio_tests += {
|
||||
'gsocketclient-slow' : {
|
||||
'depends' : [
|
||||
@ -652,7 +652,7 @@ if meson.can_run_host_binaries()
|
||||
|
||||
compiler_type = '--compiler=@0@'.format(cc.get_id())
|
||||
|
||||
if get_option('default_library') != 'static'
|
||||
if glib_build_shared
|
||||
plugin_resources_c = custom_target('plugin-resources.c',
|
||||
input : 'test4.gresource.xml',
|
||||
output : 'plugin-resources.c',
|
||||
@ -983,6 +983,6 @@ endif
|
||||
|
||||
subdir('services')
|
||||
|
||||
if get_option('default_library') != 'static'
|
||||
if glib_build_shared
|
||||
subdir('modules')
|
||||
endif
|
||||
|
@ -348,7 +348,7 @@ glib_sources += files(
|
||||
platform_deps = []
|
||||
|
||||
if host_system == 'windows'
|
||||
if get_option('default_library') == 'shared'
|
||||
if glib_build_shared
|
||||
glib_win_rc = configure_file(
|
||||
input: 'glib.rc.in',
|
||||
output: 'glib.rc',
|
||||
|
@ -205,7 +205,7 @@ else
|
||||
'include' : {},
|
||||
'unix' : {},
|
||||
}
|
||||
if have_rtld_next and get_option('default_library') != 'static'
|
||||
if have_rtld_next and glib_build_shared
|
||||
glib_tests += {
|
||||
'gutils-user-database' : {
|
||||
'depends' : [
|
||||
|
@ -38,7 +38,7 @@ if ['darwin', 'ios'].contains(host_machine.system())
|
||||
module_suffix = 'so'
|
||||
endif
|
||||
|
||||
if get_option('default_library') != 'static'
|
||||
if glib_build_shared
|
||||
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
||||
shared_module(module + '_plugin', 'lib@0@.c'.format(module),
|
||||
dependencies : [libglib_dep, libgmodule_dep],
|
||||
|
@ -62,7 +62,7 @@ gobject_sources += files(
|
||||
'gvaluetypes.c',
|
||||
)
|
||||
|
||||
if host_system == 'windows' and get_option('default_library') == 'shared'
|
||||
if host_system == 'windows' and glib_build_shared
|
||||
gobject_win_rc = configure_file(
|
||||
input: 'gobject.rc.in',
|
||||
output: 'gobject.rc',
|
||||
|
20
meson.build
20
meson.build
@ -221,11 +221,27 @@ if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-
|
||||
glib_conf.set('_FILE_OFFSET_BITS', 64)
|
||||
endif
|
||||
|
||||
if get_option('default_library') == 'both' and (host_system == 'windows' or host_system == 'cygwin')
|
||||
glib_build_shared = false
|
||||
glib_build_static = false
|
||||
if get_option('default_library') == 'both'
|
||||
glib_build_static = true
|
||||
glib_build_shared = true
|
||||
elif get_option('default_library') == 'static'
|
||||
glib_build_static = true
|
||||
elif get_option('default_library') == 'shared'
|
||||
glib_build_shared = true
|
||||
endif
|
||||
|
||||
glib_build_both = glib_build_static and glib_build_shared
|
||||
glib_build_static_only = glib_build_static and not glib_build_shared
|
||||
glib_build_shared_only = glib_build_shared and not glib_build_static
|
||||
|
||||
if glib_build_shared and glib_build_static and (
|
||||
host_system == 'windows' or host_system == 'cygwin')
|
||||
error('On Windows default_library must be "shared" or "static" but not "both"')
|
||||
endif
|
||||
|
||||
if get_option('default_library') == 'static'
|
||||
if glib_build_static_only
|
||||
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
|
||||
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
|
||||
glibconfig_conf.set('GIO_STATIC_COMPILATION', '1')
|
||||
|
Loading…
Reference in New Issue
Block a user