Add support for the meson build system

This commit is contained in:
Mario Limonciello
2025-06-25 22:32:43 -05:00
committed by Enrico Weigelt
parent ec59f57b9e
commit afb09b6d9e
6 changed files with 158 additions and 1 deletions

1
conf/meson.build Normal file
View File

@@ -0,0 +1 @@
install_data('10-amdgpu.conf', install_dir: configdir)

View File

@@ -1,5 +1,5 @@
.ds q \N'34'
.TH AMDGPU 4 2023-09-07 __vendorversion__
.TH AMDGPU 4 @vendorversion@
.SH NAME
amdgpu \- AMD RADEON GPU video driver
.SH SYNOPSIS

17
man/meson.build Normal file
View File

@@ -0,0 +1,17 @@
driver_name = 'amdgpu'
driver_man_suffix = '4'
input_name = '@0@.man'.format(driver_name)
output_name = '@0@.@1@'.format(driver_name, driver_man_suffix)
driverman_pre = '@0@.man'.format(driver_name)
man_data = configuration_data()
man_data.set('drivermansuffix', driver_man_suffix)
man_data.set('vendorversion', '@0@ @1@'.format(meson.project_name(), meson.project_version()))
configure_file(
input: input_name,
output: output_name,
configuration: man_data,
install: true,
install_dir: join_paths(get_option('mandir'), 'man' + driver_man_suffix),
)

92
meson.build Normal file
View File

@@ -0,0 +1,92 @@
project(
'xf86-video-amdgpu',
'c',
version: '23.0.0',
license: 'MIT',
meson_version: '>=0.59.0',
default_options: ['warning_level=1']
)
# Dependencies
xorg_dep = dependency('xorg-server', version: '>=1.18', required: true)
xproto_dep = dependency('xproto', required: true)
fontsproto_dep = dependency('fontsproto', required: true)
xf86driproto_dep = dependency('xf86driproto', required: true)
randrproto_dep = dependency('randrproto', required: true)
renderproto_dep = dependency('renderproto', required: true)
videoproto_dep = dependency('videoproto', required: true)
xextproto_dep = dependency('xextproto', version: '>=7.0.99.1', required: true)
libdrm_dep = dependency('libdrm', version: '>=2.4.121', required: true)
libdrm_amdgpu_dep = dependency('libdrm_amdgpu', version: '>=2.4.121', required: true)
gbm_dep = dependency('gbm', required: true)
# Optional dependencies
libudev_dep = dependency('libudev', required: get_option('udev'))
libgl_dep = dependency('gl', required: get_option('glamor'))
# Configurable directories
moduledir = join_paths(get_option('libdir'), get_option('moduledir'))
configdir = join_paths(get_option('prefix'), get_option('configdir'))
# Preprocessor definitions
add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
cc = meson.get_compiler('c')
have_gbm_bo_use_linear = cc.has_header_symbol('gbm.h', 'GBM_BO_USE_LINEAR')
have_gbm_bo_use_front_rendering = cc.has_header_symbol('gbm.h', 'GBM_BO_USE_FRONT_RENDERING')
have_byteswap = cc.has_header('byteswap.h')
xorg_include = xorg_dep.get_variable(pkgconfig: 'sdkdir')
have_fbGlyphs = cc.has_header('fbpict.h', args: ['-I' + xorg_include])
have_dri3_h = cc.has_header('dri3.h', args: ['-I' + xorg_include])
have_present_h = cc.has_header('present.h', args: ['-I' + xorg_include])
have_regionduplicate = cc.has_header('regionstr.h', args: ['-I' + xorg_include])
have_xf86CursorResetCursor = cc.has_header('xf86Cursor.h', args: ['-I' + xorg_include])
have_misyncshm = cc.has_header('misyncshm.h', args: ['-I' + xorg_include])
have_glamor = cc.has_header('glamor.h', args: ['-I' + xorg_include])
# Config header
version = meson.project_version()
varr = version.split('.')
major_version = varr[0]
minor_version = varr[1]
micro_version = varr[2]
config_h = configuration_data()
config_h.set('HAVE_DRI3_H', have_dri3_h ? 1 : 0)
config_h.set('HAVE_PRESENT_H', have_present_h ? 1 : 0)
config_h.set('HAVE_MISYNCSHM_H', have_misyncshm ? 1 : 0)
config_h.set('HAVE_FBGLYPHS', have_fbGlyphs ? 1 : 0)
config_h.set('HAVE_GBM_BO_USE_FRONT_RENDERING', have_gbm_bo_use_front_rendering ? 1 : 0)
config_h.set('HAVE_GBM_BO_USE_LINEAR', have_gbm_bo_use_linear ? 1 : 0)
config_h.set('HAVE_BYTESWAP_H', have_byteswap ? 1 : 0)
config_h.set('HAVE_GLAMOR_H', have_glamor ? 1 : 0)
config_h.set('HAVE_GLAMOR_FINISH', have_glamor ? 1 : 0)
config_h.set('USE_GLAMOR', get_option('glamor').allowed() ? 1 : 0)
config_h.set('HAVE_LIBUDEV', libudev_dep.found() ? 1 : 0)
config_h.set('HAVE_REGIONDUPLICATE', have_regionduplicate ? 1 : 0)
config_h.set('HAVE_XF86_CURSOR_RESET_CURSOR', have_xf86CursorResetCursor ? 1 : 0)
config_h.set('HAVE_XEXTPROTO_71', xextproto_dep.found() ? 1 : 0)
config_h.set('PACKAGE_NAME', meson.project_name())
config_h.set('PACKAGE_VERSION', version)
config_h.set('PACKAGE_VERSION_MAJOR', major_version)
config_h.set('PACKAGE_VERSION_MINOR', minor_version)
config_h.set('PACKAGE_VERSION_PATCHLEVEL', micro_version)
configure_file(
output: 'config.h',
configuration: config_h
)
subdir('src')
subdir('man')
subdir('conf')
summary({
'prefix': get_option('prefix'),
'exec_prefix': get_option('prefix'),
'libdir': get_option('libdir'),
'includedir': get_option('includedir'),
'configdir': configdir,
'moduledir': moduledir,
'CFLAGS': meson.get_compiler('c').get_supported_arguments(['-Wall']),
'GLAMOR': get_option('glamor'),
'LIBUDEV': libudev_dep,
}, section: 'Configuration')

4
meson_options.txt Normal file
View File

@@ -0,0 +1,4 @@
option('udev', type: 'feature', description: 'Enable libudev support')
option('glamor', type: 'feature', description: 'Enable glamor acceleration')
option('moduledir', type: 'string', value: 'xorg/modules', description: 'Xorg module directory')
option('configdir', type: 'string', value: 'share/X11/xorg.conf.d', description: 'Xorg.conf.d directory')

43
src/meson.build Normal file
View File

@@ -0,0 +1,43 @@
srcs = [
'amdgpu_bo_helper.c',
'amdgpu_dri2.c',
'amdgpu_dri3.c',
'amdgpu_drm_queue.c',
'amdgpu_glamor.c',
'amdgpu_glamor_wrappers.c',
'amdgpu_kms.c',
'amdgpu_misc.c',
'amdgpu_pixmap.c',
'amdgpu_probe.c',
'amdgpu_present.c',
'amdgpu_sync.c',
'amdgpu_video.c',
'drmmode_display.c',
]
amdgpu_drv_libs = [
fontsproto_dep,
gbm_dep,
libdrm_amdgpu_dep,
libdrm_dep,
randrproto_dep,
renderproto_dep,
videoproto_dep,
xextproto_dep,
xf86driproto_dep,
xorg_dep,
xproto_dep
]
if libudev_dep.found()
amdgpu_drv_libs += libudev_dep
endif
shared_module(
'amdgpu_drv',
srcs,
include_directories: include_directories('..'),
dependencies: amdgpu_drv_libs,
install: true,
install_dir: join_paths(moduledir, 'drivers'),
name_prefix: '',
)