Mercurial > minori
diff dep/animia/CMakeLists.txt @ 199:9f3534f6b8c4
dep/animia: initial Wayland support, drop non-working kvm fd plugin
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Tue, 02 Jan 2024 02:34:27 -0500 |
parents | 0ad2507c3e60 |
children | 71832ffe425a |
line wrap: on
line diff
--- a/dep/animia/CMakeLists.txt Sun Dec 24 02:59:42 2023 -0500 +++ b/dep/animia/CMakeLists.txt Tue Jan 02 02:34:27 2024 -0500 @@ -60,9 +60,7 @@ if(LINUX) list(APPEND DEFINES LINUX) - list(APPEND SRC_FILES - src/fd/proc.cc - ) + list(APPEND SRC_FILES src/fd/proc.cc) elseif(LIBUTIL_LIBRARY) # FreeBSD's libutil get_filename_component(LIBUTIL_DIR ${LIBUTIL_LIBRARY} DIRECTORY) @@ -88,18 +86,20 @@ endif() # LINUX # X11 - find_package(X11 COMPONENTS X11) + find_package(X11 COMPONENTS X11 XRes) + if(X11_FOUND) + # Getting PIDs from windows... + if (X11_XRes_FOUND) + list(APPEND DEFINES HAVE_XRES) + else() # NOT X11_XRes_FOUND + message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") + endif() # X11_XRes_FOUND + list(APPEND DEFINES X11) - list(APPEND SRC_FILES - src/win/x11.cc - ) - list(APPEND INCLUDE_DIRS - ${X11_INCLUDE_DIRS} - ) - list(APPEND LIBRARIES - ${X11_LIBRARIES} - ) + list(APPEND SRC_FILES src/win/x11.cc) + list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) + list(APPEND LIBRARIES ${X11_LIBRARIES}) # This will include Xres, I think.. else() # NOT X11_FOUND # For some systems, i.e. Debian, FindX11 fails to find X11, so we have # to use pkg_config as a fallback @@ -107,19 +107,40 @@ if(PKG_CONFIG_FOUND) pkg_check_modules(X11 x11) if(X11_FOUND) + # Check for XRes the hard way + find_path(X11_XRes_HEADER "extensions/XRes.h" PATHS ${X11_INCLUDE_DIRS}) + find_library(X11_XRes_LIB XRes ${X11_LIBRARY_DIRS}) + + if(X11_XRes_HEADER AND X11_XRes_LIB) + # TODO: We should REALLY check for XResQueryClientIds here... + list(APPEND DEFINES HAVE_XRES) + list(APPEND LIBRARIES ${X11_XRes_LIB}) + else() + message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") + endif() + list(APPEND DEFINES X11) - list(APPEND SRC_FILES - src/win/x11.cc - ) - list(APPEND INCLUDE_DIRS - ${X11_INCLUDE_DIRS} - ) - list(APPEND LIBRARIES - ${X11_LINK_LIBRARIES} - ) + list(APPEND SRC_FILES src/win/x11.cc) + list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) + list(APPEND LIBRARIES ${X11_LINK_LIBRARIES}) endif() # X11_FOUND endif() # PKG_CONFIG_FOUND endif() # X11_FOUND + + find_package(PkgConfig) + if(PKG_CONFIG_FOUND) + pkg_check_modules(WAYLAND wayland-client) + if(WAYLAND_FOUND) + enable_language(C) + list(APPEND DEFINES WAYLAND) + list(APPEND SRC_FILES + src/win/wayland.cc + src/win/wayland/ext-foreign-toplevel-list-v1.c + ) + list(APPEND INCLUDE_DIRS ${WAYLAND_INCLUDE_DIRS}) + list(APPEND LIBRARIES ${WAYLAND_LINK_LIBRARIES}) + endif() # WAYLAND_FOUND + endif() # PKG_CONFIG_FOUND endif() # WIN32 AND APPLE add_library(animia SHARED ${SRC_FILES}) @@ -128,6 +149,6 @@ CXX_STANDARD 17 ) -target_compile_definitions(animia PUBLIC ${DEFINES}) +target_compile_definitions(animia PRIVATE ${DEFINES}) target_include_directories(animia PRIVATE include PUBLIC ${INCLUDE_DIRS}) target_link_libraries(animia PUBLIC ${LIBRARIES})