From 1dc8d2f30e248d2ca186d7dcf2972c5111dc3fa2 Mon Sep 17 00:00:00 2001
From: patrick96
Date: Mon, 21 Dec 2020 22:15:05 +0100
Subject: [PATCH] cmake: Make xrandr and xcomposite required
They were required before, but could technically be deactived (the
compilation would fail, but configuration was possible).
The WITH_XRANDR and WITH_XCOMPOSITE now no longer appear in the cmake
part. It still appears in the source code, but is always set to 1
Fixes #1536
---
CMakeLists.txt | 5 +----
cmake/02-opts.cmake | 2 --
cmake/03-libs.cmake | 11 +++++------
cmake/05-summary.cmake | 4 ++--
common/ci/configure.sh | 1 -
include/CMakeLists.txt | 8 ++------
include/settings.hpp.cmake | 4 ++--
lib/CMakeLists.txt | 8 ++------
src/CMakeLists.txt | 4 +---
9 files changed, 15 insertions(+), 32 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index d687cdd3..7bb080f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -77,7 +77,7 @@ endif()
set(MODULES_LEFT "bspwm i3")
set(MODULES_CENTER "mpd")
-set(MODULES_RIGHT "filesystem xbacklight alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu")
+set(MODULES_RIGHT "filesystem backlight-acpi alsa pulseaudio xkeyboard memory cpu wlan eth battery temperature date powermenu")
set(FONT_FIXED "fixed:pixelsize=10")
set(FONT_UNIFONT "unifont:fontformat=truetype")
@@ -104,9 +104,6 @@ endif()
if(NOT ENABLE_NETWORK)
string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT})
endif()
-if(NOT WITH_XRANDR)
- string(REPLACE "xbacklight " "backlight-acpi " MODULES_RIGHT ${MODULES_RIGHT})
-endif()
if(NOT WITH_XKB)
string(REPLACE "xkeyboard " "" MODULES_RIGHT ${MODULES_RIGHT})
endif()
diff --git a/cmake/02-opts.cmake b/cmake/02-opts.cmake
index 6aa7b7bf..9dbe03b0 100644
--- a/cmake/02-opts.cmake
+++ b/cmake/02-opts.cmake
@@ -42,9 +42,7 @@ option(ENABLE_NETWORK "Enable network support" ON)
option(ENABLE_XKEYBOARD "Enable xkeyboard support" ON)
option(ENABLE_PULSEAUDIO "Enable PulseAudio support" ON)
-option(WITH_XRANDR "xcb-randr support" ON)
option(WITH_XRANDR_MONITORS "xcb-randr monitor support" ON)
-option(WITH_XCOMPOSITE "xcb-composite support" ON)
option(WITH_XKB "xcb-xkb support" ON)
option(WITH_XRM "xcb-xrm support" ON)
option(WITH_XCURSOR "xcb-cursor support" ON)
diff --git a/cmake/03-libs.cmake b/cmake/03-libs.cmake
index 895d27ba..e39c6a99 100644
--- a/cmake/03-libs.cmake
+++ b/cmake/03-libs.cmake
@@ -34,17 +34,16 @@ if (ENABLE_PULSEAUDIO)
set(PULSEAUDIO_VERSION ${LibPulse_VERSION})
endif()
-if (WITH_XCOMPOSITE)
- set(XORG_EXTENSIONS ${XORG_EXTENSIONS} COMPOSITE)
-endif()
+# xcomposite is required
+list(APPEND XORG_EXTENSIONS COMPOSITE)
if (WITH_XKB)
- set(XORG_EXTENSIONS ${XORG_EXTENSIONS} XKB)
+ list(APPEND XORG_EXTENSIONS XKB)
endif()
if (WITH_XCURSOR)
- set(XORG_EXTENSIONS ${XORG_EXTENSIONS} CURSOR)
+ list(APPEND XORG_EXTENSIONS CURSOR)
endif()
if (WITH_XRM)
- set(XORG_EXTENSIONS ${XORG_EXTENSIONS} XRM)
+ list(APPEND XORG_EXTENSIONS XRM)
endif()
# Set min xrandr version required
diff --git a/cmake/05-summary.cmake b/cmake/05-summary.cmake
index d8175355..a511c998 100644
--- a/cmake/05-summary.cmake
+++ b/cmake/05-summary.cmake
@@ -30,9 +30,9 @@ colored_option(" pulseaudio" ENABLE_PULSEAUDIO PULSEAUDIO_VERSION)
colored_option(" xkeyboard" WITH_XKB Xcb_XKB_VERSION)
message(STATUS " X extensions:")
-colored_option(" xcb-randr" WITH_XRANDR Xcb_RANDR_VERSION)
+colored_option(" xcb-randr" Xcb_RANDR_FOUND Xcb_RANDR_VERSION)
colored_option(" xcb-randr (monitor support)" WITH_XRANDR_MONITORS Xcb_RANDR_VERSION)
-colored_option(" xcb-composite" WITH_XCOMPOSITE Xcb_COMPOSITE_VERSION)
+colored_option(" xcb-composite" Xcb_COMPOSITE_FOUND Xcb_COMPOSITE_VERSION)
colored_option(" xcb-xkb" WITH_XKB Xcb_XKB_VERSION)
colored_option(" xcb-xrm" WITH_XRM Xcb_XRM_VERSION)
colored_option(" xcb-cursor" WITH_XCURSOR Xcb_CURSOR_VERSION)
diff --git a/common/ci/configure.sh b/common/ci/configure.sh
index 90718748..5fc1a8bc 100755
--- a/common/ci/configure.sh
+++ b/common/ci/configure.sh
@@ -32,7 +32,6 @@ cmake \
-DCMAKE_BUILD_TYPE="${BUILD_TYPE}" \
-DBUILD_TESTS:BOOL="${BUILD_TESTS:-OFF}" \
-DBUILD_DOC:BOOL="${BUILD_DOC:-OFF}" \
- -DWITH_XRANDR=ON \
-DENABLE_PULSEAUDIO="${ENABLE_PULSEAUDIO:-OFF}" \
-DENABLE_NETWORK="${ENABLE_NETWORK:-OFF}" \
-DENABLE_MPD="${ENABLE_MPD:-OFF}" \
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index d949b689..eb29c9e3 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -2,12 +2,8 @@
# Generate settings.hpp
#
-if(WITH_XRANDR)
- list(APPEND XPP_EXTENSION_LIST xpp::randr::extension)
-endif()
-if(WITH_XCOMPOSITE)
- list(APPEND XPP_EXTENSION_LIST xpp::composite::extension)
-endif()
+list(APPEND XPP_EXTENSION_LIST xpp::randr::extension)
+list(APPEND XPP_EXTENSION_LIST xpp::composite::extension)
if(WITH_XKB)
list(APPEND XPP_EXTENSION_LIST xpp::xkb::extension)
endif()
diff --git a/include/settings.hpp.cmake b/include/settings.hpp.cmake
index 2099ad5a..776b38eb 100644
--- a/include/settings.hpp.cmake
+++ b/include/settings.hpp.cmake
@@ -15,8 +15,8 @@ extern const char* const APP_VERSION;
#cmakedefine01 ENABLE_CURL
#cmakedefine01 ENABLE_PULSEAUDIO
-#cmakedefine01 WITH_XRANDR
-#cmakedefine01 WITH_XCOMPOSITE
+#define WITH_XRANDR 1
+#define WITH_XCOMPOSITE 1
#cmakedefine01 WITH_XKB
#cmakedefine01 WITH_XRM
#cmakedefine01 WITH_XCURSOR
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 4f81e5ce..355ffa86 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -12,12 +12,8 @@ target_include_directories(moodycamel SYSTEM INTERFACE ${CMAKE_CURRENT_LIST_DIR}
set(XCB_PROTOS xproto)
-if(WITH_XRANDR)
- list(APPEND XCB_PROTOS randr)
-endif()
-if(WITH_XCOMPOSITE)
- list(APPEND XCB_PROTOS composite)
-endif()
+list(APPEND XCB_PROTOS randr)
+list(APPEND XCB_PROTOS composite)
if(WITH_XKB)
list(APPEND XCB_PROTOS xkb)
endif()
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 72af0881..b774c68e 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -36,8 +36,6 @@ set(PULSEAUDIO_SOURCES
${src_dir}/modules/pulseaudio.cpp
)
-set(XCOMPOSITE_SOURCES ${src_dir}/x11/extensions/composite.cpp)
-
set(XCURSOR_SOURCES ${src_dir}/x11/cursor.cpp)
set(XKB_SOURCES
@@ -119,6 +117,7 @@ set(POLY_SOURCES
${src_dir}/x11/background_manager.cpp
${src_dir}/x11/connection.cpp
${src_dir}/x11/ewmh.cpp
+ ${src_dir}/x11/extensions/composite.cpp
${src_dir}/x11/extensions/randr.cpp
${src_dir}/x11/icccm.cpp
${src_dir}/x11/registry.cpp
@@ -134,7 +133,6 @@ set(POLY_SOURCES
$<$:${MPD_SOURCES}>
$<$:${NETWORK_SOURCES}>
$<$:${PULSEAUDIO_SOURCES}>
- $<$:${XCOMPOSITE_SOURCES}>
$<$:${XCURSOR_SOURCES}>
$<$:${XKB_SOURCES}>
$<$:${XRM_SOURCES}>