Update cmake/config files to include dwmipcpp

Include dwmipcpp as a library in cmake and config files, so it can be built
automatically. The configuration of dwmicpp was added to match that of i3 and
bspwm to maintain the same cmake workflow and style.
This commit is contained in:
Mihir Lad 2020-07-13 20:06:52 -04:00
parent 6dac47f1c1
commit ad3666ed47
7 changed files with 34 additions and 2 deletions

View File

@ -75,7 +75,7 @@ endif()
# Generate configuration file # Generate configuration file
# #
set(MODULES_LEFT "bspwm i3") set(MODULES_LEFT "bspwm i3 dwm")
set(MODULES_CENTER "mpd") set(MODULES_CENTER "mpd")
set(MODULES_RIGHT "filesystem xbacklight alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu") set(MODULES_RIGHT "filesystem xbacklight alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu")
@ -98,6 +98,9 @@ endif()
if(NOT ENABLE_I3) if(NOT ENABLE_I3)
string(REPLACE " i3" "" MODULES_LEFT ${MODULES_LEFT}) string(REPLACE " i3" "" MODULES_LEFT ${MODULES_LEFT})
endif() endif()
if (NOT ENABLE_DWM)
string(REPLACE " dwm" "" MODULES_LEFT ${MODULES_LEFT})
endif()
if(NOT ENABLE_MPD) if(NOT ENABLE_MPD)
string(REPLACE "mpd" "" MODULES_CENTER ${MODULES_CENTER}) string(REPLACE "mpd" "" MODULES_CENTER ${MODULES_CENTER})
endif() endif()

View File

@ -23,6 +23,8 @@ usage() {
${COLORS[GREEN]}${COLORS[BOLD]}Options:${COLORS[OFF]} ${COLORS[GREEN]}${COLORS[BOLD]}Options:${COLORS[OFF]}
${COLORS[GREEN]}-3, --i3${COLORS[OFF]} ${COLORS[GREEN]}-3, --i3${COLORS[OFF]}
Include support for internal/i3 (requires i3); disabled by default. Include support for internal/i3 (requires i3); disabled by default.
${COLORS[GREEN]}-d, --dwm${COLORS[OFF]}
Include support for internal/dwm (requires dwm with IPC patch); disabled by default.
${COLORS[GREEN]}-a, --alsa${COLORS[OFF]} ${COLORS[GREEN]}-a, --alsa${COLORS[OFF]}
Include support for internal/alsa (requires alsalib); disabled by default. Include support for internal/alsa (requires alsalib); disabled by default.
${COLORS[GREEN]}-p, --pulseaudio${COLORS[OFF]} ${COLORS[GREEN]}-p, --pulseaudio${COLORS[OFF]}
@ -101,6 +103,7 @@ set_build_opts() {
if [[ "$AUTO" == ON ]]; then if [[ "$AUTO" == ON ]]; then
[[ -z "$USE_GCC" ]] && USE_GCC="OFF" [[ -z "$USE_GCC" ]] && USE_GCC="OFF"
[[ -z "$ENABLE_I3" ]] && ENABLE_I3="OFF" [[ -z "$ENABLE_I3" ]] && ENABLE_I3="OFF"
[[ -z "$ENABLE_DWM" ]] && ENABLE_DWM="OFF"
[[ -z "$ENABLE_ALSA" ]] && ENABLE_ALSA="OFF" [[ -z "$ENABLE_ALSA" ]] && ENABLE_ALSA="OFF"
[[ -z "$ENABLE_PULSEAUDIO" ]] && ENABLE_PULSEAUDIO="OFF" [[ -z "$ENABLE_PULSEAUDIO" ]] && ENABLE_PULSEAUDIO="OFF"
[[ -z "$ENABLE_NETWORK" ]] && ENABLE_NETWORK="OFF" [[ -z "$ENABLE_NETWORK" ]] && ENABLE_NETWORK="OFF"
@ -120,6 +123,11 @@ set_build_opts() {
[[ "${p^^}" != "Y" ]] && ENABLE_I3="OFF" || ENABLE_I3="ON" [[ "${p^^}" != "Y" ]] && ENABLE_I3="OFF" || ENABLE_I3="ON"
fi fi
if [[ -z "$ENABLE_DWM" ]]; then
read -r -p "$(msg "Include support for \"internal/dwm\" (requires dwm) -------------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_DWM="OFF" || ENABLE_DWM="ON"
fi
if [[ -z "$ENABLE_ALSA" ]]; then if [[ -z "$ENABLE_ALSA" ]]; then
read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) --------- [y/N]: ")" -n 1 p && echo read -r -p "$(msg "Include support for \"internal/alsa\" (requires alsalib) --------- [y/N]: ")" -n 1 p && echo
[[ "${p^^}" != "Y" ]] && ENABLE_ALSA="OFF" || ENABLE_ALSA="ON" [[ "${p^^}" != "Y" ]] && ENABLE_ALSA="OFF" || ENABLE_ALSA="ON"
@ -197,6 +205,7 @@ main() {
-DENABLE_ALSA:BOOL="${ENABLE_ALSA}" \ -DENABLE_ALSA:BOOL="${ENABLE_ALSA}" \
-DENABLE_PULSEAUDIO:BOOL="${ENABLE_PULSEAUDIO}"\ -DENABLE_PULSEAUDIO:BOOL="${ENABLE_PULSEAUDIO}"\
-DENABLE_I3:BOOL="${ENABLE_I3}" \ -DENABLE_I3:BOOL="${ENABLE_I3}" \
-DENABLE_DWM:BOOL="${ENABLE_DWM}" \
-DENABLE_MPD:BOOL="${ENABLE_MPD}" \ -DENABLE_MPD:BOOL="${ENABLE_MPD}" \
-DENABLE_NETWORK:BOOL="${ENABLE_NETWORK}" \ -DENABLE_NETWORK:BOOL="${ENABLE_NETWORK}" \
-DENABLE_CURL:BOOL="${ENABLE_CURL}" \ -DENABLE_CURL:BOOL="${ENABLE_CURL}" \
@ -223,6 +232,8 @@ while [[ "$1" == -* ]]; do
case "$1" in case "$1" in
-3|--i3) -3|--i3)
ENABLE_I3=ON; shift ;; ENABLE_I3=ON; shift ;;
-d|--dwm)
ENABLE_DWM=ON; shift ;;
-a|--alsa) -a|--alsa)
ENABLE_ALSA=ON; shift ;; ENABLE_ALSA=ON; shift ;;
-p|--pulseaudio) -p|--pulseaudio)
@ -237,6 +248,7 @@ while [[ "$1" == -* ]]; do
ENABLE_IPC_MSG=ON; shift ;; ENABLE_IPC_MSG=ON; shift ;;
--all-features) --all-features)
ENABLE_I3=ON ENABLE_I3=ON
ENABLE_DWM=ON
ENABLE_ALSA=ON ENABLE_ALSA=ON
ENABLE_PULSEAUDIO=ON ENABLE_PULSEAUDIO=ON
ENABLE_NETWORK=ON ENABLE_NETWORK=ON

View File

@ -6,6 +6,7 @@ checklib(BUILD_DOC "binary" "${SPHINX_BUILD}")
checklib(ENABLE_ALSA "pkg-config" alsa) checklib(ENABLE_ALSA "pkg-config" alsa)
checklib(ENABLE_CURL "pkg-config" libcurl) checklib(ENABLE_CURL "pkg-config" libcurl)
checklib(ENABLE_DWM "binary" dwm)
checklib(ENABLE_I3 "binary" i3) checklib(ENABLE_I3 "binary" i3)
checklib(ENABLE_MPD "pkg-config" libmpdclient) checklib(ENABLE_MPD "pkg-config" libmpdclient)
checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0) checklib(WITH_LIBNL "pkg-config" libnl-genl-3.0)
@ -35,6 +36,7 @@ option(BUILD_DOC "Build documentation" ON)
option(ENABLE_ALSA "Enable alsa support" ON) option(ENABLE_ALSA "Enable alsa support" ON)
option(ENABLE_CURL "Enable curl support" ON) option(ENABLE_CURL "Enable curl support" ON)
option(ENABLE_DWM "Enable dwm support" ON)
option(ENABLE_I3 "Enable i3 support" ON) option(ENABLE_I3 "Enable i3 support" ON)
option(ENABLE_MPD "Enable mpd support" ON) option(ENABLE_MPD "Enable mpd support" ON)
option(WITH_LIBNL "Use netlink interface for wireless" ON) option(WITH_LIBNL "Use netlink interface for wireless" ON)
@ -62,6 +64,8 @@ set(SETTING_ALSA_SOUNDCARD "default"
CACHE STRING "Name of the ALSA soundcard driver") CACHE STRING "Name of the ALSA soundcard driver")
set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket" set(SETTING_BSPWM_SOCKET_PATH "/tmp/bspwm_0_0-socket"
CACHE STRING "Path to bspwm socket") CACHE STRING "Path to bspwm socket")
set(SETTING_DWM_SOCKET_PATH "/tmp/dwm.sock"
CACHE STRING "Path to dwm socket")
set(SETTING_BSPWM_STATUS_PREFIX "W" set(SETTING_BSPWM_STATUS_PREFIX "W"
CACHE STRING "Prefix prepended to the bspwm status line") CACHE STRING "Prefix prepended to the bspwm status line")
set(SETTING_CONNECTION_TEST_IP "8.8.8.8" set(SETTING_CONNECTION_TEST_IP "8.8.8.8"

View File

@ -23,6 +23,7 @@ colored_option(" documentation" BUILD_DOC)
message(STATUS " Module support:") message(STATUS " Module support:")
colored_option(" alsa" ENABLE_ALSA) colored_option(" alsa" ENABLE_ALSA)
colored_option(" curl" ENABLE_CURL) colored_option(" curl" ENABLE_CURL)
colored_option(" dwm" ENABLE_DWM)
colored_option(" i3" ENABLE_I3) colored_option(" i3" ENABLE_I3)
colored_option(" mpd" ENABLE_MPD) colored_option(" mpd" ENABLE_MPD)
colored_option(" network (${WIRELESS_LIB})" ENABLE_NETWORK) colored_option(" network (${WIRELESS_LIB})" ENABLE_NETWORK)

View File

@ -12,6 +12,7 @@ extern const char* const APP_VERSION;
#cmakedefine01 ENABLE_NETWORK #cmakedefine01 ENABLE_NETWORK
#cmakedefine01 WITH_LIBNL #cmakedefine01 WITH_LIBNL
#cmakedefine01 ENABLE_I3 #cmakedefine01 ENABLE_I3
#cmakedefine01 ENABLE_DWM
#cmakedefine01 ENABLE_CURL #cmakedefine01 ENABLE_CURL
#cmakedefine01 ENABLE_PULSEAUDIO #cmakedefine01 ENABLE_PULSEAUDIO
@ -60,6 +61,7 @@ extern const char* const ALSA_SOUNDCARD;
extern const char* const BSPWM_SOCKET_PATH; extern const char* const BSPWM_SOCKET_PATH;
extern const char* const BSPWM_STATUS_PREFIX; extern const char* const BSPWM_STATUS_PREFIX;
extern const char* const CONNECTION_TEST_IP; extern const char* const CONNECTION_TEST_IP;
extern const char* const DWM_SOCKET_PATH;
extern const char* const PATH_ADAPTER; extern const char* const PATH_ADAPTER;
extern const char* const PATH_BACKLIGHT; extern const char* const PATH_BACKLIGHT;
extern const char* const PATH_BATTERY; extern const char* const PATH_BATTERY;

View File

@ -35,6 +35,14 @@ if(ENABLE_I3)
list(APPEND libs ${I3IPCPP_LIBRARIES}) list(APPEND libs ${I3IPCPP_LIBRARIES})
endif() endif()
# }}}
# Library: dwmipcpp {{{
if(ENABLE_DWM)
add_subdirectory(dwmipcpp)
list(APPEND libs ${DWMIPCPP_LIBRARIES})
endif()
# }}} # }}}
set(libs ${libs} PARENT_SCOPE) set(libs ${libs} PARENT_SCOPE)

View File

@ -12,6 +12,7 @@ const char* const ALSA_SOUNDCARD{"@SETTING_ALSA_SOUNDCARD@"};
const char* const BSPWM_SOCKET_PATH{"@SETTING_BSPWM_SOCKET_PATH@"}; const char* const BSPWM_SOCKET_PATH{"@SETTING_BSPWM_SOCKET_PATH@"};
const char* const BSPWM_STATUS_PREFIX{"@SETTING_BSPWM_STATUS_PREFIX@"}; const char* const BSPWM_STATUS_PREFIX{"@SETTING_BSPWM_STATUS_PREFIX@"};
const char* const CONNECTION_TEST_IP{"@SETTING_CONNECTION_TEST_IP@"}; const char* const CONNECTION_TEST_IP{"@SETTING_CONNECTION_TEST_IP@"};
const char* const DWM_SOCKET_PATH{"@SETTING_DWM_SOCKET_PATH@"};
const char* const PATH_ADAPTER{"@SETTING_PATH_ADAPTER@"}; const char* const PATH_ADAPTER{"@SETTING_PATH_ADAPTER@"};
const char* const PATH_BACKLIGHT{"@SETTING_PATH_BACKLIGHT@"}; const char* const PATH_BACKLIGHT{"@SETTING_PATH_BACKLIGHT@"};
const char* const PATH_BATTERY{"@SETTING_PATH_BATTERY@"}; const char* const PATH_BATTERY{"@SETTING_PATH_BATTERY@"};
@ -32,9 +33,10 @@ bool version_details(const std::vector<std::string>& args) {
// clang-format off // clang-format off
void print_build_info(bool extended) { void print_build_info(bool extended) {
printf("%s %s\n\n", APP_NAME, APP_VERSION); printf("%s %s\n\n", APP_NAME, APP_VERSION);
printf("Features: %calsa %ccurl %ci3 %cmpd %cnetwork(%s) %cpulseaudio %cxkeyboard\n", printf("Features: %calsa %ccurl %cdwm %ci3 %cmpd %cnetwork(%s) %cpulseaudio %cxkeyboard\n",
(ENABLE_ALSA ? '+' : '-'), (ENABLE_ALSA ? '+' : '-'),
(ENABLE_CURL ? '+' : '-'), (ENABLE_CURL ? '+' : '-'),
(ENABLE_DWM ? '+' : '-'),
(ENABLE_I3 ? '+' : '-'), (ENABLE_I3 ? '+' : '-'),
(ENABLE_MPD ? '+' : '-'), (ENABLE_MPD ? '+' : '-'),
(ENABLE_NETWORK ? '+' : '-'), (ENABLE_NETWORK ? '+' : '-'),