Waybar/meson.build

166 lines
4.6 KiB
Meson
Raw Normal View History

2018-08-10 14:37:03 +00:00
project(
'waybar', 'cpp', 'c',
2019-05-17 08:18:05 +00:00
version: '0.6.4',
2018-08-10 14:37:03 +00:00
license: 'MIT',
2018-08-30 09:30:20 +00:00
default_options : [
'cpp_std=c++17',
2018-11-08 08:57:24 +00:00
'buildtype=release',
'default_library=static'
2018-08-30 09:30:20 +00:00
],
2018-08-10 14:37:03 +00:00
)
2018-08-08 21:54:58 +00:00
2018-12-26 10:13:36 +00:00
cpp_args = []
2018-08-19 11:41:22 +00:00
cpp_link_args = []
2018-08-08 21:54:58 +00:00
if get_option('libcxx')
2018-08-08 21:54:58 +00: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 08:57:24 +00:00
compiler = meson.get_compiler('cpp')
2018-12-26 10:13:36 +00: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 08:57:24 +00: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 08:57:24 +00:00
endif
2018-08-08 21:54:58 +00: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'])
2018-08-08 21:54:58 +00:00
wayland_client = dependency('wayland-client')
wayland_cursor = dependency('wayland-cursor')
wayland_protos = dependency('wayland-protocols')
wlroots = dependency('wlroots', fallback: ['wlroots', 'wlroots'])
gtkmm = dependency('gtkmm-3.0')
2018-10-25 09:47:03 +00:00
dbusmenu_gtk = dependency('dbusmenu-gtk3-0.4', required: get_option('dbusmenu-gtk'))
2018-10-27 06:19:58 +00:00
giounix = dependency('gio-unix-2.0', required: get_option('dbusmenu-gtk'))
2018-08-08 21:54:58 +00:00
jsoncpp = dependency('jsoncpp')
sigcpp = dependency('sigc++-2.0')
2018-10-21 09:58:35 +00: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 14:34:37 +00:00
libmpdclient = dependency('libmpdclient', required: get_option('mpd'))
2018-08-08 21:54:58 +00:00
2018-08-20 15:20:02 +00:00
src_files = files(
'src/factory.cpp',
'src/ALabel.cpp',
'src/modules/memory.cpp',
'src/modules/battery.cpp',
'src/modules/clock.cpp',
'src/modules/custom.cpp',
'src/modules/cpu.cpp',
2019-02-17 14:27:54 +00:00
'src/modules/idle_inhibitor.cpp',
2019-03-13 12:18:08 +00:00
'src/modules/temperature.cpp',
2018-08-20 15:20:02 +00:00
'src/main.cpp',
'src/bar.cpp',
'src/client.cpp'
)
2018-08-08 21:54:58 +00:00
if true # find_program('sway', required : false).found()
2018-08-20 15:20:02 +00:00
add_project_arguments('-DHAVE_SWAY', language: 'cpp')
src_files += [
'src/modules/sway/ipc/client.cpp',
2018-10-30 12:39:30 +00:00
'src/modules/sway/mode.cpp',
2018-08-20 15:20:02 +00: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 09:47:03 +00:00
if dbusmenu_gtk.found()
add_project_arguments('-DHAVE_DBUSMENU', language: 'cpp')
src_files += files(
'src/modules/sni/tray.cpp',
2018-11-22 14:47:23 +00:00
'src/modules/sni/watcher.cpp',
'src/modules/sni/host.cpp',
'src/modules/sni/item.cpp'
2018-10-25 09:47:03 +00:00
)
endif
if libudev.found()
add_project_arguments('-DHAVE_LIBUDEV', language: 'cpp')
src_files += 'src/modules/backlight.cpp'
endif
2019-04-16 14:34:37 +00:00
if libmpdclient.found()
add_project_arguments('-DHAVE_LIBMPDCLIENT', language: 'cpp')
src_files += 'src/modules/mpd.cpp'
endif
2018-08-20 15:20:02 +00:00
subdir('protocol')
2018-08-16 12:29:41 +00:00
2018-08-08 21:54:58 +00:00
executable(
'waybar',
2018-08-16 12:29:41 +00:00
src_files,
2018-08-08 21:54:58 +00:00
dependencies: [
thread_dep,
wlroots,
client_protos,
wayland_client,
fmt,
sigcpp,
jsoncpp,
libinput,
wayland_cursor,
gtkmm,
2018-10-04 16:03:01 +00:00
dbusmenu_gtk,
2018-10-27 06:19:58 +00:00
giounix,
2018-08-09 14:38:24 +00:00
libnl,
libnlgen,
libpulse,
2019-04-16 14:34:37 +00:00
libudev,
libmpdclient
2018-08-08 21:54:58 +00:00
],
include_directories: [include_directories('include')],
install: true,
)
2018-08-09 15:02:30 +00:00
install_data(
'./resources/config',
'./resources/style.css',
install_dir: join_paths(get_option('out'), 'etc/xdg/waybar')
2018-08-09 15:02:30 +00:00
)
2018-08-16 12:29:41 +00: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