mirror of
https://github.com/hyprwm/hypridle.git
synced 2024-11-16 23:25:58 +01:00
CMake: fmt
This commit is contained in:
parent
2d774e6f32
commit
ee6ca4d6c5
1 changed files with 52 additions and 38 deletions
|
@ -3,10 +3,10 @@ cmake_minimum_required(VERSION 3.19)
|
||||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
||||||
string(STRIP ${VER_RAW} VERSION)
|
string(STRIP ${VER_RAW} VERSION)
|
||||||
|
|
||||||
project(hypridle
|
project(
|
||||||
|
hypridle
|
||||||
DESCRIPTION "An idle management daemon for Hyprland"
|
DESCRIPTION "An idle management daemon for Hyprland"
|
||||||
VERSION ${VERSION}
|
VERSION ${VERSION})
|
||||||
)
|
|
||||||
|
|
||||||
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
||||||
|
|
||||||
|
@ -18,10 +18,7 @@ else()
|
||||||
message(STATUS "Configuring hypridle in Release with CMake")
|
message(STATUS "Configuring hypridle in Release with CMake")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include_directories(
|
include_directories(. "protocols/")
|
||||||
.
|
|
||||||
"protocols/"
|
|
||||||
)
|
|
||||||
|
|
||||||
# configure
|
# configure
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
|
@ -34,7 +31,15 @@ message(STATUS "Checking deps...")
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
find_package(PkgConfig REQUIRED)
|
||||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-client wayland-protocols hyprlang>=0.4.0 hyprutils>=0.2.0 sdbus-c++)
|
pkg_check_modules(
|
||||||
|
deps
|
||||||
|
REQUIRED
|
||||||
|
IMPORTED_TARGET
|
||||||
|
wayland-client
|
||||||
|
wayland-protocols
|
||||||
|
hyprlang>=0.4.0
|
||||||
|
hyprutils>=0.2.0
|
||||||
|
sdbus-c++)
|
||||||
|
|
||||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||||
add_executable(hypridle ${SRCFILES})
|
add_executable(hypridle ${SRCFILES})
|
||||||
|
@ -53,26 +58,35 @@ message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
|
||||||
function(protocol protoPath protoName external)
|
function(protocol protoPath protoName external)
|
||||||
if(external)
|
if(external)
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${WaylandScanner} client-header ${protoPath} protocols/${protoName}-protocol.h
|
COMMAND ${WaylandScanner} client-header ${protoPath}
|
||||||
|
protocols/${protoName}-protocol.h
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${WaylandScanner} private-code ${protoPath} protocols/${protoName}-protocol.c
|
COMMAND ${WaylandScanner} private-code ${protoPath}
|
||||||
|
protocols/${protoName}-protocol.c
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
target_sources(hypridle PRIVATE protocols/${protoName}-protocol.c)
|
target_sources(hypridle PRIVATE protocols/${protoName}-protocol.c)
|
||||||
else()
|
else()
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${WaylandScanner} client-header ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.h
|
COMMAND
|
||||||
|
${WaylandScanner} client-header ${WAYLAND_PROTOCOLS_DIR}/${protoPath}
|
||||||
|
protocols/${protoName}-protocol.h
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
execute_process(
|
execute_process(
|
||||||
COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.c
|
COMMAND
|
||||||
|
${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/${protoPath}
|
||||||
|
protocols/${protoName}-protocol.c
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||||
target_sources(hypridle PRIVATE protocols/${protoName}-protocol.c)
|
target_sources(hypridle PRIVATE protocols/${protoName}-protocol.c)
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
make_directory(${CMAKE_SOURCE_DIR}/protocols) # we don't ship any custom ones so the dir won't be there
|
make_directory(${CMAKE_SOURCE_DIR}/protocols) # we don't ship any custom ones so
|
||||||
protocol("staging/ext-idle-notify/ext-idle-notify-v1.xml" "ext-idle-notify-v1" false)
|
# the dir won't be there
|
||||||
|
protocol("staging/ext-idle-notify/ext-idle-notify-v1.xml" "ext-idle-notify-v1"
|
||||||
|
false)
|
||||||
|
|
||||||
# Installation
|
# Installation
|
||||||
install(TARGETS hypridle)
|
install(TARGETS hypridle)
|
||||||
install(FILES ${CMAKE_BINARY_DIR}/systemd/hypridle.service DESTINATION "lib/systemd/user")
|
install(FILES ${CMAKE_BINARY_DIR}/systemd/hypridle.service
|
||||||
|
DESTINATION "lib/systemd/user")
|
||||||
|
|
Loading…
Reference in a new issue