mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-04-21 22:59:16 +02:00
Merge branch 'c-only' into 'main'
meson: fix build without cpp toolchain See merge request GNOME/glib!2822
This commit is contained in:
commit
bdaf1ffa67
@ -45,8 +45,12 @@ extra_c_args = cc.get_supported_arguments('-Werror=unused-function')
|
|||||||
|
|
||||||
# Links in a static library provided by oss-fuzz, else a standalone driver.
|
# Links in a static library provided by oss-fuzz, else a standalone driver.
|
||||||
# https://google.github.io/oss-fuzz/getting-started/new-project-guide/#buildsh-script-environment
|
# https://google.github.io/oss-fuzz/getting-started/new-project-guide/#buildsh-script-environment
|
||||||
|
have_fuzzing_engine = false
|
||||||
|
if have_cxx
|
||||||
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
|
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
|
||||||
if fuzzing_engine.found()
|
have_fuzzing_engine = fuzzing_engine.found()
|
||||||
|
endif
|
||||||
|
if have_fuzzing_engine
|
||||||
deps += fuzzing_engine
|
deps += fuzzing_engine
|
||||||
else
|
else
|
||||||
extra_sources += 'driver.c'
|
extra_sources += 'driver.c'
|
||||||
@ -61,7 +65,7 @@ foreach target_name : fuzz_targets
|
|||||||
# If the FuzzingEngine isn’t available, build some unit tests to check that
|
# If the FuzzingEngine isn’t available, build some unit tests to check that
|
||||||
# the fuzzing files do basically work. This doesn’t do any actual fuzzing though.
|
# the fuzzing files do basically work. This doesn’t do any actual fuzzing though.
|
||||||
# Pass in the README as an arbitrary fuzzing input, just so we have something.
|
# Pass in the README as an arbitrary fuzzing input, just so we have something.
|
||||||
if not fuzzing_engine.found()
|
if not have_fuzzing_engine
|
||||||
test(target_name, exe,
|
test(target_name, exe,
|
||||||
args : files('README.md'),
|
args : files('README.md'),
|
||||||
suite : 'fuzzing',
|
suite : 'fuzzing',
|
||||||
|
@ -58,9 +58,6 @@ gio_tests = {
|
|||||||
},
|
},
|
||||||
'converter-stream' : {},
|
'converter-stream' : {},
|
||||||
'credentials' : {},
|
'credentials' : {},
|
||||||
'cxx' : {
|
|
||||||
'source' : ['cxx.cpp'],
|
|
||||||
},
|
|
||||||
'data-input-stream' : {},
|
'data-input-stream' : {},
|
||||||
'data-output-stream' : {},
|
'data-output-stream' : {},
|
||||||
'error': {},
|
'error': {},
|
||||||
@ -127,6 +124,14 @@ gio_tests = {
|
|||||||
'win32-appinfo' : {},
|
'win32-appinfo' : {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if have_cxx
|
||||||
|
gio_tests += {
|
||||||
|
'cxx' : {
|
||||||
|
'source' : ['cxx.cpp'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
endif
|
||||||
|
|
||||||
test_extra_programs = {
|
test_extra_programs = {
|
||||||
'gdbus-connection-flush-helper' : {},
|
'gdbus-connection-flush-helper' : {},
|
||||||
'gdbus-testserver' : {},
|
'gdbus-testserver' : {},
|
||||||
|
@ -15,9 +15,6 @@ glib_tests = {
|
|||||||
'completion' : {},
|
'completion' : {},
|
||||||
'cond' : {},
|
'cond' : {},
|
||||||
'convert' : {},
|
'convert' : {},
|
||||||
'cxx' : {
|
|
||||||
'source' : ['cxx.cpp'],
|
|
||||||
},
|
|
||||||
'dataset' : {},
|
'dataset' : {},
|
||||||
'date' : {
|
'date' : {
|
||||||
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
|
# FIXME: https://gitlab.gnome.org/GNOME/glib/-/issues/1392
|
||||||
@ -158,6 +155,14 @@ glib_tests = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if have_cxx
|
||||||
|
glib_tests += {
|
||||||
|
'cxx' : {
|
||||||
|
'source' : ['cxx.cpp'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endif
|
||||||
|
|
||||||
if cc.get_id() != 'msvc'
|
if cc.get_id() != 'msvc'
|
||||||
glib_tests += {'autoptr' : {}}
|
glib_tests += {'autoptr' : {}}
|
||||||
endif
|
endif
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
gmodule_tests = {
|
gmodule_tests = {
|
||||||
'cxx' : {
|
|
||||||
'source' : ['cxx.cpp'],
|
|
||||||
},
|
|
||||||
'module-test-library' : {
|
'module-test-library' : {
|
||||||
'export_dynamic' : true,
|
'export_dynamic' : true,
|
||||||
'source': 'module-test.c',
|
'source': 'module-test.c',
|
||||||
@ -14,6 +11,14 @@ gmodule_tests = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if have_cxx
|
||||||
|
gmodule_tests += {
|
||||||
|
'cxx' : {
|
||||||
|
'source' : ['cxx.cpp'],
|
||||||
|
}
|
||||||
|
}
|
||||||
|
endif
|
||||||
|
|
||||||
module_suffix = []
|
module_suffix = []
|
||||||
# Keep the autotools convention for shared module suffix because GModule
|
# Keep the autotools convention for shared module suffix because GModule
|
||||||
# depends on it: https://gitlab.gnome.org/GNOME/glib/issues/520
|
# depends on it: https://gitlab.gnome.org/GNOME/glib/issues/520
|
||||||
|
@ -38,9 +38,6 @@ gobject_tests = {
|
|||||||
},
|
},
|
||||||
'basics-gobject' : {},
|
'basics-gobject' : {},
|
||||||
'boxed' : {},
|
'boxed' : {},
|
||||||
'cxx' : {
|
|
||||||
'source' : ['cxx.cpp'],
|
|
||||||
},
|
|
||||||
'defaultiface' : {
|
'defaultiface' : {
|
||||||
'source' : ['defaultiface.c', 'testmodule.c'],
|
'source' : ['defaultiface.c', 'testmodule.c'],
|
||||||
},
|
},
|
||||||
@ -101,6 +98,14 @@ gobject_tests = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if have_cxx
|
||||||
|
gobject_tests += {
|
||||||
|
'cxx' : {
|
||||||
|
'source' : ['cxx.cpp'],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
endif
|
||||||
|
|
||||||
if cc.get_id() != 'msvc'
|
if cc.get_id() != 'msvc'
|
||||||
gobject_tests += {'autoptr' : {}}
|
gobject_tests += {'autoptr' : {}}
|
||||||
endif
|
endif
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
project('glib', 'c', 'cpp',
|
project('glib', 'c',
|
||||||
version : '2.73.2',
|
version : '2.73.2',
|
||||||
# NOTE: See the policy in docs/meson-version.md before changing the Meson dependency
|
# NOTE: See the policy in docs/meson-version.md before changing the Meson dependency
|
||||||
meson_version : '>= 0.60.0',
|
meson_version : '>= 0.60.0',
|
||||||
@ -10,7 +10,10 @@ project('glib', 'c', 'cpp',
|
|||||||
)
|
)
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
|
have_cxx = add_languages('cpp', native: false, required: get_option('oss_fuzz').enabled())
|
||||||
|
if have_cxx
|
||||||
cxx = meson.get_compiler('cpp')
|
cxx = meson.get_compiler('cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
cc_can_run = meson.can_run_host_binaries()
|
cc_can_run = meson.can_run_host_binaries()
|
||||||
|
|
||||||
@ -529,7 +532,9 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
|
add_project_arguments(cc.get_supported_arguments(warning_c_args), language: 'c')
|
||||||
|
if have_cxx
|
||||||
add_project_arguments(cxx.get_supported_arguments(warning_cxx_args), language: 'cpp')
|
add_project_arguments(cxx.get_supported_arguments(warning_cxx_args), language: 'cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
# FIXME: We cannot build some of the GResource tests with -z nodelete, which
|
# FIXME: We cannot build some of the GResource tests with -z nodelete, which
|
||||||
# means we cannot use that flag in add_project_link_arguments(), and must add
|
# means we cannot use that flag in add_project_link_arguments(), and must add
|
||||||
@ -1735,6 +1740,7 @@ if not g_have_iso_c_varargs
|
|||||||
error('GLib requires a C compiler with support for C99 __VA_ARG__ in macros.')
|
error('GLib requires a C compiler with support for C99 __VA_ARG__ in macros.')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if have_cxx
|
||||||
g_have_iso_cxx_varargs = cxx.compiles('''
|
g_have_iso_cxx_varargs = cxx.compiles('''
|
||||||
void some_func (void) {
|
void some_func (void) {
|
||||||
int a(int p1, int p2, int p3);
|
int a(int p1, int p2, int p3);
|
||||||
@ -1745,6 +1751,7 @@ g_have_iso_cxx_varargs = cxx.compiles('''
|
|||||||
if not g_have_iso_cxx_varargs
|
if not g_have_iso_cxx_varargs
|
||||||
error('GLib requires a C++ compiler with support for C99 __VA_ARG__ in macros.')
|
error('GLib requires a C++ compiler with support for C99 __VA_ARG__ in macros.')
|
||||||
endif
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
g_have_gnuc_varargs = cc.compiles('''
|
g_have_gnuc_varargs = cc.compiles('''
|
||||||
void some_func (void) {
|
void some_func (void) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user