summaryrefslogtreecommitdiff
path: root/meson.build
diff options
context:
space:
mode:
Diffstat (limited to 'meson.build')
-rw-r--r--meson.build88
1 files changed, 88 insertions, 0 deletions
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..12495da
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,88 @@
+project('timer', 'cpp',
+ version: '0.2',
+ default_options: [
+ 'warning_level=3',
+ 'cpp_std=c++17',
+ 'cpp_rtti=false'
+ ])
+
+cpp_optional_flags = [
+ '-fvisibility=hidden',
+ # Redefining explicit to be able to include xkb.h
+ '-Wno-keyword-macro',
+]
+cpp_flags = [
+ '-DVERSION="' + meson.project_version() + '"'
+]
+if get_option('buildtype') == 'release'
+ cpp_flags += '-DNDEBUG'
+endif
+
+cpp = meson.get_compiler('cpp')
+cpp_flags += cpp.get_supported_arguments(cpp_optional_flags)
+add_project_arguments(cpp_flags, language: 'cpp')
+
+thread_dep = dependency('threads')
+
+xcb_dep = [dependency('xcb', version: '>= 1.14'),
+ dependency('xcb-xkb', version: '>= 1.14'),
+ dependency('xcb-event', version: '>= 0.4.0'),
+ dependency('xcb-icccm', version: '>= 0.4.1'),
+ dependency('xcb-keysyms', version: '>= 0.4.0'),
+ dependency('xkbcommon-x11', version: '>= 1.0.3')]
+
+xcb_xrm_dep = dependency('xcb-xrm', version: '>= 1.3', required: false)
+
+dbus_dep = dependency('sdbus-c++', version: '>= 0.8.3')
+
+timer_sources = [
+ 'src/args.cc',
+ 'src/io.cc',
+ 'src/timer.cc',
+ 'src/timer_state.cc',
+ 'src/unique_fd.cc',
+ 'src/xcb_atoms.cc',
+ 'src/xcb_colors.cc',
+ 'src/xcb_connection.cc',
+ 'src/xcb_resource.cc',
+ 'src/xcb_xkb.cc',
+ 'src/xdg.cc',
+]
+
+if xcb_xrm_dep.found()
+ timer_sources += 'src/xcb_resources_xrm.cc'
+else
+ timer_sources += 'src/xcb_resources_none.cc'
+endif
+
+exe = executable('timer',
+ sources: timer_sources,
+ dependencies: [dbus_dep, thread_dep, xcb_dep, xcb_xrm_dep],
+ install: true)
+
+xdg_desktop_menu = find_program('xdg-desktop-menu', required: false,
+ native: true)
+if xdg_desktop_menu.found()
+ meson.add_install_script(xdg_desktop_menu, 'install', '--novendor',
+ files('data/org.the_jk.timer.desktop'))
+else
+ desktop_path = get_option('datadir') / 'applications'
+
+ install_data('data/org.the_jk.timer.desktop', install_dir : desktop_path)
+endif
+
+xdg_icon_resource = find_program('xdg-icon-resource', required: false,
+ native: true)
+if xdg_icon_resource.found()
+ meson.add_install_script(xdg_icon_resource, 'install', '--novendor',
+ '--size', '128', files('data/org.the_jk.timer.png'))
+else
+ icon_path = get_option('datadir') / 'icons' / 'hicolor' / '128x128' / 'apps'
+ install_data('data/org.the_jk.timer.png', install_dir : icon_path)
+
+ gtk_update_icon_cache = find_program('gtk-update-icon-cache',
+ required: false, native: true)
+ if gtk_update_icon_cache.found()
+ meson.add_install_script(gtk_update_icon_cache, icon_path)
+ endif
+endif