mirror of
https://github.com/hyprwm/Hyprland
synced 2024-11-22 22:25:58 +01:00
cmake: Some small cmake cleanups (#5572)
* remove unnecessary include * cmake: use pkg_get_variable We can find wayland-scanner executable and wayland-protocols dir by taking advantage of this function, so no need to use find_program or manually call pkgconf executable. * cmake: remove explicit rdynamic option CMAKE_ENABLE_EXPORTS=ON already implies rdynamic so it's redundant to set the latter explicitly. Also, CMAKE_ENABLE_EXPORTS is superseded by CMAKE_EXECUTABLE_ENABLE_EXPORTS in cmake 3.27. * cmake: make xcb-errors dep optional xcb-errors is being used in wlroots, where it's optional. So make it optional in hyprland as well
This commit is contained in:
parent
d96501442f
commit
9e4b2efe7e
2 changed files with 11 additions and 11 deletions
|
@ -65,13 +65,11 @@ ExternalProject_Add(
|
||||||
INSTALL_COMMAND echo "wlroots-hyprland: install not needed"
|
INSTALL_COMMAND echo "wlroots-hyprland: install not needed"
|
||||||
)
|
)
|
||||||
|
|
||||||
find_program(WaylandScanner NAMES wayland-scanner)
|
find_package(PkgConfig REQUIRED)
|
||||||
|
|
||||||
|
pkg_get_variable(WaylandScanner wayland-scanner wayland_scanner)
|
||||||
message(STATUS "Found WaylandScanner at ${WaylandScanner}")
|
message(STATUS "Found WaylandScanner at ${WaylandScanner}")
|
||||||
execute_process(
|
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
||||||
COMMAND pkgconf --variable=pkgdatadir wayland-protocols
|
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
||||||
OUTPUT_VARIABLE WAYLAND_PROTOCOLS_DIR
|
|
||||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
|
||||||
message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
|
message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||||
|
@ -92,13 +90,12 @@ include_directories(
|
||||||
set(CMAKE_CXX_STANDARD 23)
|
set(CMAKE_CXX_STANDARD 23)
|
||||||
add_compile_definitions(WLR_USE_UNSTABLE)
|
add_compile_definitions(WLR_USE_UNSTABLE)
|
||||||
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith)
|
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith)
|
||||||
add_link_options(-rdynamic)
|
|
||||||
set(CMAKE_ENABLE_EXPORTS TRUE)
|
set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE)
|
||||||
|
|
||||||
message(STATUS "Checking deps...")
|
message(STATUS "Checking deps...")
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
find_package(PkgConfig REQUIRED)
|
|
||||||
|
|
||||||
if(LEGACY_RENDERER)
|
if(LEGACY_RENDERER)
|
||||||
set(GLES_VERSION "GLES2")
|
set(GLES_VERSION "GLES2")
|
||||||
|
@ -177,8 +174,12 @@ if(NO_XWAYLAND)
|
||||||
add_compile_definitions(NO_XWAYLAND)
|
add_compile_definitions(NO_XWAYLAND)
|
||||||
else()
|
else()
|
||||||
message(STATUS "XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...")
|
message(STATUS "XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...")
|
||||||
pkg_check_modules(xdeps REQUIRED IMPORTED_TARGET xcb xwayland xcb-util xcb-render xcb-image xcb-xfixes xcb-errors xcb-icccm xcb-composite xcb-res xcb-ewmh)
|
pkg_check_modules(xdeps REQUIRED IMPORTED_TARGET xcb xwayland xcb-util xcb-render xcb-image xcb-xfixes xcb-icccm xcb-composite xcb-res xcb-ewmh)
|
||||||
|
pkg_check_modules(xcb_errors IMPORTED_TARGET xcb-errors)
|
||||||
target_link_libraries(Hyprland PkgConfig::xdeps)
|
target_link_libraries(Hyprland PkgConfig::xdeps)
|
||||||
|
if(xcb_errors_FOUND)
|
||||||
|
target_link_libraries(Hyprland PkgConfig::xcb_errors)
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NO_SYSTEMD)
|
if(NO_SYSTEMD)
|
||||||
|
|
|
@ -4,7 +4,6 @@
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
|
||||||
#include <sys/poll.h>
|
|
||||||
#include <sys/timerfd.h>
|
#include <sys/timerfd.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue