wayvnc/meson.build

225 lines
4.7 KiB
Meson
Raw Permalink Normal View History

2019-10-12 15:24:57 +00:00
project(
'wayvnc',
'c',
2024-02-25 12:11:31 +00:00
version: '0.9-dev',
2019-10-12 15:24:57 +00:00
license: 'ISC',
default_options: [
'c_std=gnu11',
2022-11-26 18:00:50 +00:00
'warning_level=2',
2019-10-12 15:24:57 +00:00
],
)
buildtype = get_option('buildtype')
2020-04-02 00:33:19 +00:00
host_system = host_machine.system()
2020-02-11 21:05:05 +00:00
prefix = get_option('prefix')
c_args = [
2019-10-12 15:24:57 +00:00
'-D_GNU_SOURCE',
2022-10-29 11:56:54 +00:00
'-DAML_UNSTABLE_API=1',
'-DWLR_USE_UNSTABLE=true',
2022-11-26 18:00:50 +00:00
'-Wno-unused-parameter',
2022-12-17 23:25:52 +00:00
'-Wno-missing-field-initializers',
]
2023-10-09 22:57:36 +00:00
version = '"@0@"'.format(meson.project_version())
git = find_program('git', native: true, required: false)
if git.found()
2023-10-09 22:57:36 +00:00
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'])
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'])
2023-10-09 22:57:36 +00:00
if git_commit.returncode() == 0 and git_branch.returncode() == 0
version = '"v@0@-@1@ (@2@)"'.format(
meson.project_version(),
git_commit.stdout().strip(),
git_branch.stdout().strip(),
)
endif
endif
2023-10-09 22:57:36 +00:00
add_project_arguments('-DPROJECT_VERSION=@0@'.format(version), language: 'c')
if buildtype != 'debug' and buildtype != 'debugoptimized'
c_args += '-DNDEBUG'
endif
add_project_arguments(c_args, language: 'c')
2019-10-12 15:24:57 +00:00
cc = meson.get_compiler('c')
libm = cc.find_library('m', required: false)
2020-03-16 22:01:43 +00:00
librt = cc.find_library('rt', required: false)
2020-10-16 18:47:27 +00:00
libpam = cc.find_library('pam', required: get_option('pam'))
2019-10-12 15:24:57 +00:00
pixman = dependency('pixman-1')
gbm = dependency('gbm', required: get_option('screencopy-dmabuf'))
2020-06-23 23:04:01 +00:00
drm = dependency('libdrm')
xkbcommon = dependency('xkbcommon', version: '>=1.0.0')
wayland_server = dependency('wayland-server')
2019-10-12 15:24:57 +00:00
wayland_client = dependency('wayland-client')
wayland_client_protocol = dependency('wayland-protocols')
wayland_cursor = dependency('wayland-cursor')
jansson = dependency('jansson')
2019-10-12 15:24:57 +00:00
# Cursor image
x11_dep = dependency('x11')
x11_fixes_dep = dependency('xfixes')
aml_version = ['>=0.3.0', '<0.4.0']
2024-02-25 12:11:31 +00:00
neatvnc_version = ['>=0.9', '<0.10.0']
2020-09-28 19:54:48 +00:00
2019-10-12 15:24:57 +00:00
neatvnc_project = subproject(
'neatvnc',
required: false,
2020-09-28 19:54:48 +00:00
version: neatvnc_version,
2019-10-12 15:24:57 +00:00
)
aml_project = subproject('aml', required: false, version: aml_version)
2020-03-16 22:01:43 +00:00
if aml_project.found()
aml = aml_project.get_variable('aml_dep')
else
aml = dependency('aml', version: aml_version)
2020-03-16 22:01:43 +00:00
endif
2019-10-12 15:24:57 +00:00
if neatvnc_project.found()
neatvnc = neatvnc_project.get_variable('neatvnc_dep')
else
2020-09-28 19:54:48 +00:00
neatvnc = dependency('neatvnc', version: neatvnc_version)
2019-10-12 15:24:57 +00:00
endif
inc = include_directories('include', '/usr/include/wlroots0.16')
2019-10-12 15:24:57 +00:00
subdir('protocols')
sources = [
'src/main.c',
'src/strlcpy.c',
'src/shm.c',
'src/screencopy.c',
'src/data-control.c',
'src/output.c',
2023-10-28 19:49:59 +00:00
'src/output-management.c',
2019-12-22 15:41:51 +00:00
'src/pointer.c',
2019-12-24 15:54:58 +00:00
'src/keyboard.c',
2019-12-31 13:55:25 +00:00
'src/seat.c',
'src/smooth.c',
2020-01-18 18:14:17 +00:00
'src/cfg.c',
2020-01-25 13:01:16 +00:00
'src/intset.c',
2020-06-20 21:07:58 +00:00
'src/buffer.c',
2020-06-21 11:54:46 +00:00
'src/pixels.c',
2020-06-21 14:03:00 +00:00
'src/transform-util.c',
'src/util.c',
'src/json-ipc.c',
'src/ctl-server.c',
'src/ctl-commands.c',
'src/option-parser.c',
'src/table-printer.c',
2019-10-12 15:24:57 +00:00
]
dependencies = [
libm,
2020-03-16 22:01:43 +00:00
librt,
2019-10-12 15:24:57 +00:00
pixman,
2020-03-16 22:01:43 +00:00
aml,
2020-06-23 18:30:08 +00:00
gbm,
2020-06-23 23:04:01 +00:00
drm,
2019-10-12 15:24:57 +00:00
wayland_client,
neatvnc,
2019-12-24 15:54:58 +00:00
xkbcommon,
2019-10-12 15:24:57 +00:00
client_protos,
jansson,
x11_dep,
x11_fixes_dep,
wayland_client_protocol,
wayland_cursor,
wayland_server
2019-10-12 15:24:57 +00:00
]
ctlsources = [
'src/wayvncctl.c',
'src/util.c',
'src/json-ipc.c',
'src/ctl-client.c',
'src/ctl-commands.c',
'src/strlcpy.c',
'src/option-parser.c',
'src/table-printer.c',
]
ctldependencies = [
jansson,
]
2020-02-11 21:05:05 +00:00
config = configuration_data()
config.set('PREFIX', '"' + prefix + '"')
2020-10-31 19:32:19 +00:00
if host_system == 'linux' and get_option('systemtap') and cc.has_header('sys/sdt.h')
2020-04-02 00:33:19 +00:00
config.set('HAVE_USDT', true)
endif
2020-04-05 21:43:24 +00:00
if cc.has_function('memfd_create')
config.set('HAVE_MEMFD', true)
config.set('HAVE_MEMFD_CREATE', true)
elif cc.has_function('SYS_memfd_create', prefix : '#include <sys/syscall.h>')
config.set('HAVE_MEMFD', true)
endif
if gbm.found() and not get_option('screencopy-dmabuf').disabled()
config.set('ENABLE_SCREENCOPY_DMABUF', true)
endif
2020-10-16 18:47:27 +00:00
if libpam.found()
dependencies += libpam
sources += 'src/pam_auth.c'
config.set('ENABLE_PAM', true)
endif
2020-02-11 21:05:05 +00:00
configure_file(
output: 'config.h',
configuration: config,
)
2019-10-12 15:24:57 +00:00
executable(
'wayvnc',
sources,
dependencies: dependencies,
include_directories: inc,
install: true,
)
2020-09-26 14:43:46 +00:00
executable(
'wayvncctl',
ctlsources,
dependencies: ctldependencies,
include_directories: inc,
install: true,
)
2020-09-26 14:43:46 +00:00
scdoc = dependency('scdoc', native: true, required: get_option('man-pages'))
if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
manpages = {
'wayvnc.scd': 'wayvnc.1',
'wayvncctl.scd': 'wayvncctl.1',
}
foreach input, output : manpages
custom_target(
output,
input: input,
output: output,
command: [
sh, '-c', '@0@ <@INPUT@ >@1@'.format(scdoc_prog.path(), output)
],
install: true,
install_dir: '@0@/man1'.format(mandir)
)
endforeach
2020-09-26 14:43:46 +00:00
endif
2022-12-17 23:25:52 +00:00
if get_option('tests')
subdir('test')
endif