comparison dep/animia/CMakeLists.txt @ 234:8ccf0302afb1

dep/animia: convert xlib code to xcb I'm not *entirely* sure if this will work correctly for everything, but it works fine enough
author Paper <mrpapersonic@gmail.com>
date Tue, 16 Jan 2024 08:08:42 -0500
parents 53211cb1e7f5
children
comparison
equal deleted inserted replaced
233:0a5b6a088886 234:8ccf0302afb1
86 list(APPEND DEFINES HAVE_KVM_GETFILES) 86 list(APPEND DEFINES HAVE_KVM_GETFILES)
87 endif() # LIBKVM_HAS_GETFILES 87 endif() # LIBKVM_HAS_GETFILES
88 endif() # LINUX 88 endif() # LINUX
89 endif() # WIN32 AND APPLE 89 endif() # WIN32 AND APPLE
90 90
91 # It's technically possible to have an X server on macOS, so we
92 # should compile X11 support.
93 # X11 91 # X11
94 find_package(X11 COMPONENTS X11 XRes)
95
96 if(X11_FOUND)
97 # Getting PIDs from windows...
98 if (X11_XRes_FOUND)
99 list(APPEND DEFINES HAVE_XRES)
100 else() # NOT X11_XRes_FOUND
101 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!")
102 endif() # X11_XRes_FOUND
103
104 list(APPEND DEFINES X11)
105 list(APPEND SRC_FILES src/win/x11.cc)
106 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS})
107 list(APPEND LIBRARIES ${X11_LIBRARIES}) # This will include Xres, I think..
108 else() # NOT X11_FOUND
109 # For some systems, i.e. Debian, FindX11 fails to find X11, so we have
110 # to use pkg_config as a fallback
111 find_package(PkgConfig)
112 if(PKG_CONFIG_FOUND)
113 pkg_check_modules(X11 x11)
114 if(X11_FOUND)
115 # Check for XRes the hard way
116 find_path(X11_XRes_HEADER "X11/extensions/XRes.h" PATHS ${X11_INCLUDE_DIRS})
117 find_library(X11_XRes_LIB XRes PATHS ${X11_LIBRARY_DIRS})
118
119 if(X11_XRes_HEADER AND X11_XRes_LIB)
120 # TODO: We should REALLY check for XResQueryClientIds here...
121 list(APPEND DEFINES HAVE_XRES)
122 list(APPEND LIBRARIES ${X11_XRes_LIB})
123 else()
124 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!")
125 endif()
126
127 list(APPEND DEFINES X11)
128 list(APPEND SRC_FILES src/win/x11.cc)
129 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS})
130 list(APPEND LIBRARIES ${X11_LINK_LIBRARIES})
131 endif() # X11_FOUND
132 endif() # PKG_CONFIG_FOUND
133 endif() # X11_FOUND
134
135 # Wayland.
136 find_package(PkgConfig) 92 find_package(PkgConfig)
137 if(PKG_CONFIG_FOUND) 93 if(PKG_CONFIG_FOUND)
94 pkg_check_modules(XCB xcb xcb-res)
95 if (XCB_FOUND)
96 list(APPEND DEFINES X11)
97 list(APPEND LIBRARIES ${XCB_LINK_LIBRARIES})
98 list(APPEND INCLUDE_DIRS ${XCB_INCLUDE_DIRS})
99 list(APPEND SRC_FILES src/win/x11.cc)
100 endif() # XCB_FOUND
101
102 # Wayland
138 pkg_check_modules(WAYLAND wayland-client) 103 pkg_check_modules(WAYLAND wayland-client)
139 if(WAYLAND_FOUND) 104 if(WAYLAND_FOUND)
140 enable_language(C) 105 enable_language(C)
141 list(APPEND DEFINES WAYLAND) 106 list(APPEND DEFINES WAYLAND)
142 list(APPEND SRC_FILES 107 list(APPEND SRC_FILES