waybar/meson.build

239 lines
6.9 KiB
Meson
Raw Normal View History

2018-08-10 16:37:03 +02:00
project(
'waybar', 'cpp', 'c',
2019-12-28 12:35:09 +01:00
version: '0.9.0',
2018-08-10 16:37:03 +02:00
license: 'MIT',
2018-08-30 11:30:20 +02:00
default_options : [
'cpp_std=c++17',
2018-11-08 09:57:24 +01:00
'buildtype=release',
'default_library=static'
2018-08-30 11:30:20 +02:00
],
2018-08-10 16:37:03 +02:00
)
2018-08-08 23:54:58 +02:00
2018-12-26 11:13:36 +01:00
cpp_args = []
2018-08-19 13:41:22 +02:00
cpp_link_args = []
2018-08-08 23:54:58 +02:00
if get_option('libcxx')
2018-08-08 23:54:58 +02:00
cpp_args += ['-stdlib=libc++']
cpp_link_args += ['-stdlib=libc++', '-lc++abi']
cpp_link_args += ['-lc++fs']
else
cpp_link_args += ['-lstdc++fs']
endif
2018-11-08 09:57:24 +01:00
compiler = meson.get_compiler('cpp')
2018-12-26 11:13:36 +01:00
git = find_program('git', required: false)
if not git.found()
add_project_arguments('-DVERSION="@0@"'.format(meson.project_version()), language: 'cpp')
else
git_commit_hash = run_command([git.path(), 'describe', '--always', '--tags']).stdout().strip()
git_branch = run_command([git.path(), 'rev-parse', '--abbrev-ref', 'HEAD']).stdout().strip()
version = '"@0@ (" __DATE__ ", branch \'@1@\')"'.format(git_commit_hash, git_branch)
add_project_arguments('-DVERSION=@0@'.format(version), language: 'cpp')
endif
2018-11-08 09:57:24 +01:00
if not compiler.has_header('filesystem')
if compiler.has_header('experimental/filesystem')
add_project_arguments('-DFILESYSTEM_EXPERIMENTAL', language: 'cpp')
else
add_project_arguments('-DNO_FILESYSTEM', language: 'cpp')
warning('No filesystem header found, some modules may not work')
endif
2018-11-08 09:57:24 +01:00
endif
2018-08-08 23:54:58 +02:00
add_global_arguments(cpp_args, language : 'cpp')
add_global_link_arguments(cpp_link_args, language : 'cpp')
thread_dep = dependency('threads')
libinput = dependency('libinput')
fmt = dependency('fmt', version : ['>=5.3.0'], fallback : ['fmt', 'fmt_dep'])
2019-05-19 01:44:45 +02:00
spdlog = dependency('spdlog', version : ['>=1.3.1'], fallback : ['spdlog', 'spdlog_dep'])
2018-08-08 23:54:58 +02:00
wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
wayland_protos = dependency('wayland-protocols')
gtkmm = dependency('gtkmm-3.0', version : ['>=3.22.0'])
2018-10-25 11:47:03 +02:00
dbusmenu_gtk = dependency('dbusmenu-gtk3-0.4', required: get_option('dbusmenu-gtk'))
2018-10-27 08:19:58 +02:00
giounix = dependency('gio-unix-2.0', required: get_option('dbusmenu-gtk'))
2018-08-08 23:54:58 +02:00
jsoncpp = dependency('jsoncpp')
sigcpp = dependency('sigc++-2.0')
2018-10-21 11:58:35 +02:00
libnl = dependency('libnl-3.0', required: get_option('libnl'))
libnlgen = dependency('libnl-genl-3.0', required: get_option('libnl'))
libpulse = dependency('libpulse', required: get_option('pulseaudio'))
libudev = dependency('libudev', required: get_option('libudev'))
2019-04-16 16:34:37 +02:00
libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
gtk_layer_shell = dependency('gtk-layer-shell-0',
required: get_option('gtk-layer-shell'),
fallback : ['gtk-layer-shell', 'gtk_layer_shell_dep'])
systemd = dependency('systemd', required: get_option('systemd'))
tz_dep = dependency('date', default_options : [ 'use_system_tzdb=true' ], fallback: [ 'date', 'tz_dep' ])
2019-09-10 14:12:52 +02:00
prefix = get_option('prefix')
conf_data = configuration_data()
2019-09-10 14:12:52 +02:00
conf_data.set('prefix', prefix)
if systemd.found()
user_units_dir = systemd.get_pkgconfig_variable('systemduserunitdir')
configure_file(
configuration: conf_data,
input: './resources/waybar.service.in',
output: '@BASENAME@',
install_dir: user_units_dir
)
endif
2018-08-08 23:54:58 +02:00
2018-08-20 17:20:02 +02:00
src_files = files(
'src/factory.cpp',
2019-06-15 14:57:52 +02:00
'src/AModule.cpp',
2018-08-20 17:20:02 +02:00
'src/ALabel.cpp',
'src/modules/memory.cpp',
'src/modules/battery.cpp',
'src/modules/clock.cpp',
'src/modules/custom.cpp',
'src/modules/cpu.cpp',
2019-09-23 22:25:54 +02:00
'src/modules/disk.cpp',
2019-08-22 18:04:09 +02:00
'src/modules/idle_inhibitor.cpp',
2019-03-13 13:18:08 +01:00
'src/modules/temperature.cpp',
2018-08-20 17:20:02 +02:00
'src/main.cpp',
'src/bar.cpp',
'src/client.cpp'
)
2018-08-08 23:54:58 +02:00
if true # find_program('sway', required : false).found()
2018-08-20 17:20:02 +02:00
add_project_arguments('-DHAVE_SWAY', language: 'cpp')
src_files += [
'src/modules/sway/ipc/client.cpp',
2018-10-30 13:39:30 +01:00
'src/modules/sway/mode.cpp',
2018-08-20 17:20:02 +02:00
'src/modules/sway/window.cpp',
'src/modules/sway/workspaces.cpp'
]
endif
if libnl.found() and libnlgen.found()
add_project_arguments('-DHAVE_LIBNL', language: 'cpp')
src_files += 'src/modules/network.cpp'
endif
if libpulse.found()
add_project_arguments('-DHAVE_LIBPULSE', language: 'cpp')
src_files += 'src/modules/pulseaudio.cpp'
endif
2018-10-25 11:47:03 +02:00
if dbusmenu_gtk.found()
add_project_arguments('-DHAVE_DBUSMENU', language: 'cpp')
src_files += files(
'src/modules/sni/tray.cpp',
2018-11-22 15:47:23 +01:00
'src/modules/sni/watcher.cpp',
'src/modules/sni/host.cpp',
'src/modules/sni/item.cpp'
2018-10-25 11:47:03 +02:00
)
endif
if libudev.found()
add_project_arguments('-DHAVE_LIBUDEV', language: 'cpp')
src_files += 'src/modules/backlight.cpp'
endif
2019-04-16 16:34:37 +02:00
if libmpdclient.found()
add_project_arguments('-DHAVE_LIBMPDCLIENT', language: 'cpp')
src_files += 'src/modules/mpd.cpp'
endif
if gtk_layer_shell.found()
add_project_arguments('-DHAVE_GTK_LAYER_SHELL', language: 'cpp')
endif
2018-08-20 17:20:02 +02:00
subdir('protocol')
2018-08-16 14:29:41 +02:00
2018-08-08 23:54:58 +02:00
executable(
'waybar',
2018-08-16 14:29:41 +02:00
src_files,
2018-08-08 23:54:58 +02:00
dependencies: [
thread_dep,
client_protos,
wayland_client,
fmt,
2019-05-19 01:44:45 +02:00
spdlog,
2018-08-08 23:54:58 +02:00
sigcpp,
jsoncpp,
libinput,
wayland_cursor,
gtkmm,
2018-10-04 18:03:01 +02:00
dbusmenu_gtk,
2018-10-27 08:19:58 +02:00
giounix,
2018-08-09 16:38:24 +02:00
libnl,
libnlgen,
libpulse,
2019-04-16 16:34:37 +02:00
libudev,
libmpdclient,
gtk_layer_shell,
tz_dep
2018-08-08 23:54:58 +02:00
],
include_directories: [include_directories('include')],
install: true,
)
2018-08-09 17:02:30 +02:00
install_data(
'./resources/config',
'./resources/style.css',
install_dir: join_paths(get_option('out'), 'etc/xdg/waybar')
2018-08-09 17:02:30 +02:00
)
2018-08-16 14:29:41 +02:00
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
2019-08-22 18:04:09 +02:00
if scdoc.found()
scdoc_prog = find_program(scdoc.get_pkgconfig_variable('scdoc'), native: true)
sh = find_program('sh', native: true)
mandir = get_option('mandir')
man_files = [
'waybar.5.scd',
2019-08-24 16:39:46 +02:00
'waybar-backlight.5.scd',
2019-08-24 18:44:29 +02:00
'waybar-battery.5.scd',
2019-08-26 14:31:57 +02:00
'waybar-clock.5.scd',
2019-08-26 14:23:11 +02:00
'waybar-cpu.5.scd',
2019-08-26 14:42:59 +02:00
'waybar-custom.5.scd',
2019-09-25 09:07:46 +02:00
'waybar-disk.5.scd',
2019-08-26 16:06:20 +02:00
'waybar-idle-inhibitor.5.scd',
2019-08-26 16:12:42 +02:00
'waybar-memory.5.scd',
2019-08-26 16:23:07 +02:00
'waybar-mpd.5.scd',
2019-08-26 18:42:30 +02:00
'waybar-network.5.scd',
2019-08-26 18:50:16 +02:00
'waybar-pulseaudio.5.scd',
2019-08-26 18:55:20 +02:00
'waybar-sway-mode.5.scd',
2019-08-26 19:00:46 +02:00
'waybar-sway-window.5.scd',
2019-08-26 19:08:06 +02:00
'waybar-sway-workspaces.5.scd',
2019-08-26 19:13:48 +02:00
'waybar-temperature.5.scd',
2019-08-26 19:15:58 +02:00
'waybar-tray.5.scd',
2019-08-26 23:49:04 +02:00
'waybar-states.5.scd',
2019-08-22 18:04:09 +02:00
]
foreach filename : man_files
topic = filename.split('.')[-3].split('/')[-1]
section = filename.split('.')[-2]
output = '@0@.@1@'.format(topic, section)
custom_target(
output,
2019-08-26 14:11:06 +02:00
input: 'man/@0@'.format(filename),
2019-08-22 18:04:09 +02:00
output: output,
command: [
sh, '-c', '@0@ < @INPUT@ > @1@'.format(scdoc_prog.path(), output)
],
install: true,
install_dir: '@0@/man@1@'.format(mandir, section)
)
endforeach
endif
2018-08-16 14:29:41 +02:00
clangtidy = find_program('clang-tidy', required: false)
if clangtidy.found()
run_target(
'tidy',
command: [
clangtidy,
'-checks=*,-fuchsia-default-arguments',
'-p', meson.build_root()
] + src_files)
endif