neatvnc/meson.build

219 lines
4.9 KiB
Meson
Raw Permalink Normal View History

2019-10-12 13:19:49 +00:00
project(
'neatvnc',
'c',
2024-02-25 11:13:01 +00:00
version: '0.9-dev',
2019-10-12 13:19:49 +00:00
license: 'ISC',
default_options: [
'c_std=gnu11',
2022-11-26 18:19:08 +00:00
'warning_level=2',
2019-10-12 13:19:49 +00:00
],
)
buildtype = get_option('buildtype')
2020-04-01 22:49:58 +00:00
host_system = host_machine.system()
c_args = [
2019-10-12 13:19:49 +00:00
'-D_GNU_SOURCE',
'-fvisibility=hidden',
2022-10-29 11:50:34 +00:00
'-DAML_UNSTABLE_API=1',
2022-11-26 18:19:08 +00:00
'-Wmissing-prototypes',
'-Wno-unused-parameter',
'-Wno-format-truncation',
]
if buildtype != 'debug' and buildtype != 'debugoptimized'
c_args += '-DNDEBUG'
endif
2019-10-12 13:19:49 +00:00
2023-10-09 22:54:18 +00:00
version = '"@0@"'.format(meson.project_version())
2020-07-26 11:43:00 +00:00
git = find_program('git', native: true, required: false)
if git.found()
2023-10-09 22:54:18 +00:00
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'])
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'])
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:43:00 +00:00
git_branch.stdout().strip(),
)
endif
endif
2023-10-09 22:54:18 +00:00
add_project_arguments('-DPROJECT_VERSION=@0@'.format(version), language: 'c')
2020-07-26 11:43:00 +00:00
libdrm_inc = dependency('libdrm').partial_dependency(compile_args: true)
add_project_arguments(c_args, language: 'c')
2019-10-13 12:16:24 +00:00
2019-10-12 13:19:49 +00:00
cc = meson.get_compiler('c')
libm = cc.find_library('m', required: false)
pixman = dependency('pixman-1')
libturbojpeg = dependency('libturbojpeg', required: get_option('jpeg'))
gnutls = dependency('gnutls', required: get_option('tls'))
2023-04-06 21:02:01 +00:00
nettle = dependency('nettle', required: get_option('nettle'))
2023-08-15 21:41:11 +00:00
hogweed = dependency('hogweed', required: get_option('nettle'))
gmp = dependency('gmp', required: get_option('nettle'))
zlib = dependency('zlib')
2021-09-12 18:01:58 +00:00
gbm = dependency('gbm', required: get_option('gbm'))
libdrm = dependency('libdrm', required: get_option('h264'))
2019-10-12 13:19:49 +00:00
2021-12-24 16:29:37 +00:00
libavcodec = dependency('libavcodec', required: get_option('h264'))
libavfilter = dependency('libavfilter', required: get_option('h264'))
libavutil = dependency('libavutil', required: get_option('h264'))
2023-01-22 13:05:33 +00:00
aml_version = ['>=0.3.0', '<0.4.0']
aml_project = subproject('aml', required: false, version: aml_version)
2020-03-16 20:09:22 +00:00
if aml_project.found()
aml = aml_project.get_variable('aml_dep')
else
2023-01-22 13:05:33 +00:00
aml = dependency('aml', version: aml_version)
2020-03-16 20:09:22 +00:00
endif
inc = include_directories('include')
2019-10-12 13:19:49 +00:00
sources = [
'src/server.c',
'src/vec.c',
'src/zrle.c',
'src/raw-encoding.c',
'src/pixels.c',
'src/fb.c',
2021-08-29 16:30:00 +00:00
'src/fb_pool.c',
2020-01-25 15:29:25 +00:00
'src/rcbuf.c',
'src/stream.c',
'src/stream-common.c',
'src/stream-tcp.c',
'src/desktop-layout.c',
'src/display.c',
'src/tight.c',
2020-09-26 16:10:25 +00:00
'src/enc-util.c',
'src/qnum-to-evdev.c',
2021-09-19 20:12:30 +00:00
'src/resampler.c',
'src/transform-util.c',
2021-09-20 21:15:32 +00:00
'src/damage-refinery.c',
2021-12-09 22:48:31 +00:00
'src/encoder.c',
2022-02-06 15:43:45 +00:00
'src/cursor.c',
2022-06-25 15:04:58 +00:00
'src/logging.c',
'src/base64.c',
2019-10-12 13:19:49 +00:00
]
dependencies = [
libm,
pixman,
2020-03-16 20:09:22 +00:00
aml,
zlib,
libdrm_inc,
2019-10-12 13:19:49 +00:00
]
2023-04-06 21:02:01 +00:00
enable_websocket = false
2019-12-31 10:13:21 +00:00
config = configuration_data()
if libturbojpeg.found()
dependencies += libturbojpeg
config.set('HAVE_JPEG', true)
2019-12-31 10:13:21 +00:00
endif
if gnutls.found()
sources += 'src/stream-gnutls.c'
dependencies += gnutls
config.set('ENABLE_TLS', true)
endif
2023-08-15 21:41:11 +00:00
if nettle.found() and hogweed.found() and gmp.found()
dependencies += [ nettle, hogweed, gmp ]
2023-04-06 21:02:01 +00:00
enable_websocket = true
config.set('HAVE_CRYPTO', true)
sources += ['src/crypto-nettle.c', 'src/stream-rsa-aes.c']
2023-04-06 21:02:01 +00:00
endif
if host_system == 'linux' and get_option('systemtap') and cc.has_header('sys/sdt.h')
2020-04-01 22:49:58 +00:00
config.set('HAVE_USDT', true)
endif
2021-09-12 18:01:58 +00:00
if gbm.found()
dependencies += gbm
config.set('HAVE_GBM', true)
endif
2024-03-10 16:21:21 +00:00
have_ffmpeg = gbm.found() and libdrm.found() and libavcodec.found() and libavfilter.found() and libavutil.found()
have_v4l2 = gbm.found() and libdrm.found() and cc.check_header('linux/videodev2.h')
if have_ffmpeg
sources += [ 'src/h264-encoder-ffmpeg-impl.c' ]
dependencies += [libdrm, libavcodec, libavfilter, libavutil]
2024-03-10 16:21:21 +00:00
config.set('HAVE_FFMPEG', true)
config.set('HAVE_LIBAVUTIL', true)
2021-12-24 16:29:37 +00:00
endif
2024-03-10 16:21:21 +00:00
if have_v4l2
sources += [ 'src/h264-encoder-v4l2m2m-impl.c' ]
config.set('HAVE_V4L2', true)
endif
if have_ffmpeg or have_v4l2
sources += [ 'src/h264-encoder.c', 'src/open-h264.c' ]
config.set('ENABLE_OPEN_H264', true)
endif
2023-04-06 21:02:01 +00:00
if enable_websocket
sources += [
'src/ws-handshake.c',
'src/ws-framing.c',
'src/http.c',
'src/stream-ws.c',
]
config.set('ENABLE_WEBSOCKET', true)
endif
if get_option('experimental')
if buildtype == 'release'
warning('Experimental features enabled in release build')
endif
config.set('ENABLE_EXPERIMENTAL', true)
endif
2019-12-31 10:13:21 +00:00
configure_file(
output: 'config.h',
configuration: config,
)
2020-07-22 04:37:35 +00:00
neatvnc = library(
2019-10-12 13:19:49 +00:00
'neatvnc',
sources,
2019-10-12 14:47:07 +00:00
version: '0.0.0',
2019-10-12 13:19:49 +00:00
dependencies: dependencies,
include_directories: inc,
install: true,
)
neatvnc_dep = declare_dependency(
include_directories: inc,
link_with: neatvnc,
)
2020-02-09 11:41:43 +00:00
if get_option('examples')
subdir('examples')
endif
2020-05-27 21:59:34 +00:00
if get_option('benchmarks')
subdir('bench')
endif
if get_option('tests')
subdir('test')
endif
2019-10-12 13:19:49 +00:00
install_headers('include/neatvnc.h')
2019-10-12 14:47:07 +00:00
pkgconfig = import('pkgconfig')
pkgconfig.generate(
libraries: neatvnc,
2019-10-12 14:47:07 +00:00
version: meson.project_version(),
filebase: meson.project_name(),
name: meson.project_name(),
description: 'A Neat VNC server library'
)