2018-10-17 07:17:40 +08:00
|
|
|
project('compton', 'c', version: '2')
|
2018-10-15 07:38:21 +08:00
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
2018-10-17 07:17:40 +08:00
|
|
|
version = ''
|
|
|
|
git = find_program('git', required: false)
|
|
|
|
if git.found()
|
|
|
|
gitv = run_command('git', 'describe')
|
|
|
|
if gitv.returncode() == 0
|
|
|
|
version = gitv.stdout().strip()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
if version == ''
|
|
|
|
# use project version by default
|
|
|
|
version = 'v'+meson.project_version()
|
|
|
|
endif
|
2018-10-16 17:29:52 +08:00
|
|
|
|
2018-10-15 07:38:21 +08:00
|
|
|
add_global_arguments('-std=c11', language: 'c')
|
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'
|
|
|
|
add_global_arguments('-DNDEBUG', language: 'c')
|
|
|
|
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')
|
|
|
|
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')
|