From 1885ecc9583612bb578defd05e3d7e8b25af1f64 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 9 Aug 2019 09:52:16 +0000 Subject: [PATCH] bluetooth: limit to Linux due to missing /dev/rfkill ../src/modules/bluetooth.cpp:3:10: fatal error: 'linux/rfkill.h' file not found #include ^~~~~~~~~~~~~~~~ --- include/factory.hpp | 2 ++ meson.build | 4 ++-- src/factory.cpp | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/include/factory.hpp b/include/factory.hpp index e584b251..c698aa32 100644 --- a/include/factory.hpp +++ b/include/factory.hpp @@ -36,7 +36,9 @@ #include "bar.hpp" #include "modules/custom.hpp" #include "modules/temperature.hpp" +#if defined(__linux__) #include "modules/bluetooth.hpp" +#endif namespace waybar { diff --git a/meson.build b/meson.build index 5a8570c2..86e7ba4d 100644 --- a/meson.build +++ b/meson.build @@ -117,7 +117,6 @@ src_files = files( 'src/factory.cpp', 'src/AModule.cpp', 'src/ALabel.cpp', - 'src/modules/bluetooth.cpp', 'src/modules/clock.cpp', 'src/modules/custom.cpp', 'src/modules/disk.cpp', @@ -126,7 +125,6 @@ src_files = files( 'src/main.cpp', 'src/bar.cpp', 'src/client.cpp', - 'src/util/rfkill.cpp' ) if is_linux @@ -134,10 +132,12 @@ if is_linux add_project_arguments('-DHAVE_MEMORY_LINUX', language: 'cpp') src_files += files( 'src/modules/battery.cpp', + 'src/modules/bluetooth.cpp', 'src/modules/cpu/common.cpp', 'src/modules/cpu/linux.cpp', 'src/modules/memory/common.cpp', 'src/modules/memory/linux.cpp', + 'src/util/rfkill.cpp' ) elif is_dragonfly or is_freebsd or is_netbsd or is_openbsd add_project_arguments('-DHAVE_CPU_BSD', language: 'cpp') diff --git a/src/factory.cpp b/src/factory.cpp index 88a1322b..6005cad5 100644 --- a/src/factory.cpp +++ b/src/factory.cpp @@ -70,9 +70,11 @@ waybar::AModule* waybar::Factory::makeModule(const std::string& name) const { if (ref == "temperature") { return new waybar::modules::Temperature(id, config_[name]); } +#if defined(__linux__) if (ref == "bluetooth") { return new waybar::modules::Bluetooth(id, config_[name]); } +#endif if (ref.compare(0, 7, "custom/") == 0 && ref.size() > 7) { return new waybar::modules::Custom(ref.substr(7), id, config_[name]); }