mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-23 12:41:50 +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,13 +45,13 @@ if get_option('gtk_doc')
|
|||||||
dependency('gtk-doc', version : '>=1.32.1',
|
dependency('gtk-doc', version : '>=1.32.1',
|
||||||
fallback : ['gtk-doc', 'dummy_dep'],
|
fallback : ['gtk-doc', 'dummy_dep'],
|
||||||
default_options : ['tests=false'])
|
default_options : ['tests=false'])
|
||||||
endif
|
|
||||||
|
|
||||||
# We cannot built the API reference off of a static library,
|
# We cannot built the API reference off of a static library,
|
||||||
# as symbols might get dropped by the linker
|
# as symbols might get dropped by the linker
|
||||||
if get_option('gtk_doc') and get_option('default_library') == 'static'
|
if not glib_build_shared
|
||||||
error('The API reference can only be built against a shared library')
|
error('The API reference can only be built against a shared library')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
subdir('gio')
|
subdir('gio')
|
||||||
subdir('glib')
|
subdir('glib')
|
||||||
|
@ -601,7 +601,7 @@ gio_sources = files(
|
|||||||
'gliststore.c',
|
'gliststore.c',
|
||||||
)
|
)
|
||||||
|
|
||||||
if get_option('default_library') != 'static'
|
if glib_build_shared
|
||||||
gio_sources += files ('../glib/gtrace.c')
|
gio_sources += files ('../glib/gtrace.c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ gdbus_example_objectmanager_rst_gen = custom_target('objectmanager-rst-gen',
|
|||||||
)
|
)
|
||||||
|
|
||||||
extra_c_args = []
|
extra_c_args = []
|
||||||
if get_option('default_library') == 'static'
|
if glib_build_static_only
|
||||||
extra_c_args = '-DGDBUS_OBJECT_MANAGER_EXAMPLE_STATIC_COMPILATION'
|
extra_c_args = '-DGDBUS_OBJECT_MANAGER_EXAMPLE_STATIC_COMPILATION'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -223,7 +223,7 @@ if host_machine.system() != 'windows'
|
|||||||
}
|
}
|
||||||
|
|
||||||
# LD_PRELOAD modules don't work so well with AddressSanitizer
|
# 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 += {
|
gio_tests += {
|
||||||
'gsocketclient-slow' : {
|
'gsocketclient-slow' : {
|
||||||
'depends' : [
|
'depends' : [
|
||||||
@ -652,7 +652,7 @@ if meson.can_run_host_binaries()
|
|||||||
|
|
||||||
compiler_type = '--compiler=@0@'.format(cc.get_id())
|
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',
|
plugin_resources_c = custom_target('plugin-resources.c',
|
||||||
input : 'test4.gresource.xml',
|
input : 'test4.gresource.xml',
|
||||||
output : 'plugin-resources.c',
|
output : 'plugin-resources.c',
|
||||||
@ -983,6 +983,6 @@ endif
|
|||||||
|
|
||||||
subdir('services')
|
subdir('services')
|
||||||
|
|
||||||
if get_option('default_library') != 'static'
|
if glib_build_shared
|
||||||
subdir('modules')
|
subdir('modules')
|
||||||
endif
|
endif
|
||||||
|
@ -348,7 +348,7 @@ glib_sources += files(
|
|||||||
platform_deps = []
|
platform_deps = []
|
||||||
|
|
||||||
if host_system == 'windows'
|
if host_system == 'windows'
|
||||||
if get_option('default_library') == 'shared'
|
if glib_build_shared
|
||||||
glib_win_rc = configure_file(
|
glib_win_rc = configure_file(
|
||||||
input: 'glib.rc.in',
|
input: 'glib.rc.in',
|
||||||
output: 'glib.rc',
|
output: 'glib.rc',
|
||||||
|
@ -205,7 +205,7 @@ else
|
|||||||
'include' : {},
|
'include' : {},
|
||||||
'unix' : {},
|
'unix' : {},
|
||||||
}
|
}
|
||||||
if have_rtld_next and get_option('default_library') != 'static'
|
if have_rtld_next and glib_build_shared
|
||||||
glib_tests += {
|
glib_tests += {
|
||||||
'gutils-user-database' : {
|
'gutils-user-database' : {
|
||||||
'depends' : [
|
'depends' : [
|
||||||
|
@ -38,7 +38,7 @@ if ['darwin', 'ios'].contains(host_machine.system())
|
|||||||
module_suffix = 'so'
|
module_suffix = 'so'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('default_library') != 'static'
|
if glib_build_shared
|
||||||
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
|
||||||
shared_module(module + '_plugin', 'lib@0@.c'.format(module),
|
shared_module(module + '_plugin', 'lib@0@.c'.format(module),
|
||||||
dependencies : [libglib_dep, libgmodule_dep],
|
dependencies : [libglib_dep, libgmodule_dep],
|
||||||
|
@ -62,7 +62,7 @@ gobject_sources += files(
|
|||||||
'gvaluetypes.c',
|
'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(
|
gobject_win_rc = configure_file(
|
||||||
input: 'gobject.rc.in',
|
input: 'gobject.rc.in',
|
||||||
output: 'gobject.rc',
|
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)
|
glib_conf.set('_FILE_OFFSET_BITS', 64)
|
||||||
endif
|
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"')
|
error('On Windows default_library must be "shared" or "static" but not "both"')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('default_library') == 'static'
|
if glib_build_static_only
|
||||||
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
|
glibconfig_conf.set('GLIB_STATIC_COMPILATION', '1')
|
||||||
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
|
glibconfig_conf.set('GOBJECT_STATIC_COMPILATION', '1')
|
||||||
glibconfig_conf.set('GIO_STATIC_COMPILATION', '1')
|
glibconfig_conf.set('GIO_STATIC_COMPILATION', '1')
|
||||||
|
Loading…
Reference in New Issue
Block a user