2019-07-19 03:52:51 +08:00
|
|
|
project('compton', 'c', version: '7',
|
2018-12-20 07:37:45 +08:00
|
|
|
default_options: ['c_std=c11'])
|
2018-10-15 07:38:21 +08:00
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
2018-12-16 00:40:00 +08:00
|
|
|
# use project version by default
|
|
|
|
version = 'v'+meson.project_version()
|
|
|
|
|
|
|
|
# use git describe if that's available
|
2018-10-17 07:17:40 +08:00
|
|
|
git = find_program('git', required: false)
|
|
|
|
if git.found()
|
2019-07-31 05:22:21 +08:00
|
|
|
gitv = run_command('git', 'rev-parse', '--short=5', 'HEAD')
|
2018-10-17 07:17:40 +08:00
|
|
|
if gitv.returncode() == 0
|
2019-07-31 05:22:21 +08:00
|
|
|
version = 'vgit-'+gitv.stdout().strip()
|
2018-10-17 07:17:40 +08:00
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-10-16 17:29:52 +08:00
|
|
|
add_global_arguments('-DCOMPTON_VERSION="'+version+'"', language: 'c')
|
2018-10-15 07:38:21 +08:00
|
|
|
|
2018-10-15 18:16:32 +08:00
|
|
|
if get_option('buildtype') == 'release'
|
2018-12-20 07:37:45 +08:00
|
|
|
add_global_arguments('-DNDEBUG', language: 'c')
|
2018-10-15 18:16:32 +08:00
|
|
|
endif
|
|
|
|
|
2018-10-15 07:38:21 +08:00
|
|
|
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')
|
2019-04-03 15:36:02 +08:00
|
|
|
if cc.has_argument('-fno-sanitize=unsigned-integer-overflow')
|
|
|
|
add_global_arguments('-fno-sanitize=unsigned-integer-overflow', language: 'c')
|
|
|
|
endif
|
2018-10-15 07:38:21 +08:00
|
|
|
endif
|
|
|
|
|
2019-01-21 00:53:39 +08:00
|
|
|
if get_option('modularize')
|
|
|
|
if not cc.has_argument('-fmodules')
|
|
|
|
error('option \'modularize\' requires clang')
|
|
|
|
endif
|
|
|
|
add_global_arguments(['-fmodules',
|
|
|
|
'-fmodule-map-file='+
|
|
|
|
meson.current_source_dir()+
|
|
|
|
'/src/compton.modulemap'],
|
|
|
|
language: 'c')
|
|
|
|
endif
|
|
|
|
|
2018-10-15 07:38:21 +08:00
|
|
|
add_global_arguments('-D_GNU_SOURCE', language: 'c')
|
|
|
|
|
2019-04-14 10:45:04 +08:00
|
|
|
if cc.has_header('stdc-predef.h')
|
|
|
|
add_global_arguments('-DHAS_STDC_PREDEF_H', language: 'c')
|
|
|
|
endif
|
|
|
|
|
2019-07-25 08:02:23 +08:00
|
|
|
warns = [ 'all', 'cast-function-type', 'ignored-qualifiers', 'missing-parameter-type',
|
|
|
|
'nonnull', 'shadow', 'no-type-limits', 'old-style-declaration', 'override-init',
|
|
|
|
'sign-compare', 'type-limits', 'uninitialized', 'shift-negative-value',
|
|
|
|
'unused-but-set-parameter', 'unused-parameter', 'implicit-fallthrough',
|
2019-07-25 08:57:38 +08:00
|
|
|
'no-unknown-warning-option', 'no-missing-braces', 'conversion', 'empty-body' ]
|
2018-10-15 07:38:21 +08:00
|
|
|
foreach w : warns
|
|
|
|
if cc.has_argument('-W'+w)
|
|
|
|
add_global_arguments('-W'+w, language: 'c')
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
2019-03-19 06:34:59 +08:00
|
|
|
test_h_dep = subproject('test.h').get_variable('test_h_dep')
|
|
|
|
|
2018-10-15 07:38:21 +08:00
|
|
|
subdir('src')
|
|
|
|
subdir('man')
|
|
|
|
|
2019-10-23 03:32:42 +08:00
|
|
|
install_data('bin/compton-trans', install_dir: get_option('bindir'))
|
2018-10-15 07:38:21 +08:00
|
|
|
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')
|