2018-12-19 18:37:45 -05:00
|
|
|
project('compton', 'c', version: '4',
|
|
|
|
default_options: ['c_std=c11'])
|
2018-10-14 19:38:21 -04:00
|
|
|
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
2018-12-15 11:40:00 -05:00
|
|
|
# use project version by default
|
|
|
|
version = 'v'+meson.project_version()
|
|
|
|
|
|
|
|
# use git describe if that's available
|
2018-10-16 19:17:40 -04:00
|
|
|
git = find_program('git', required: false)
|
|
|
|
if git.found()
|
|
|
|
gitv = run_command('git', 'describe')
|
|
|
|
if gitv.returncode() == 0
|
|
|
|
version = gitv.stdout().strip()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
2018-10-16 05:29:52 -04:00
|
|
|
add_global_arguments('-DCOMPTON_VERSION="'+version+'"', language: 'c')
|
2018-10-14 19:38:21 -04:00
|
|
|
|
2018-10-15 06:16:32 -04:00
|
|
|
if get_option('buildtype') == 'release'
|
2018-12-19 18:37:45 -05:00
|
|
|
add_global_arguments('-DNDEBUG', language: 'c')
|
2018-10-15 06:16:32 -04:00
|
|
|
endif
|
|
|
|
|
2018-10-14 19:38:21 -04: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
|
|
|
|
|
2019-01-20 11:53:39 -05: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-14 19:38:21 -04:00
|
|
|
add_global_arguments('-D_GNU_SOURCE', language: 'c')
|
|
|
|
|
2018-11-03 18:15:38 -04:00
|
|
|
warns = [ 'all', 'extra', 'no-unused-parameter', 'nonnull', 'shadow', 'implicit-fallthrough' ]
|
2018-10-14 19:38:21 -04:00
|
|
|
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')
|