2019-10-12 15:24:57 +00:00
|
|
|
project(
|
|
|
|
'wayvnc',
|
|
|
|
'c',
|
2023-10-04 22:47:04 +00:00
|
|
|
version: '0.8-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
|
|
|
],
|
|
|
|
)
|
|
|
|
|
2020-01-22 22:03:37 +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')
|
2020-01-22 22:03:37 +00:00
|
|
|
|
|
|
|
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',
|
2022-11-26 18:00:50 +00:00
|
|
|
|
|
|
|
'-Wno-unused-parameter',
|
2022-12-17 23:25:52 +00:00
|
|
|
'-Wno-missing-field-initializers',
|
2020-01-22 22:03:37 +00:00
|
|
|
]
|
|
|
|
|
2023-10-09 22:57:36 +00:00
|
|
|
version = '"@0@"'.format(meson.project_version())
|
2020-07-26 11:49:02 +00:00
|
|
|
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'])
|
2020-07-26 11:49:02 +00:00
|
|
|
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(),
|
2020-07-26 11:49:02 +00:00
|
|
|
git_branch.stdout().strip(),
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2023-10-09 22:57:36 +00:00
|
|
|
add_project_arguments('-DPROJECT_VERSION=@0@'.format(version), language: 'c')
|
|
|
|
|
2020-05-05 19:55:03 +00:00
|
|
|
if buildtype != 'debug' and buildtype != 'debugoptimized'
|
2020-01-22 22:03:37 +00:00
|
|
|
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')
|
2020-07-26 14:52:00 +00:00
|
|
|
gbm = dependency('gbm', required: get_option('screencopy-dmabuf'))
|
2020-06-23 23:04:01 +00:00
|
|
|
drm = dependency('libdrm')
|
2020-12-31 12:55:36 +00:00
|
|
|
xkbcommon = dependency('xkbcommon', version: '>=1.0.0')
|
2019-10-12 15:24:57 +00:00
|
|
|
wayland_client = dependency('wayland-client')
|
2022-10-24 13:05:26 +00:00
|
|
|
jansson = dependency('jansson')
|
2019-10-12 15:24:57 +00:00
|
|
|
|
2023-01-22 13:11:08 +00:00
|
|
|
aml_version = ['>=0.3.0', '<0.4.0']
|
2023-10-04 22:56:17 +00:00
|
|
|
neatvnc_version = ['>=0.7.0', '<0.9.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
|
|
|
)
|
|
|
|
|
2023-01-22 13:11:08 +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
|
2023-01-22 13:11:08 +00:00
|
|
|
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')
|
|
|
|
|
|
|
|
subdir('protocols')
|
|
|
|
|
|
|
|
sources = [
|
|
|
|
'src/main.c',
|
|
|
|
'src/strlcpy.c',
|
|
|
|
'src/shm.c',
|
|
|
|
'src/screencopy.c',
|
2020-09-16 22:13:40 +00:00
|
|
|
'src/data-control.c',
|
2019-10-13 12:38:47 +00:00
|
|
|
'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',
|
2019-12-29 11:47:31 +00:00
|
|
|
'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',
|
2022-10-29 23:12:47 +00:00
|
|
|
'src/util.c',
|
2022-10-24 13:05:26 +00:00
|
|
|
'src/json-ipc.c',
|
2022-10-17 12:23:40 +00:00
|
|
|
'src/ctl-server.c',
|
2022-11-26 21:26:30 +00:00
|
|
|
'src/ctl-commands.c',
|
2022-11-13 15:43:46 +00:00
|
|
|
'src/option-parser.c',
|
2023-01-06 18:22:56 +00:00
|
|
|
'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,
|
2022-10-24 13:05:26 +00:00
|
|
|
jansson,
|
2019-10-12 15:24:57 +00:00
|
|
|
]
|
|
|
|
|
2022-10-29 23:15:29 +00:00
|
|
|
ctlsources = [
|
|
|
|
'src/wayvncctl.c',
|
|
|
|
'src/util.c',
|
|
|
|
'src/json-ipc.c',
|
|
|
|
'src/ctl-client.c',
|
2022-12-06 12:12:02 +00:00
|
|
|
'src/ctl-commands.c',
|
2022-10-29 23:15:29 +00:00
|
|
|
'src/strlcpy.c',
|
2022-12-06 12:07:22 +00:00
|
|
|
'src/option-parser.c',
|
2023-01-06 18:22:56 +00:00
|
|
|
'src/table-printer.c',
|
2022-10-29 23:15:29 +00:00
|
|
|
]
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2020-07-26 14:52:00 +00:00
|
|
|
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
|
|
|
|
2022-10-29 23:15:29 +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')
|
2022-10-31 07:22:29 +00:00
|
|
|
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
|