wayvnc/meson.build

163 lines
3.4 KiB
Meson
Raw Normal View History

2019-10-12 15:24:57 +00:00
project(
'wayvnc',
'c',
2021-01-01 23:29:40 +00:00
version: '0.4.0',
2019-10-12 15:24:57 +00:00
license: 'ISC',
default_options: [
'c_std=gnu11',
],
)
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 = [
'-DPROJECT_VERSION="@0@"'.format(meson.project_version()),
2019-10-12 15:24:57 +00:00
'-D_GNU_SOURCE',
]
git = find_program('git', native: true, required: false)
if git.found()
git_describe = run_command([git, 'describe', '--tags', '--long'])
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'])
if git_describe.returncode() == 0 and git_branch.returncode() == 0
c_args += '-DGIT_VERSION="@0@ (@1@)"'.format(
git_describe.stdout().strip(),
git_branch.stdout().strip(),
)
endif
endif
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')
2019-10-12 15:24:57 +00:00
wayland_client = dependency('wayland-client')
neatvnc_version = '>=0.4.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
)
2020-03-16 22:01:43 +00:00
aml_project = subproject('aml', required: false)
if aml_project.found()
aml = aml_project.get_variable('aml_dep')
else
aml = dependency('aml')
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')
subdir('protocols')
sources = [
'src/main.c',
'src/strlcpy.c',
'src/shm.c',
'src/screencopy.c',
'src/data-control.c',
'src/output.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',
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,
]
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
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')
input = 'wayvnc.scd'
output = 'wayvnc.1'
custom_target(
output,
input: input,
output: output,
command: [
sh, '-c', '@0@ <@INPUT@ >@1@'.format(scdoc_prog.path(), output)
],
install: true,
2020-09-28 20:37:30 +00:00
install_dir: '@0@/man1'.format(mandir)
2020-09-26 14:43:46 +00:00
)
endif