mirror of https://github.com/xemu-project/xemu.git
meson.build: Remove the logic to link C code with the C++ linker
We are not mixing C++ with C code anymore, the only remaining C++ code in qga/vss-win32/ is used for a plain C++ executable. Thus we can remove the hacks for linking C code with the C++ linker now to simplify meson.build a little bit, and also to avoid that some C++ code sneaks in by accident again. Signed-off-by: Thomas Huth <thuth@redhat.com> Message-ID: <20230706064736.178962-1-thuth@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
3d7b89748a
commit
785abf0dcf
22
meson.build
22
meson.build
|
@ -473,19 +473,10 @@ if targetos != 'darwin'
|
||||||
warn_flags += ['-Wthread-safety']
|
warn_flags += ['-Wthread-safety']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# Check that the C++ compiler exists and works with the C compiler.
|
# Set up C++ compiler flags
|
||||||
link_language = 'c'
|
|
||||||
linker = cc
|
|
||||||
qemu_cxxflags = []
|
qemu_cxxflags = []
|
||||||
if 'cpp' in all_languages
|
if 'cpp' in all_languages
|
||||||
qemu_cxxflags = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS'] + qemu_cflags
|
qemu_cxxflags = ['-D__STDC_LIMIT_MACROS', '-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS'] + qemu_cflags
|
||||||
if cxx.links(files('scripts/main.c'), args: qemu_cflags)
|
|
||||||
link_language = 'cpp'
|
|
||||||
linker = cxx
|
|
||||||
else
|
|
||||||
message('C++ compiler does not work with C compiler')
|
|
||||||
message('Disabling C++-specific optional code')
|
|
||||||
endif
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# clang does not support glibc + FORTIFY_SOURCE (is it still true?)
|
# clang does not support glibc + FORTIFY_SOURCE (is it still true?)
|
||||||
|
@ -1600,7 +1591,7 @@ if not get_option('snappy').auto() or have_system
|
||||||
snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'],
|
snappy = cc.find_library('snappy', has_headers: ['snappy-c.h'],
|
||||||
required: get_option('snappy'))
|
required: get_option('snappy'))
|
||||||
endif
|
endif
|
||||||
if snappy.found() and not linker.links('''
|
if snappy.found() and not cc.links('''
|
||||||
#include <snappy-c.h>
|
#include <snappy-c.h>
|
||||||
int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy)
|
int main(void) { snappy_max_compressed_length(4096); return 0; }''', dependencies: snappy)
|
||||||
snappy = not_found
|
snappy = not_found
|
||||||
|
@ -2746,7 +2737,7 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol(
|
||||||
|
|
||||||
have_vss = false
|
have_vss = false
|
||||||
have_vss_sdk = false # old xp/2003 SDK
|
have_vss_sdk = false # old xp/2003 SDK
|
||||||
if targetos == 'windows' and link_language == 'cpp'
|
if targetos == 'windows' and 'cpp' in all_languages
|
||||||
have_vss = cxx.compiles('''
|
have_vss = cxx.compiles('''
|
||||||
#define __MIDL_user_allocate_free_DEFINED__
|
#define __MIDL_user_allocate_free_DEFINED__
|
||||||
#include <vss.h>
|
#include <vss.h>
|
||||||
|
@ -3827,7 +3818,6 @@ foreach target : target_dirs
|
||||||
c_args: c_args,
|
c_args: c_args,
|
||||||
dependencies: arch_deps + deps + exe['dependencies'],
|
dependencies: arch_deps + deps + exe['dependencies'],
|
||||||
objects: lib.extract_all_objects(recursive: true),
|
objects: lib.extract_all_objects(recursive: true),
|
||||||
link_language: link_language,
|
|
||||||
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
|
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
|
||||||
link_args: link_args,
|
link_args: link_args,
|
||||||
win_subsystem: exe['win_subsystem'])
|
win_subsystem: exe['win_subsystem'])
|
||||||
|
@ -4061,7 +4051,7 @@ summary_info += {'host CPU': cpu}
|
||||||
summary_info += {'host endianness': build_machine.endian()}
|
summary_info += {'host endianness': build_machine.endian()}
|
||||||
summary_info += {'C compiler': ' '.join(meson.get_compiler('c').cmd_array())}
|
summary_info += {'C compiler': ' '.join(meson.get_compiler('c').cmd_array())}
|
||||||
summary_info += {'Host C compiler': ' '.join(meson.get_compiler('c', native: true).cmd_array())}
|
summary_info += {'Host C compiler': ' '.join(meson.get_compiler('c', native: true).cmd_array())}
|
||||||
if link_language == 'cpp'
|
if 'cpp' in all_languages
|
||||||
summary_info += {'C++ compiler': ' '.join(meson.get_compiler('cpp').cmd_array())}
|
summary_info += {'C++ compiler': ' '.join(meson.get_compiler('cpp').cmd_array())}
|
||||||
else
|
else
|
||||||
summary_info += {'C++ compiler': false}
|
summary_info += {'C++ compiler': false}
|
||||||
|
@ -4074,13 +4064,13 @@ if get_option('optimization') != 'plain'
|
||||||
option_cflags += ['-O' + get_option('optimization')]
|
option_cflags += ['-O' + get_option('optimization')]
|
||||||
endif
|
endif
|
||||||
summary_info += {'CFLAGS': ' '.join(get_option('c_args') + option_cflags)}
|
summary_info += {'CFLAGS': ' '.join(get_option('c_args') + option_cflags)}
|
||||||
if link_language == 'cpp'
|
if 'cpp' in all_languages
|
||||||
summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') + option_cflags)}
|
summary_info += {'CXXFLAGS': ' '.join(get_option('cpp_args') + option_cflags)}
|
||||||
endif
|
endif
|
||||||
if targetos == 'darwin'
|
if targetos == 'darwin'
|
||||||
summary_info += {'OBJCFLAGS': ' '.join(get_option('objc_args') + option_cflags)}
|
summary_info += {'OBJCFLAGS': ' '.join(get_option('objc_args') + option_cflags)}
|
||||||
endif
|
endif
|
||||||
link_args = get_option(link_language + '_link_args')
|
link_args = get_option('c_link_args')
|
||||||
if link_args.length() > 0
|
if link_args.length() > 0
|
||||||
summary_info += {'LDFLAGS': ' '.join(link_args)}
|
summary_info += {'LDFLAGS': ' '.join(link_args)}
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -9,7 +9,7 @@ endif
|
||||||
have_qga_vss = get_option('qga_vss') \
|
have_qga_vss = get_option('qga_vss') \
|
||||||
.require(targetos == 'windows',
|
.require(targetos == 'windows',
|
||||||
error_message: 'VSS support requires Windows') \
|
error_message: 'VSS support requires Windows') \
|
||||||
.require(link_language == 'cpp',
|
.require('cpp' in all_languages,
|
||||||
error_message: 'VSS support requires a C++ compiler') \
|
error_message: 'VSS support requires a C++ compiler') \
|
||||||
.require(have_vss, error_message: '''VSS support requires VSS headers.
|
.require(have_vss, error_message: '''VSS support requires VSS headers.
|
||||||
If your Visual Studio installation doesn't have the VSS headers,
|
If your Visual Studio installation doesn't have the VSS headers,
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
int main(void) {}
|
|
Loading…
Reference in New Issue