aboutsummaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build40
1 files changed, 26 insertions, 14 deletions
diff --git a/meson.build b/meson.build
index 0349b7d..1001ecb 100644
--- a/meson.build
+++ b/meson.build
@@ -1,12 +1,21 @@
-project('picom', 'c', version: '8',
- default_options: ['c_std=c11'])
+project('picom', 'c', version: '1',
+ default_options: ['c_std=c11', 'warning_level=1'])
cc = meson.get_compiler('c')
# use project version by default
-version = 'v0.2.2-4'
+version = 'v'+meson.project_version()
-add_global_arguments('-DCOMPTON_VERSION="'+version+'"', language: 'c')
+# use git describe if that's available
+git = find_program('git', required: false)
+if git.found()
+ gitv = run_command('git', 'rev-parse', '--short=5', 'HEAD', check: false)
+ if gitv.returncode() == 0
+ version = 'vgit-'+gitv.stdout().strip()
+ endif
+endif
+
+add_global_arguments('-DPICOM_VERSION="'+version+'"', language: 'c')
if get_option('buildtype') == 'release'
add_global_arguments('-DNDEBUG', language: 'c')
@@ -44,16 +53,18 @@ if cc.has_header('stdc-predef.h')
add_global_arguments('-DHAS_STDC_PREDEF_H', language: 'c')
endif
-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',
- 'no-unknown-warning-option', 'no-missing-braces', 'conversion', 'empty-body' ]
-foreach w : warns
- if cc.has_argument('-W'+w)
- add_global_arguments('-W'+w, language: 'c')
- endif
-endforeach
+if get_option('warning_level') != '0'
+ warns = [ '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=2',
+ 'no-unknown-warning-option', 'no-missing-braces', 'conversion', 'empty-body' ]
+ foreach w : warns
+ if cc.has_argument('-W'+w)
+ add_global_arguments('-W'+w, language: 'c')
+ endif
+ endforeach
+endif
test_h_dep = subproject('test.h').get_variable('test_h_dep')
@@ -61,3 +72,4 @@ subdir('src')
install_data('bin/picom-trans', install_dir: get_option('bindir'))
install_data('picom.desktop', install_dir: 'share/applications')
+install_data('picom.desktop', install_dir: get_option('sysconfdir') / 'xdg' / 'autostart')