Skip to content

Commit

Permalink
code review
Browse files Browse the repository at this point in the history
  • Loading branch information
zjeffer committed May 22, 2024
1 parent d15b536 commit 30c3b3c
Showing 1 changed file with 8 additions and 31 deletions.
39 changes: 8 additions & 31 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ message(STATUS "Setting link libraries")

target_link_libraries(Hyprland rt PkgConfig::deps)

# list of headers
set(PROTOCOL_HEADERS "" CACHE INTERNAL "List of protocol headers")
# used by `make installheaders`, to ensure the headers are generated
add_custom_target(generate-protocol-headers)

function(protocol protoPath protoName external)
if (external)
Expand All @@ -239,14 +239,8 @@ function(protocol protoPath protoName external)
COMMAND ${WaylandScanner} private-code ${path} protocols/${protoName}-protocol.c
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
target_sources(Hyprland PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.h)
target_sources(Hyprland PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.c)

set (
PROTOCOL_HEADERS
"${PROTOCOL_HEADERS};${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.h;${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.c"
PARENT_SCOPE
)
target_sources(Hyprland PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.h ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.c)
target_sources(generate-protocol-headers PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}-protocol.h)
endfunction()

function(protocolNew protoPath protoName external)
Expand All @@ -261,14 +255,8 @@ function(protocolNew protoPath protoName external)
COMMAND hyprwayland-scanner ${path}/${protoName}.xml ${CMAKE_SOURCE_DIR}/protocols/
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp)
target_sources(Hyprland PRIVATE protocols/${protoName}.hpp)

set (
PROTOCOL_HEADERS
"${PROTOCOL_HEADERS};${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp;${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp"
PARENT_SCOPE
)
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp protocols/${protoName}.hpp)
target_sources(generate-protocol-headers PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp)
endfunction()
function(protocolWayland)
add_custom_command(
Expand All @@ -277,14 +265,8 @@ function(protocolWayland)
COMMAND hyprwayland-scanner --wayland-enums ${WAYLAND_SERVER_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)
target_sources(Hyprland PRIVATE protocols/wayland.cpp)
target_sources(Hyprland PRIVATE protocols/wayland.hpp)

set (
PROTOCOL_HEADERS
"${PROTOCOL_HEADERS};${CMAKE_SOURCE_DIR}/protocols/wayland.cpp;${CMAKE_SOURCE_DIR}/protocols/wayland.hpp"
PARENT_SCOPE
)
target_sources(Hyprland PRIVATE protocols/wayland.cpp protocols/wayland.hpp)
target_sources(generate-protocol-headers PRIVATE ${CMAKE_SOURCE_DIR}/protocols/wayland.hpp)
endfunction()

target_link_libraries(Hyprland
Expand Down Expand Up @@ -336,11 +318,6 @@ protocolNew("unstable/primary-selection" "primary-selection-unstable-v1" false)

protocolWayland()

add_custom_target(
generate-protocol-headers
DEPENDS ${PROTOCOL_HEADERS}
)

# tools
add_subdirectory(hyprctl)
add_subdirectory(hyprpm)
Expand Down

0 comments on commit 30c3b3c

Please sign in to comment.