aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build191
1 files changed, 124 insertions, 67 deletions
diff --git a/meson.build b/meson.build
index 9c878bd5..ddb74daa 100644
--- a/meson.build
+++ b/meson.build
@@ -23,9 +23,9 @@
project(
'virglrenderer', 'c',
- version: '0.9.0',
+ version: '0.10.4',
license : 'MIT',
- meson_version : '>= 0.46',
+ meson_version : '>= 0.53',
default_options : ['buildtype=release', 'b_ndebug=if-release',
'warning_level=3', 'c_std=gnu11']
)
@@ -37,58 +37,51 @@ project(
# interface age
# 3. If the ABI has changed in an incompatible way increment the binary_age
# and set revision and interface_age to zero
-
binary_age = 1
-interface_age = 5
-revision = 3
+interface_age = 7
+revision = 7
cc = meson.get_compiler('c')
-add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c')
-add_project_arguments('-D_GNU_SOURCE=1', language : 'c')
-add_project_arguments('-DVIRGL_RENDERER_UNSTABLE_APIS', language : 'c')
+if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.1')
+ error('When using GCC, version 4.1 or later is required.')
+endif
warnings = [
'-Werror=implicit-function-declaration',
'-Werror=missing-prototypes',
'-Wmissing-prototypes',
+ '-Werror=incompatible-pointer-types',
'-Werror=int-to-pointer-cast',
'-Wno-overlength-strings',
]
-foreach w : warnings
- if cc.has_argument(w)
- add_project_arguments(w, language : 'c')
- endif
-endforeach
+add_project_arguments(cc.get_supported_arguments(warnings), language : 'c')
flags = [
'-fvisibility=hidden',
]
-foreach f : flags
- if cc.has_argument(f)
- add_project_arguments(f, language : 'c')
- endif
-endforeach
+add_project_arguments(cc.get_supported_arguments(flags), language : 'c')
prog_python = import('python').find_installation('python3')
libdrm_dep = dependency('libdrm', version : '>=2.4.50')
thread_dep = dependency('threads')
epoxy_dep = dependency('epoxy', version: '>= 1.5.4')
-m_dep = cc.find_library('m')
+m_dep = cc.find_library('m', required : false)
conf_data = configuration_data()
-conf_data.set('VERSION', '0.8.1')
+conf_data.set('VERSION', meson.project_version())
+conf_data.set('_GNU_SOURCE', 1)
+conf_data.set('VIRGL_RENDERER_UNSTABLE_APIS', 1)
with_tracing = get_option('tracing')
if with_tracing != 'none'
- if not cc.compiles('void f(void* v){} int main () { void *dummy __attribute__((cleanup (f))) = 0;}')
- error('Tracing requires compiler support for __attribute__((cleanup))')
-endif
-
+ if not cc.compiles('void f(void* v){} int main () { void *dummy __attribute__((cleanup (f))) = 0;}')
+ error('Tracing requires compiler support for __attribute__((cleanup))')
+ endif
endif
if with_tracing == 'percetto'
@@ -116,8 +109,15 @@ if cc.has_header('dlfcn.h')
conf_data.set('HAVE_DLFCN_H', 1)
endif
-if cc.has_header('pthread.h')
- conf_data.set('HAVE_PTHREAD', 1)
+if thread_dep.found() and host_machine.system() != 'windows'
+ conf_data.set('HAVE_PTHREAD', 1)
+ if host_machine.system() != 'netbsd' and cc.has_function(
+ 'pthread_setaffinity_np',
+ dependencies : thread_dep,
+ prefix : '#include <pthread.h>',
+ args : '-D_GNU_SOURCE')
+ conf_data.set('HAVE_PTHREAD_SETAFFINITY', 1)
+ endif
endif
if cc.has_header('sys/eventfd.h')
@@ -128,10 +128,33 @@ if cc.has_header('sys/select.h')
conf_data.set('HAVE_SYS_SELECT_H', 1)
endif
+foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'expect', 'ffs', 'ffsll',
+ 'popcount', 'popcountll', 'types_compatible_p', 'unreachable']
+ if cc.has_function(b)
+ conf_data.set('HAVE___BUILTIN_@0@'.format(b.to_upper()), 1)
+ endif
+endforeach
+
+supported_function_attributes = cc.get_supported_function_attributes([
+ 'const', 'flatten', 'format', 'malloc', 'noreturn', 'packed', 'pure',
+ 'returns_nonnull', 'unused', 'warn_unused_result', 'weak',
+])
+foreach a : supported_function_attributes
+ conf_data.set('HAVE_FUNC_ATTRIBUTE_@0@'.format(a.to_upper()), 1)
+endforeach
+
+foreach f : ['memfd_create', 'strtok_r', 'timespec_get']
+ if cc.has_function(f)
+ conf_data.set('HAVE_@0@'.format(f.to_upper()), 1)
+ endif
+endforeach
+
if host_machine.endian() == 'little'
- conf_data.set('PIPE_ARCH_LITTLE_ENDIAN', true)
+ conf_data.set('UTIL_ARCH_LITTLE_ENDIAN', 1)
+ conf_data.set('UTIL_ARCH_BIG_ENDIAN', 0)
elif host_machine.endian() == 'big'
- conf_data.set('PIPE_ARCH_BIG_ENDIAN', true)
+ conf_data.set('UTIL_ARCH_LITTLE_ENDIAN', 0)
+ conf_data.set('UTIL_ARCH_BIG_ENDIAN', 1)
else
error('It wasn\'t possible to figure out the endianess of the machine')
endif
@@ -184,7 +207,12 @@ if with_egl
if cc.has_header('epoxy/egl.h', dependencies: epoxy_dep) and epoxy_dep.get_pkgconfig_variable('epoxy_has_egl') == '1'
gbm_dep = dependency('gbm', version: '>= ' + _gbm_ver, required: require_egl)
have_egl = gbm_dep.found()
- conf_data.set('HAVE_EPOXY_EGL_H', 1)
+ if (have_egl)
+ conf_data.set('HAVE_EPOXY_EGL_H', 1)
+ else
+ assert(not require_egl,
+ 'egl was explicitely requested which requires gbm, and this is not available')
+ endif
else
assert(not require_egl,
'egl was explicitely requested but it is not supported by epoxy')
@@ -213,27 +241,58 @@ if with_venus
endif
endif
-if cc.compiles('void __attribute__((hidden)) func() {}')
- conf_data.set('HAVE_FUNC_ATTRIBUTE_VISIBILITY', 1)
+have_vla = not cc.has_header_symbol('stdlib.h', '__STDC_NO_VLA__')
+
+# drm/msm support requires the compiler to support VLA:
+with_drm_msm = have_vla and get_option('drm-msm-experimental')
+if with_drm_msm
+ conf_data.set('ENABLE_DRM', 1)
+ conf_data.set('ENABLE_DRM_MSM', 1)
+endif
+with_drm = with_drm_msm
+
+with_check_gl_errors = get_option('check-gl-errors')
+if with_check_gl_errors
+ conf_data.set('CHECK_GL_ERRORS', 1)
+endif
+
+with_render_server = get_option('render-server')
+with_render_server_worker = get_option('render-server-worker')
+render_server_install_dir = get_option('prefix') / get_option('libexecdir')
+if with_render_server
+ if not with_venus
+ error('render server makes no sense without venus currently')
+ endif
+
+ conf_data.set('ENABLE_RENDER_SERVER', 1)
+ conf_data.set('RENDER_SERVER_EXEC_PATH',
+ '"' + render_server_install_dir / 'virgl_render_server' + '"')
+
+ if with_render_server_worker == 'process'
+ conf_data.set('ENABLE_RENDER_SERVER_WORKER_PROCESS', 1)
+ elif with_render_server_worker == 'thread'
+ conf_data.set('ENABLE_RENDER_SERVER_WORKER_THREAD', 1)
+ elif with_render_server_worker == 'minijail'
+ conf_data.set('ENABLE_RENDER_SERVER_WORKER_MINIJAIL', 1)
+ minijail_dep = dependency('libminijail')
+ else
+ error('unknown render server worker ' + with_render_server_worker)
+ endif
+endif
+
+with_video = get_option('video')
+if with_video
+ conf_data.set('ENABLE_VIDEO', 1)
+ libva_dep = dependency('libva')
+ libvadrm_dep = dependency('libva-drm')
endif
configure_file(input : 'config.h.meson',
output : 'config.h',
configuration : conf_data)
-pkgconf_data = configuration_data()
-pkgconf_data.set('PACKAGE_VERSION', meson.project_version())
-pkgconf_data.set('prefix', get_option('prefix'))
-pkgconf_data.set('exec_prefix', '${prefix}')
-pkgconf_data.set('libdir', '${prefix}/' + get_option('libdir'))
-pkgconf_data.set('includedir', '${prefix}/' + get_option('includedir'))
-
-pkg_config = configure_file(input : 'virglrenderer.pc.in',
- output : 'virglrenderer.pc',
- configuration : pkgconf_data)
-
-install_data(pkg_config,
- install_dir: get_option('libdir') + '/pkgconfig')
+add_project_arguments('-imacros', meson.build_root() / 'config.h', language : 'c')
+add_project_arguments('-DHAVE_CONFIG_H=1', language : 'c')
inc_configuration = include_directories(['.', 'src'])
@@ -244,30 +303,28 @@ with_valgrind = get_option('valgrind')
subdir('src')
subdir('vtest')
+if with_render_server
+subdir('server')
+endif
+
if with_tests
+ assert(have_egl, 'Tests require EGL, but it is not available')
subdir('tests')
endif
-lines = [
- '',
- 'prefix: ' + get_option('prefix'),
- 'libdir: ' + get_option('libdir'),
- '',
- 'c_args: ' + (' ').join(get_option('c_args')),
- '',
-]
-
-lines += 'egl: ' + (have_egl ? 'yes' : 'no')
-lines += 'glx: ' + (have_glx ? 'yes' : 'no')
-lines += ''
-lines += 'minigbm_alloc: ' + (with_minigbm_allocation ? 'yes' : 'no' )
-lines += ''
-lines += 'venus: ' + (with_venus ? 'yes' : 'no' )
-lines += ''
-lines += 'tests: ' + (with_tests ? 'yes' : 'no' )
-lines += 'fuzzer: ' + (with_fuzzer ? 'yes' : 'no' )
-lines += 'tracing: ' + with_tracing
-
-indent = ' '
-summary = indent + ('\n' + indent).join(lines)
-message('\n\nConfiguration summary:\n@0@\n'.format(summary))
+summary({'prefix': get_option('prefix'),
+ 'libdir': get_option('libdir'),
+ }, section: 'Directories')
+summary({'c_args': (' ').join(get_option('c_args')),
+ 'egl': have_egl,
+ 'glx': have_glx,
+ 'minigbm_alloc': with_minigbm_allocation,
+ 'venus': with_venus,
+ 'drm-msm': with_drm_msm,
+ 'render server': with_render_server,
+ 'render server worker': with_render_server ? with_render_server_worker : 'none',
+ 'video': with_video,
+ 'tests': with_tests,
+ 'fuzzer': with_fuzzer,
+ 'tracing': with_tracing,
+ }, section: 'Configuration')