mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice-common
synced 2025-12-26 14:18:36 +00:00
SPICE version 2 was introduced more than 8 years ago. RHEL 6 already removed support for version 1 in the server. Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
178 lines
4.9 KiB
Meson
178 lines
4.9 KiB
Meson
#
|
|
# project definition
|
|
#
|
|
project('spice-common', 'c',
|
|
meson_version : '>= 0.47.0',
|
|
license : 'LGPLv2.1')
|
|
|
|
if not meson.is_subproject()
|
|
warning('This project is only intended to be used as a subproject!')
|
|
endif
|
|
|
|
# some global vars
|
|
spice_common_global_cflags = ['-DHAVE_CONFIG_H',
|
|
'-DG_LOG_DOMAIN="Spice"',
|
|
'-Wall',
|
|
'-Wextra',
|
|
'-Werror',
|
|
'-Wno-unused-parameter']
|
|
|
|
if get_option('alignment-checks')
|
|
spice_common_global_cflags += ['-DSPICE_DEBUG_ALIGNMENT']
|
|
endif
|
|
|
|
spice_common_deps = []
|
|
spice_common_include = include_directories('.')
|
|
|
|
spice_proto = files('spice.proto')
|
|
spice_codegen = files('spice_codegen.py')
|
|
spice_codegen_files = [spice_codegen]
|
|
|
|
compiler = meson.get_compiler('c')
|
|
spice_common_config_data = configuration_data()
|
|
if get_option('extra-checks')
|
|
spice_common_config_data.set('ENABLE_EXTRA_CHECKS', '1')
|
|
endif
|
|
|
|
spice_common_generate_code = get_option('generate-code')
|
|
spice_common_generate_client_code = spice_common_generate_code == 'all' or spice_common_generate_code == 'client'
|
|
spice_common_generate_server_code = spice_common_generate_code == 'all' or spice_common_generate_code == 'server'
|
|
|
|
#
|
|
# check for system headers
|
|
#
|
|
headers = ['alloca.h',
|
|
'arpa/inet.h',
|
|
'dlfcn.h',
|
|
'inttypes.h',
|
|
'malloc.h',
|
|
'memory.h',
|
|
'netinet/in.h',
|
|
'stddef.h',
|
|
'stdint.h',
|
|
'stdlib.h',
|
|
'strings.h',
|
|
'string.h',
|
|
'sys/socket.h',
|
|
'sys/stat.h',
|
|
'sys/types.h',
|
|
'unistd.h']
|
|
|
|
foreach header : headers
|
|
if compiler.has_header(header)
|
|
spice_common_config_data.set('HAVE_@0@'.format(header.underscorify().to_upper()), '1')
|
|
endif
|
|
endforeach
|
|
|
|
#
|
|
# check for system functions
|
|
#
|
|
functions = ['alloca',
|
|
'dup2',
|
|
'floor',
|
|
'fork',
|
|
'memmove',
|
|
'memset']
|
|
|
|
foreach func : functions
|
|
if compiler.has_function(func)
|
|
spice_common_config_data.set('HAVE_@0@'.format(func.underscorify().to_upper()), '1')
|
|
endif
|
|
endforeach
|
|
|
|
# check for hypot function
|
|
#
|
|
# Include math.h header to avoid problems with builtins.
|
|
# In some systems the function is in libm.
|
|
if not compiler.has_function('hypot', prefix : '#include <math.h>')
|
|
libm = compiler.find_library('m', required : false)
|
|
if compiler.has_function('hypot', prefix : '#include <math.h>', dependencies : libm)
|
|
spice_common_deps += libm
|
|
endif
|
|
endif
|
|
|
|
#
|
|
# check for mandatory dependencies
|
|
#
|
|
glib_version = '2.38'
|
|
glib_version_info = '>= @0@'.format(glib_version)
|
|
|
|
deps = {'spice-protocol' : '>= 0.12.12',
|
|
'glib-2.0' : glib_version_info,
|
|
'gio-2.0' : glib_version_info,
|
|
'gthread-2.0' : glib_version_info,
|
|
'pixman-1' : '>= 0.17.7',
|
|
'openssl' : '>= 1.0.0'}
|
|
|
|
foreach dep, version : deps
|
|
spice_common_deps += dependency(dep, version : version)
|
|
endforeach
|
|
|
|
#
|
|
# Non-mandatory/optional dependencies
|
|
#
|
|
optional_deps = {'celt051' : '>= 0.5.1.1',
|
|
'opus' : '>= 0.9.14'}
|
|
foreach dep, version : optional_deps
|
|
d = dependency(dep, required : get_option(dep), version : version)
|
|
if d.found()
|
|
spice_common_deps += d
|
|
spice_common_config_data.set('HAVE_@0@'.format(dep.underscorify().to_upper()), '1')
|
|
endif
|
|
endforeach
|
|
|
|
# Python
|
|
py_module = import('python3')
|
|
python = py_module.find_python()
|
|
|
|
if get_option('python-checks')
|
|
foreach module : ['six', 'pyparsing']
|
|
message('Checking for python module @0@'.format(module))
|
|
cmd = run_command(python, '-m', module)
|
|
if cmd.returncode() != 0
|
|
error('Python module @0@ not found'.format(module))
|
|
endif
|
|
endforeach
|
|
endif
|
|
|
|
# smartcard check
|
|
if get_option('smartcard')
|
|
smartcard_dep = dependency('libcacard', required : false, version : '>= 2.5.1')
|
|
if smartcard_dep.found()
|
|
spice_common_deps += smartcard_dep
|
|
spice_common_config_data.set('USE_SMARTCARD', '1')
|
|
else
|
|
smartcard012_dep = dependency('libcacard', required : false, version : '>= 0.1.2')
|
|
if smartcard012_dep.found()
|
|
spice_common_deps += smartcard012_dep
|
|
spice_common_config_data.set('USE_SMARTCARD_012', '1')
|
|
endif
|
|
endif
|
|
endif
|
|
|
|
#
|
|
# global C defines
|
|
#
|
|
glib_major_minor = glib_version.split('.')
|
|
glib_encoded_version = 'GLIB_VERSION_@0@_@1@'.format(glib_major_minor[0], glib_major_minor[1])
|
|
spice_common_global_cflags += ['-DGLIB_VERSION_MIN_REQUIRED=@0@'.format(glib_encoded_version),
|
|
'-DGLIB_VERSION_MAX_ALLOWED=@0@'.format(glib_encoded_version)]
|
|
|
|
add_project_arguments(compiler.get_supported_arguments(spice_common_global_cflags),
|
|
language : 'c')
|
|
|
|
#
|
|
# Subdirectories
|
|
#
|
|
subdir('python_modules')
|
|
subdir('common')
|
|
subdir('tests')
|
|
subdir('docs')
|
|
|
|
#
|
|
# write config.h
|
|
#
|
|
configure_file(output : 'config.h',
|
|
install : false,
|
|
configuration : spice_common_config_data)
|