mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-02-23 02:32:11 +01:00
meson: fix build without cpp toolchain
We don't need a cpp toolchain for building glib so lets just automatically disable tests requiring one when not available. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> (cherry-picked from commit d0b9ebbaacb5f69aaaad30829e04cd3a88f084cb)
This commit is contained in:
parent
dda4144541
commit
fcf2aaa1eb
@ -26,8 +26,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
|
||||||
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
|
have_fuzzing_engine = false
|
||||||
if fuzzing_engine.found()
|
if have_cxx
|
||||||
|
fuzzing_engine = cxx.find_library('FuzzingEngine', required : get_option('oss_fuzz'))
|
||||||
|
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'
|
||||||
|
@ -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' : {},
|
||||||
'fileattributematcher' : {},
|
'fileattributematcher' : {},
|
||||||
@ -124,6 +121,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
|
||||||
@ -142,6 +139,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,8 +1,10 @@
|
|||||||
gmodule_tests = {
|
if have_cxx
|
||||||
'cxx' : {
|
gmodule_tests = {
|
||||||
'source' : ['cxx.cpp'],
|
'cxx' : {
|
||||||
},
|
'source' : ['cxx.cpp'],
|
||||||
}
|
},
|
||||||
|
}
|
||||||
|
endif
|
||||||
|
|
||||||
test_env = environment()
|
test_env = environment()
|
||||||
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
||||||
|
@ -29,9 +29,6 @@ marshalers_c = custom_target('marshalers_c',
|
|||||||
gobject_tests = {
|
gobject_tests = {
|
||||||
'qdata' : {},
|
'qdata' : {},
|
||||||
'boxed' : {},
|
'boxed' : {},
|
||||||
'cxx' : {
|
|
||||||
'source' : ['cxx.cpp'],
|
|
||||||
},
|
|
||||||
'enums' : {},
|
'enums' : {},
|
||||||
'param' : {},
|
'param' : {},
|
||||||
'threadtests' : {},
|
'threadtests' : {},
|
||||||
@ -59,6 +56,14 @@ gobject_tests = {
|
|||||||
'type-flags' : {},
|
'type-flags' : {},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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
|
||||||
|
39
meson.build
39
meson.build
@ -1,4 +1,4 @@
|
|||||||
project('glib', 'c', 'cpp',
|
project('glib', 'c',
|
||||||
version : '2.72.3',
|
version : '2.72.3',
|
||||||
# NOTE: We keep this pinned at 0.52 because that's what Debian Stable ships
|
# NOTE: We keep this pinned at 0.52 because that's what Debian Stable ships
|
||||||
meson_version : '>= 0.52.0',
|
meson_version : '>= 0.52.0',
|
||||||
@ -10,7 +10,14 @@ project('glib', 'c', 'cpp',
|
|||||||
)
|
)
|
||||||
|
|
||||||
cc = meson.get_compiler('c')
|
cc = meson.get_compiler('c')
|
||||||
cxx = meson.get_compiler('cpp')
|
if meson.version().version_compare('>= 0.54.0')
|
||||||
|
have_cxx = add_languages('cpp', native: false, required: get_option('oss_fuzz').enabled())
|
||||||
|
else
|
||||||
|
have_cxx = add_languages('cpp', required: get_option('oss_fuzz').enabled())
|
||||||
|
endif
|
||||||
|
if have_cxx
|
||||||
|
cxx = meson.get_compiler('cpp')
|
||||||
|
endif
|
||||||
|
|
||||||
cc_can_run = not meson.is_cross_build() or meson.has_exe_wrapper()
|
cc_can_run = not meson.is_cross_build() or meson.has_exe_wrapper()
|
||||||
|
|
||||||
@ -495,7 +502,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')
|
||||||
add_project_arguments(cxx.get_supported_arguments(warning_cxx_args), language: 'cpp')
|
if have_cxx
|
||||||
|
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
|
||||||
@ -1734,18 +1743,20 @@ if g_have_iso_c_varargs
|
|||||||
#endif''')
|
#endif''')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
g_have_iso_cxx_varargs = cxx.compiles('''
|
if have_cxx
|
||||||
void some_func (void) {
|
g_have_iso_cxx_varargs = cxx.compiles('''
|
||||||
int a(int p1, int p2, int p3);
|
void some_func (void) {
|
||||||
#define call_a(...) a(1,__VA_ARGS__)
|
int a(int p1, int p2, int p3);
|
||||||
call_a(2,3);
|
#define call_a(...) a(1,__VA_ARGS__)
|
||||||
}''', name : 'ISO C99 varargs macros in C++')
|
call_a(2,3);
|
||||||
|
}''', name : 'ISO C99 varargs macros in C++')
|
||||||
|
|
||||||
if g_have_iso_cxx_varargs
|
if g_have_iso_cxx_varargs
|
||||||
glibconfig_conf.set('g_have_iso_cxx_varargs', '''
|
glibconfig_conf.set('g_have_iso_cxx_varargs', '''
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
# define G_HAVE_ISO_VARARGS 1
|
# define G_HAVE_ISO_VARARGS 1
|
||||||
#endif''')
|
#endif''')
|
||||||
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
g_have_gnuc_varargs = cc.compiles('''
|
g_have_gnuc_varargs = cc.compiles('''
|
||||||
|
Loading…
x
Reference in New Issue
Block a user