Skip to content

Commit

Permalink
Add initial meson build scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
yshui committed Oct 14, 2018
1 parent aa2098e commit 4094d8b
Show file tree
Hide file tree
Showing 5 changed files with 114 additions and 1 deletion.
8 changes: 8 additions & 0 deletions man/meson.build
Original file line number Diff line number Diff line change
@@ -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 changes: 36 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -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 changes: 11 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
@@ -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)')
2 changes: 1 addition & 1 deletion src/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1709,7 +1709,7 @@ cxfree(void *data) {
XFree(data);
}

static inline void _Noreturn
_Noreturn static inline void
die(const char *msg) {
puts(msg);
exit(1);
Expand Down
58 changes: 58 additions & 0 deletions src/meson.build
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit 4094d8b

Please sign in to comment.