Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
include(GNUInstallDirs)
find_package(PkgConfig)

# Add path for custom CMake modules.
list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")

execute_process(
COMMAND git log -1 --format=%h
WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}
Expand Down Expand Up @@ -50,7 +54,7 @@ list(APPEND COMBINED_LDFLAGS ${LOGIN_LIBS_LDFLAGS})
# Optional dependencies

# Needed to eventually build wayland protocols
add_subdirectory(protocol)
include(WaylandProtocols)

# Helper macro for dealing correctly with optional pkg-config dependencies.
# There are a number of issues when using pkg-config with cmake (as compared to
Expand Down Expand Up @@ -98,9 +102,9 @@ macro(optional_dep name modules description)
endif()
endmacro()

optional_dep(GAMMA "x11;xrandr;libdrm;wayland-client" "Gamma correction" src/modules/gamma_plugins protocol/wlr-gamma-control-unstable-v1.xml)
optional_dep(DPMS "x11;xext;libdrm;wayland-client" "DPMS" src/modules/dpms_plugins protocol/org_kde_kwin_dpms.xml;protocol/wlr-output-power-management-unstable-v1.xml)
optional_dep(SCREEN "x11" "screen emitted brightness" src/modules/screen_plugins protocol/wlr-screencopy-unstable-v1.xml)
optional_dep(GAMMA "x11;xrandr;libdrm;wayland-client" "Gamma correction" src/modules/gamma_plugins https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/raw/master/unstable/wlr-gamma-control-unstable-v1.xml;https://raw.githubusercontent.com/KDE/plasma-wayland-protocols/master/src/protocols/outputdevice.xml;https://raw.githubusercontent.com/KDE/plasma-wayland-protocols/master/src/protocols/output-management.xml)
optional_dep(DPMS "x11;xext;libdrm;wayland-client" "DPMS" src/modules/dpms_plugins https://raw.githubusercontent.com/KDE/plasma-wayland-protocols/master/src/protocols/dpms.xml;https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/raw/master/unstable/wlr-output-power-management-unstable-v1.xml)
optional_dep(SCREEN "x11" "screen emitted brightness" src/modules/screen_plugins https://gitlab.freedesktop.org/wlroots/wlr-protocols/-/raw/master/unstable/wlr-screencopy-unstable-v1.xml)
optional_dep(DDC "ddcutil>=0.9.5" "external monitor backlight")
optional_dep(YOCTOLIGHT "libusb-1.0" "Yoctolight usb als devices support")
optional_dep(PIPEWIRE "libpipewire-0.3" "Enable pipewire camera sensor support")
Expand Down
1 change: 1 addition & 0 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
### Generic
- [ ] Drop is_smooth options for gamma
- [ ] avoid returning boolean where it does not make sense
- [ ] Rename Wl to Wlr (wlroots) in interfaces

## Ideas
- [ ] follow ddcci kernel driver and in case, drop ddcutil and add the kernel driver as clightd opt-dep
17 changes: 12 additions & 5 deletions protocol/CMakeLists.txt → cmake/modules/WaylandProtocols.cmake
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
# Stolen from: https://github.com/giucam/orbital/blob/512c1b3b20a32cf67ba326e8acce3c1c32e11fa2/cmake/Wayland.cmake, thanks!
include(FetchContent)

function(WAYLAND_ADD_PROTOCOL_CLIENT protocol)
find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner REQUIRED)

get_filename_component(proto_name ${protocol} NAME_WLE)
get_filename_component(proto_fullpath ${protocol} ABSOLUTE)
FetchContent_Declare(${proto_name} URL ${protocol} DOWNLOAD_NO_EXTRACT TRUE)
FetchContent_Populate(${proto_name})

message(STATUS "Enabled '${proto_name}' wayland client protocol")

set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/${proto_name}-client-protocol.h")
set(_code "${CMAKE_CURRENT_BINARY_DIR}/${proto_name}-protocol.c")
set(_client_header "${${proto_name}_BINARY_DIR}/${proto_name}-client-protocol.h")
set(_code "${${proto_name}_BINARY_DIR}/${proto_name}-protocol.c")
# set(_client_header "${CMAKE_CURRENT_BINARY_DIR}/${proto_name}-client-protocol.h")
# set(_code "${CMAKE_CURRENT_BINARY_DIR}/${proto_name}-protocol.c")
set(proto_fullpath "${${proto_name}_SOURCE_DIR}/${proto_name}.xml")

add_custom_command(
OUTPUT "${_client_header}" "${_code}"
Expand All @@ -17,5 +23,6 @@ function(WAYLAND_ADD_PROTOCOL_CLIENT protocol)
)

target_sources(${PROJECT_NAME} PRIVATE ${_code})
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(${PROJECT_NAME} PRIVATE ${${proto_name}_BINARY_DIR})
endfunction()

81 changes: 0 additions & 81 deletions protocol/org_kde_kwin_dpms.xml

This file was deleted.

126 changes: 0 additions & 126 deletions protocol/wlr-gamma-control-unstable-v1.xml

This file was deleted.

Loading