fix(build): Remove disabled libs

This commit is contained in:
Michael Carlberg 2016-11-03 19:01:45 +01:00
parent 37ad86fa1c
commit d74dd7f3ef
4 changed files with 23 additions and 3 deletions

View File

@ -20,7 +20,7 @@ namespace io_util {
bool poll_read(int fd, int timeout_ms = 1);
bool poll_write(int fd, int timeout_ms = 1);
void interrupt_read(int write_fd);
bool interrupt_read(int write_fd);
}
LEMONBUDDY_NS_END

View File

@ -7,6 +7,7 @@ set(LIBRARY_NAME lib${PROJECT_NAME})
file(GLOB_RECURSE HEADERS RELATIVE ${PROJECT_SOURCE_DIR}/include *.h[p]*)
file(GLOB_RECURSE SOURCES RELATIVE ${PROJECT_SOURCE_DIR}/src *.c[p]*)
list(REMOVE_ITEM SOURCES main.cpp)
configure_file(
@ -14,6 +15,23 @@ configure_file(
${CMAKE_SOURCE_DIR}/include/config.hpp
ESCAPE_QUOTES @ONLY)
# Strip disabled libs {{{
if(NOT ENABLE_ALSA)
list(REMOVE_ITEM SOURCES adapters/alsa.cpp modules/volume.cpp)
endif()
if(NOT ENABLE_MPD)
list(REMOVE_ITEM SOURCES adapters/mpd.cpp modules/mpd.cpp)
endif()
if(NOT ENABLE_NETWORK)
list(REMOVE_ITEM SOURCES adapters/net.cpp modules/network.cpp)
endif()
if(NOT ENABLE_I3)
list(REMOVE_ITEM SOURCES modules/i3.cpp utils/i3.cpp)
endif()
# }}}
# Target: main library {{{
make_library(${LIBRARY_NAME} STATIC

View File

@ -1,4 +1,5 @@
#include <mutex>
#include <csignal>
#include "components/controller.hpp"
#include "components/signals.hpp"

View File

@ -109,9 +109,10 @@ namespace io_util {
return poll(fd, POLLOUT, timeout_ms);
}
void interrupt_read(int write_fd) {
bool interrupt_read(int write_fd) {
char end[1] = {'\n'};
(void)::write(write_fd, end, 1);
size_t bytes = ::write(write_fd, end, 1);
return bytes > 0;
}
}