refactor(build): Rename X extension flags

This commit is contained in:
Michael Carlberg 2016-11-30 12:46:26 +01:00
parent 2f3c2e952e
commit 6aba583c3e
15 changed files with 61 additions and 55 deletions

View File

@ -51,12 +51,12 @@ option(ENABLE_I3 "Enable i3 support" ON)
option(ENABLE_MPD "Enable mpd support" ON) option(ENABLE_MPD "Enable mpd support" ON)
option(ENABLE_NETWORK "Enable network support" ON) option(ENABLE_NETWORK "Enable network support" ON)
option(ENABLE_RANDR_EXT "Enable RandR X extension" ON) option(WITH_XRANDR "XRANDR support" ON)
option(ENABLE_RENDER_EXT "Enable Render X extension" OFF) option(WITH_XRENDER "XRENDER support" OFF)
option(ENABLE_DAMAGE_EXT "Enable Damage X extension" OFF) option(WITH_XDAMAGE "XDAMAGE support" OFF)
option(ENABLE_SYNC_EXT "Enable Sync X extension" OFF) option(WITH_XSYNC "XSYNC support" OFF)
option(ENABLE_COMPOSITE_EXT "Enable Sync X extension" OFF) option(WITH_XCOMPOSITE "XCOMPOSITE support" OFF)
option(ENABLE_XKB_EXT "Enable Sync X extension" ON) option(WITH_XKB "XKB support" ON)
# }}} # }}}
# Set cache vars {{{ # Set cache vars {{{

View File

@ -55,10 +55,10 @@ colored_option(STATUS " Enable i3 ${ENABLE_I3}" ENABLE_I3 "32;1" "37;
colored_option(STATUS " Enable mpd ${ENABLE_MPD}" ENABLE_MPD "32;1" "37;2") colored_option(STATUS " Enable mpd ${ENABLE_MPD}" ENABLE_MPD "32;1" "37;2")
colored_option(STATUS " Enable network ${ENABLE_NETWORK}" ENABLE_NETWORK "32;1" "37;2") colored_option(STATUS " Enable network ${ENABLE_NETWORK}" ENABLE_NETWORK "32;1" "37;2")
message(STATUS "--------------------------") message(STATUS "--------------------------")
colored_option(STATUS " Enable X RandR ${ENABLE_RANDR_EXT}" ENABLE_RANDR_EXT "32;1" "37;2") colored_option(STATUS " XRANDR support ${WITH_XRANDR}" WITH_XRANDR "32;1" "37;2")
colored_option(STATUS " Enable X Render ${ENABLE_RENDER_EXT}" ENABLE_RENDER_EXT "32;1" "37;2") colored_option(STATUS " XRENDER support ${WITH_XRENDER}" WITH_XRENDER "32;1" "37;2")
colored_option(STATUS " Enable X Damage ${ENABLE_DAMAGE_EXT}" ENABLE_DAMAGE_EXT "32;1" "37;2") colored_option(STATUS " XDAMAGE support ${WITH_XDAMAGE}" WITH_XDAMAGE "32;1" "37;2")
colored_option(STATUS " Enable X Sync ${ENABLE_SYNC_EXT}" ENABLE_SYNC_EXT "32;1" "37;2") colored_option(STATUS " XSYNC support ${WITH_XSYNC}" WITH_XSYNC "32;1" "37;2")
colored_option(STATUS " Enable X Composite ${ENABLE_COMPOSITE_EXT}" ENABLE_COMPOSITE_EXT "32;1" "37;2") colored_option(STATUS " XCOMPOSITE support ${WITH_XCOMPOSITE}" WITH_XCOMPOSITE "32;1" "37;2")
colored_option(STATUS " Enable X Xkb ${ENABLE_XKB_EXT}" ENABLE_XKB_EXT "32;1" "37;2") colored_option(STATUS " XKB support ${WITH_XKB}" WITH_XKB "32;1" "37;2")
message(STATUS "--------------------------") message(STATUS "--------------------------")

View File

@ -2,7 +2,7 @@
# Generate configuration file # Generate configuration file
# #
set(MODULES_LEFT "bspwm i3 mpd") set(MODULES_LEFT "bspwm i3")
set(MODULES_CENTER "xwindow") set(MODULES_CENTER "xwindow")
set(MODULES_RIGHT "backlight volume memory cpu wlan eth battery temperature date powermenu") set(MODULES_RIGHT "backlight volume memory cpu wlan eth battery temperature date powermenu")
@ -14,13 +14,10 @@ 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_MPD)
string(REPLACE " mpd" "" MODULES_LEFT ${MODULES_LEFT})
endif()
if(NOT ENABLE_NETWORK) if(NOT ENABLE_NETWORK)
string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT}) string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT})
endif() endif()
if(NOT ENABLE_RANDR_EXT) if(NOT WITH_XRANDR)
string(REPLACE "backlight " "" MODULES_RIGHT ${MODULES_RIGHT}) string(REPLACE "backlight " "" MODULES_RIGHT ${MODULES_RIGHT})
endif() endif()

View File

@ -1,12 +1,21 @@
#pragma once #pragma once
#include <assert.h>
#include <poll.h>
#include <stdio.h> #include <stdio.h>
#include <alsa/global.h>
#include <alsa/input.h>
#include <alsa/output.h>
#include <alsa/error.h>
#include <alsa/conf.h>
#include <alsa/pcm.h>
#include <alsa/control.h>
#include <alsa/mixer.h>
#include <cmath> #include <cmath>
#include <functional> #include <functional>
#include <string> #include <string>
#include <alsa/asoundlib.h>
#include "common.hpp" #include "common.hpp"
#include "config.hpp" #include "config.hpp"
#include "errors.hpp" #include "errors.hpp"

View File

@ -17,12 +17,12 @@
#cmakedefine01 ENABLE_NETWORK #cmakedefine01 ENABLE_NETWORK
#cmakedefine01 ENABLE_I3 #cmakedefine01 ENABLE_I3
#cmakedefine01 ENABLE_RANDR_EXT #cmakedefine01 WITH_XRANDR
#cmakedefine01 ENABLE_RENDER_EXT #cmakedefine01 WITH_XRENDER
#cmakedefine01 ENABLE_DAMAGE_EXT #cmakedefine01 WITH_XDAMAGE
#cmakedefine01 ENABLE_SYNC_EXT #cmakedefine01 WITH_XSYNC
#cmakedefine01 ENABLE_COMPOSITE_EXT #cmakedefine01 WITH_XCOMPOSITE
#cmakedefine01 ENABLE_XKB_EXT #cmakedefine01 WITH_XKB
#cmakedefine XPP_EXTENSION_LIST @XPP_EXTENSION_LIST@ #cmakedefine XPP_EXTENSION_LIST @XPP_EXTENSION_LIST@
#cmakedefine DEBUG_LOGGER #cmakedefine DEBUG_LOGGER

View File

@ -2,7 +2,7 @@
#include "config.hpp" #include "config.hpp"
#if not ENABLE_COMPOSITE_EXT #if not WITH_XCOMPOSITE
#error "X Composite extension is disabled..." #error "X Composite extension is disabled..."
#endif #endif

View File

@ -2,7 +2,7 @@
#include "config.hpp" #include "config.hpp"
#if not ENABLE_DAMAGE_EXT #if not WITH_XDAMAGE
#error "X Damage extension is disabled..." #error "X Damage extension is disabled..."
#endif #endif

View File

@ -2,21 +2,21 @@
#include "config.hpp" #include "config.hpp"
#if ENABLE_DAMAGE_EXT #if WITH_XDAMAGE
#include "x11/damage.hpp" #include "x11/damage.hpp"
#endif #endif
#if ENABLE_RENDER_EXT #if WITH_XRENDER
#include "x11/render.hpp" #include "x11/render.hpp"
#endif #endif
#if ENABLE_RANDR_EXT #if WITH_XRANDR
#include "x11/randr.hpp" #include "x11/randr.hpp"
#endif #endif
#if ENABLE_SYNC_EXT #if WITH_XSYNC
#include "x11/sync.hpp" #include "x11/sync.hpp"
#endif #endif
#if ENABLE_COMPOSITE_EXT #if WITH_XCOMPOSITE
#include "x11/composite.hpp" #include "x11/composite.hpp"
#endif #endif
#if ENABLE_XKB_EXT #if WITH_XKB
#include "x11/xkb.hpp" #include "x11/xkb.hpp"
#endif #endif

View File

@ -3,32 +3,32 @@
#include "common.hpp" #include "common.hpp"
namespace xpp { namespace xpp {
#if ENABLE_DAMAGE_EXT #if WITH_XDAMAGE
namespace damage { namespace damage {
class extension; class extension;
} }
#endif #endif
#if ENABLE_RANDR_EXT #if WITH_XRANDR
namespace randr { namespace randr {
class extension; class extension;
} }
#endif #endif
#if ENABLE_SYNC_EXT #if WITH_XSYNC
namespace sync { namespace sync {
class extension; class extension;
} }
#endif #endif
#if ENABLE_RENDER_EXT #if WITH_XRENDER
namespace render { namespace render {
class extension; class extension;
} }
#endif #endif
#if ENABLE_COMPOSITE_EXT #if WITH_XCOMPOSITE
namespace composite { namespace composite {
class extension; class extension;
} }
#endif #endif
#if ENABLE_XKB_EXT #if WITH_XKB
namespace xkb { namespace xkb {
class extension; class extension;
} }

View File

@ -2,7 +2,7 @@
#include "config.hpp" #include "config.hpp"
#if not ENABLE_RANDR_EXT #if not WITH_XRANDR
#error "X RandR extension is disabled..." #error "X RandR extension is disabled..."
#endif #endif

View File

@ -2,7 +2,7 @@
#include "config.hpp" #include "config.hpp"
#if not ENABLE_RENDER_EXT #if not WITH_XRENDER
#error "X Render extension is disabled..." #error "X Render extension is disabled..."
#endif #endif

View File

@ -2,7 +2,7 @@
#include "config.hpp" #include "config.hpp"
#if not ENABLE_SYNC_EXT #if not WITH_XSYNC
#error "X Sync extension is disabled..." #error "X Sync extension is disabled..."
#endif #endif

View File

@ -2,7 +2,7 @@
#include "config.hpp" #include "config.hpp"
#if not ENABLE_XKB_EXT #if not WITH_XKB
#error "X xkb extension is disabled..." #error "X xkb extension is disabled..."
#endif #endif

View File

@ -43,27 +43,27 @@ set(APP_INCLUDE_DIRS ${APP_INCLUDE_DIRS} ${CMAKE_CURRENT_BINARY_DIR})
# xpp library # xpp library
set(XCB_PROTOS xproto) set(XCB_PROTOS xproto)
if(ENABLE_RANDR_EXT) if(WITH_XRANDR)
set(XCB_PROTOS "${XCB_PROTOS}" randr) set(XCB_PROTOS "${XCB_PROTOS}" randr)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::randr::extension) set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::randr::extension)
endif() endif()
if(ENABLE_RENDER_EXT) if(WITH_XRENDER)
set(XCB_PROTOS "${XCB_PROTOS}" render) set(XCB_PROTOS "${XCB_PROTOS}" render)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::render::extension) set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::render::extension)
endif() endif()
if(ENABLE_DAMAGE_EXT) if(WITH_XDAMAGE)
set(XCB_PROTOS "${XCB_PROTOS}" damage) set(XCB_PROTOS "${XCB_PROTOS}" damage)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::damage::extension) set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::damage::extension)
endif() endif()
if(ENABLE_SYNC_EXT) if(WITH_XSYNC)
set(XCB_PROTOS "${XCB_PROTOS}" sync) set(XCB_PROTOS "${XCB_PROTOS}" sync)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::sync::extension) set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::sync::extension)
endif() endif()
if(ENABLE_COMPOSITE_EXT) if(WITH_XCOMPOSITE)
set(XCB_PROTOS "${XCB_PROTOS}" composite) set(XCB_PROTOS "${XCB_PROTOS}" composite)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::composite::extension) set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::composite::extension)
endif() endif()
if(ENABLE_XKB_EXT) if(WITH_XKB)
set(XCB_PROTOS "${XCB_PROTOS}" xkb) set(XCB_PROTOS "${XCB_PROTOS}" xkb)
set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::xkb::extension) set(XPP_EXTENSION_LIST ${XPP_EXTENSION_LIST} xpp::xkb::extension)
endif() endif()

View File

@ -53,35 +53,35 @@ void connection::query_extensions() {
return; return;
} }
#if ENABLE_DAMAGE_EXT #if WITH_XDAMAGE
damage().query_version(XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION); damage().query_version(XCB_DAMAGE_MAJOR_VERSION, XCB_DAMAGE_MINOR_VERSION);
if (!extension<xpp::damage::extension>()->present) if (!extension<xpp::damage::extension>()->present)
throw application_error("Missing X extension: Damage"); throw application_error("Missing X extension: Damage");
#endif #endif
#if ENABLE_RENDER_EXT #if WITH_XRENDER
render().query_version(XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION); render().query_version(XCB_RENDER_MAJOR_VERSION, XCB_RENDER_MINOR_VERSION);
if (!extension<xpp::render::extension>()->present) if (!extension<xpp::render::extension>()->present)
throw application_error("Missing X extension: Render"); throw application_error("Missing X extension: Render");
#endif #endif
#if ENABLE_RANDR_EXT #if WITH_XRANDR
randr().query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION); randr().query_version(XCB_RANDR_MAJOR_VERSION, XCB_RANDR_MINOR_VERSION);
if (!extension<xpp::randr::extension>()->present) { if (!extension<xpp::randr::extension>()->present) {
throw application_error("Missing X extension: RandR"); throw application_error("Missing X extension: RandR");
} }
#endif #endif
#if ENABLE_SYNC_EXT #if WITH_XSYNC
sync().initialize(XCB_SYNC_MAJOR_VERSION, XCB_SYNC_MINOR_VERSION); sync().initialize(XCB_SYNC_MAJOR_VERSION, XCB_SYNC_MINOR_VERSION);
if (!extension<xpp::sync::extension>()->present) { if (!extension<xpp::sync::extension>()->present) {
throw application_error("Missing X extension: Sync"); throw application_error("Missing X extension: Sync");
} }
#endif #endif
#if ENABLE_COMPOSITE_EXT #if WITH_XCOMPOSITE
composite().query_version(XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION); composite().query_version(XCB_COMPOSITE_MAJOR_VERSION, XCB_COMPOSITE_MINOR_VERSION);
if (!extension<xpp::composite::extension>()->present) { if (!extension<xpp::composite::extension>()->present) {
throw application_error("Missing X extension: Composite"); throw application_error("Missing X extension: Composite");
} }
#endif #endif
#if ENABLE_XKB_EXT #if WITH_XKB
xkb().use_extension(XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION); xkb().use_extension(XCB_XKB_MAJOR_VERSION, XCB_XKB_MINOR_VERSION);
if (!extension<xpp::xkb::extension>()->present) { if (!extension<xpp::xkb::extension>()->present) {
throw application_error("Missing X extension: Xkb"); throw application_error("Missing X extension: Xkb");