Mercurial > minori
comparison 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 |
comparison
equal
deleted
inserted
replaced
198:bc1ae1810855 | 199:9f3534f6b8c4 |
---|---|
58 find_library(LIBUTIL_LIBRARY util) | 58 find_library(LIBUTIL_LIBRARY util) |
59 find_library(LIBKVM_LIBRARY kvm) | 59 find_library(LIBKVM_LIBRARY kvm) |
60 | 60 |
61 if(LINUX) | 61 if(LINUX) |
62 list(APPEND DEFINES LINUX) | 62 list(APPEND DEFINES LINUX) |
63 list(APPEND SRC_FILES | 63 list(APPEND SRC_FILES src/fd/proc.cc) |
64 src/fd/proc.cc | |
65 ) | |
66 elseif(LIBUTIL_LIBRARY) # FreeBSD's libutil | 64 elseif(LIBUTIL_LIBRARY) # FreeBSD's libutil |
67 get_filename_component(LIBUTIL_DIR ${LIBUTIL_LIBRARY} DIRECTORY) | 65 get_filename_component(LIBUTIL_DIR ${LIBUTIL_LIBRARY} DIRECTORY) |
68 | 66 |
69 include(CheckLibraryExists) | 67 include(CheckLibraryExists) |
70 check_library_exists(util kinfo_getfile ${LIBUTIL_DIR} LIBUTIL_GOOD) | 68 check_library_exists(util kinfo_getfile ${LIBUTIL_DIR} LIBUTIL_GOOD) |
86 list(APPEND SRC_FILES src/fd/libkvm.cc) | 84 list(APPEND SRC_FILES src/fd/libkvm.cc) |
87 endif() # LIBUTIL_GOOD | 85 endif() # LIBUTIL_GOOD |
88 endif() # LINUX | 86 endif() # LINUX |
89 | 87 |
90 # X11 | 88 # X11 |
91 find_package(X11 COMPONENTS X11) | 89 find_package(X11 COMPONENTS X11 XRes) |
90 | |
92 if(X11_FOUND) | 91 if(X11_FOUND) |
92 # Getting PIDs from windows... | |
93 if (X11_XRes_FOUND) | |
94 list(APPEND DEFINES HAVE_XRES) | |
95 else() # NOT X11_XRes_FOUND | |
96 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") | |
97 endif() # X11_XRes_FOUND | |
98 | |
93 list(APPEND DEFINES X11) | 99 list(APPEND DEFINES X11) |
94 list(APPEND SRC_FILES | 100 list(APPEND SRC_FILES src/win/x11.cc) |
95 src/win/x11.cc | 101 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) |
96 ) | 102 list(APPEND LIBRARIES ${X11_LIBRARIES}) # This will include Xres, I think.. |
97 list(APPEND INCLUDE_DIRS | |
98 ${X11_INCLUDE_DIRS} | |
99 ) | |
100 list(APPEND LIBRARIES | |
101 ${X11_LIBRARIES} | |
102 ) | |
103 else() # NOT X11_FOUND | 103 else() # NOT X11_FOUND |
104 # For some systems, i.e. Debian, FindX11 fails to find X11, so we have | 104 # For some systems, i.e. Debian, FindX11 fails to find X11, so we have |
105 # to use pkg_config as a fallback | 105 # to use pkg_config as a fallback |
106 find_package(PkgConfig) | 106 find_package(PkgConfig) |
107 if(PKG_CONFIG_FOUND) | 107 if(PKG_CONFIG_FOUND) |
108 pkg_check_modules(X11 x11) | 108 pkg_check_modules(X11 x11) |
109 if(X11_FOUND) | 109 if(X11_FOUND) |
110 # Check for XRes the hard way | |
111 find_path(X11_XRes_HEADER "extensions/XRes.h" PATHS ${X11_INCLUDE_DIRS}) | |
112 find_library(X11_XRes_LIB XRes ${X11_LIBRARY_DIRS}) | |
113 | |
114 if(X11_XRes_HEADER AND X11_XRes_LIB) | |
115 # TODO: We should REALLY check for XResQueryClientIds here... | |
116 list(APPEND DEFINES HAVE_XRES) | |
117 list(APPEND LIBRARIES ${X11_XRes_LIB}) | |
118 else() | |
119 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") | |
120 endif() | |
121 | |
110 list(APPEND DEFINES X11) | 122 list(APPEND DEFINES X11) |
111 list(APPEND SRC_FILES | 123 list(APPEND SRC_FILES src/win/x11.cc) |
112 src/win/x11.cc | 124 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) |
113 ) | 125 list(APPEND LIBRARIES ${X11_LINK_LIBRARIES}) |
114 list(APPEND INCLUDE_DIRS | |
115 ${X11_INCLUDE_DIRS} | |
116 ) | |
117 list(APPEND LIBRARIES | |
118 ${X11_LINK_LIBRARIES} | |
119 ) | |
120 endif() # X11_FOUND | 126 endif() # X11_FOUND |
121 endif() # PKG_CONFIG_FOUND | 127 endif() # PKG_CONFIG_FOUND |
122 endif() # X11_FOUND | 128 endif() # X11_FOUND |
129 | |
130 find_package(PkgConfig) | |
131 if(PKG_CONFIG_FOUND) | |
132 pkg_check_modules(WAYLAND wayland-client) | |
133 if(WAYLAND_FOUND) | |
134 enable_language(C) | |
135 list(APPEND DEFINES WAYLAND) | |
136 list(APPEND SRC_FILES | |
137 src/win/wayland.cc | |
138 src/win/wayland/ext-foreign-toplevel-list-v1.c | |
139 ) | |
140 list(APPEND INCLUDE_DIRS ${WAYLAND_INCLUDE_DIRS}) | |
141 list(APPEND LIBRARIES ${WAYLAND_LINK_LIBRARIES}) | |
142 endif() # WAYLAND_FOUND | |
143 endif() # PKG_CONFIG_FOUND | |
123 endif() # WIN32 AND APPLE | 144 endif() # WIN32 AND APPLE |
124 | 145 |
125 add_library(animia SHARED ${SRC_FILES}) | 146 add_library(animia SHARED ${SRC_FILES}) |
126 set_target_properties(animia PROPERTIES | 147 set_target_properties(animia PROPERTIES |
127 PUBLIC_HEADER include/animia.h | 148 PUBLIC_HEADER include/animia.h |
128 CXX_STANDARD 17 | 149 CXX_STANDARD 17 |
129 ) | 150 ) |
130 | 151 |
131 target_compile_definitions(animia PUBLIC ${DEFINES}) | 152 target_compile_definitions(animia PRIVATE ${DEFINES}) |
132 target_include_directories(animia PRIVATE include PUBLIC ${INCLUDE_DIRS}) | 153 target_include_directories(animia PRIVATE include PUBLIC ${INCLUDE_DIRS}) |
133 target_link_libraries(animia PUBLIC ${LIBRARIES}) | 154 target_link_libraries(animia PUBLIC ${LIBRARIES}) |