Add initial meson build scripts

This commit is contained in:
Yuxuan Shui 2018-10-15 00:38:21 +01:00
parent aa2098eefd
commit 4094d8b9c4
5 changed files with 114 additions and 1 deletions

8
man/meson.build Normal file
View File

@ -0,0 +1,8 @@
mans = ['compton.1', 'compton-trans.1']
a2x = find_program('a2x')
foreach m : mans
custom_target(m, output: [m], input: [m+'.asciidoc'],
command: [a2x, '--format', 'manpage', '@INPUT@',
'-D', meson.current_build_dir()],
install: true, install_dir: 'share/man/man1/')
endforeach

36
meson.build Normal file
View File

@ -0,0 +1,36 @@
project('compton', 'c')
cc = meson.get_compiler('c')
add_global_arguments('-std=c11', language: 'c')
if get_option('sanitize')
sanitizers = ['address', 'undefined']
if cc.has_argument('-fsanitize=integer')
sanitizers += ['integer']
endif
if cc.has_argument('-fsanitize=nullability')
sanitizers += ['nullability']
endif
add_global_arguments('-fsanitize='+','.join(sanitizers), language: 'c')
add_global_link_arguments('-fsanitize='+','.join(sanitizers), language: 'c')
endif
add_global_arguments('-D_GNU_SOURCE', language: 'c')
warns = [ 'all', 'extra', 'no-unused-parameter', 'nonnull', 'shadow' ]
foreach w : warns
if cc.has_argument('-W'+w)
add_global_arguments('-W'+w, language: 'c')
endif
endforeach
subdir('src')
subdir('man')
install_subdir('bin', install_dir: '')
install_data('compton.desktop', install_dir: 'share/applications')
install_data('media/icons/48x48/compton.png',
install_dir: 'share/icons/hicolor/48x48/apps')
install_data('media/compton.svg',
install_dir: 'share/icons/hicolor/scalable/apps')

11
meson_options.txt Normal file
View File

@ -0,0 +1,11 @@
option('sanitize', type: 'boolean', value: false, description: 'Compile compton with sanitizers')
option('xinerama', type: 'boolean', value: true, description: 'Enable XINERAMA support')
option('config_file', type: 'boolean', value: true, description: 'Enable config file support')
option('regex', type: 'boolean', value: true, description: 'Enable regex support in window conditions')
option('vsync_drm', type: 'boolean', value: false, description: 'Enable support for using drm for vsync')
option('opengl', type: 'boolean', value: true, description: 'Enable features that require opengl (opengl backend, and opengl vsync methods)')
option('dbus', type: 'boolean', value: true, description: 'Enable suport for D-Bus remote control')
option('xrescheck', type: 'boolean', value: false, description: 'Enable X resource leak checker (for debug only)')

View File

@ -1709,7 +1709,7 @@ cxfree(void *data) {
XFree(data); XFree(data);
} }
static inline void _Noreturn _Noreturn static inline void
die(const char *msg) { die(const char *msg) {
puts(msg); puts(msg);
exit(1); exit(1);

58
src/meson.build Normal file
View File

@ -0,0 +1,58 @@
deps = [ cc.find_library('m'), cc.find_library('ev') ]
cflags = [ '-DCONFIG_XSYNC' ]
srcs = ['compton.c', 'win.c', 'c2.c', 'x.c', 'config.c']
required_package =[
'x11', 'x11-xcb', 'xcb-renderutil',
'xcb-render', 'xcb-damage', 'xcb-randr',
'xcb-composite', 'xcb-shape', 'xcb-image',
'xcb-xfixes', 'xext', 'pixman-1']
foreach i : required_package
deps += [dependency(i, required: true)]
endforeach
if get_option('xinerama')
deps += [dependency('xcb-xinerama', required: true)]
cflags += ['-DCONFIG_XINERAMA']
endif
if get_option('config_file')
deps += [dependency('libconfig', version: '>=1.4', required: true)]
cflags += ['-DCONFIG_LIBCONFIG']
srcs += [ 'config_libconfig.c' ]
endif
if get_option('regex')
pcre = dependency('libpcre', required: true)
cflags += ['-DCONFIG_REGEX_PCRE']
if pcre.version().version_compare('>=8.20')
cflags += ['-DCONFIG_REGEX_PCRE_JIT']
endif
deps += [pcre]
endif
if get_option('vsync_drm')
cflags += ['-DCONFIG_VSYNC_DRM']
deps += [dependency('libdrm', required: true)]
endif
if get_option('opengl')
cflags += ['-DCONFIG_OPENGL']
deps += [dependency('gl', required: true)]
srcs += [ 'opengl.c' ]
endif
if get_option('dbus')
cflags += ['-DCONFIG_DBUS']
deps += [dependency('dbus-1', required: true)]
srcs += [ 'dbus.c' ]
endif
if get_option('xrescheck')
cflags += ['-DDEBUG_XRC']
srcs += [ 'xrescheck.c' ]
endif
executable('compton', srcs, c_args: cflags, dependencies: deps, install: true)