fix(build): Conditionally include network module

This commit is contained in:
Michael Carlberg 2016-05-24 04:36:55 +02:00
parent 5418996b85
commit a6ebd3986f
2 changed files with 13 additions and 3 deletions

View File

@ -10,20 +10,26 @@ if(ENABLE_MPD)
"src/modules/mpd.cpp") "src/modules/mpd.cpp")
endif() endif()
if(ENABLE_NETWORK)
set(SOURCE_FILES_NETWORK
"src/interfaces/net.cpp"
"src/modules/network.cpp")
endif()
if(ENABLE_I3) if(ENABLE_I3)
set(SOURCE_FILES_I3 "src/modules/i3.cpp") set(SOURCE_FILES_I3 "src/modules/i3.cpp")
endif() endif()
set(SOURCE_FILES set(SOURCE_FILES
${SOURCE_FILES_ALSA} ${SOURCE_FILES_ALSA}
${SOURCE_FILES_MPD}
${SOURCE_FILES_I3} ${SOURCE_FILES_I3}
${SOURCE_FILES_MPD}
${SOURCE_FILES_NETWORK}
"src/drawtypes/animation.cpp" "src/drawtypes/animation.cpp"
"src/drawtypes/bar.cpp" "src/drawtypes/bar.cpp"
"src/drawtypes/icon.cpp" "src/drawtypes/icon.cpp"
"src/drawtypes/label.cpp" "src/drawtypes/label.cpp"
"src/drawtypes/ramp.cpp" "src/drawtypes/ramp.cpp"
"src/interfaces/net.cpp"
"src/modules/backlight.cpp" "src/modules/backlight.cpp"
"src/modules/base.cpp" "src/modules/base.cpp"
"src/modules/battery.cpp" "src/modules/battery.cpp"
@ -33,7 +39,6 @@ set(SOURCE_FILES
"src/modules/date.cpp" "src/modules/date.cpp"
"src/modules/memory.cpp" "src/modules/memory.cpp"
"src/modules/menu.cpp" "src/modules/menu.cpp"
"src/modules/network.cpp"
"src/modules/script.cpp" "src/modules/script.cpp"
"src/modules/text.cpp" "src/modules/text.cpp"
# "src/modules/torrent.cpp" # "src/modules/torrent.cpp"

View File

@ -21,6 +21,9 @@
#ifdef ENABLE_MPD #ifdef ENABLE_MPD
#include "modules/mpd.hpp" #include "modules/mpd.hpp"
#endif #endif
#ifdef ENABLE_NETWORK
#include "modules/network.hpp"
#endif
#ifdef ENABLE_ALSA #ifdef ENABLE_ALSA
#include "modules/volume.hpp" #include "modules/volume.hpp"
#endif #endif
@ -154,7 +157,9 @@ void Bar::load()
else if (type == "internal/cpu") module = std::make_unique<modules::CpuModule>(mod); else if (type == "internal/cpu") module = std::make_unique<modules::CpuModule>(mod);
else if (type == "internal/date") module = std::make_unique<modules::DateModule>(mod); else if (type == "internal/date") module = std::make_unique<modules::DateModule>(mod);
else if (type == "internal/memory") module = std::make_unique<modules::MemoryModule>(mod); else if (type == "internal/memory") module = std::make_unique<modules::MemoryModule>(mod);
#ifdef ENABLE_NETWORK
else if (type == "internal/network") module = std::make_unique<modules::NetworkModule>(mod); else if (type == "internal/network") module = std::make_unique<modules::NetworkModule>(mod);
#endif
#ifdef ENABLE_I3 #ifdef ENABLE_I3
else if (type == "internal/i3") module = std::make_unique<modules::i3Module>(mod, this->opts->monitor->name); else if (type == "internal/i3") module = std::make_unique<modules::i3Module>(mod, this->opts->monitor->name);
#endif #endif