Mercurial > minori
comparison dep/animia/CMakeLists.txt @ 221:53211cb1e7f5
library: add initial library stuff
nice
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Mon, 08 Jan 2024 13:21:08 -0500 |
parents | 8a482049b968 |
children | 8ccf0302afb1 |
comparison
equal
deleted
inserted
replaced
220:79a87a6dd39d | 221:53211cb1e7f5 |
---|---|
84 | 84 |
85 if(LIBKVM_HAS_GETFILES) | 85 if(LIBKVM_HAS_GETFILES) |
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 | 90 |
90 # X11 | 91 # It's technically possible to have an X server on macOS, so we |
91 find_package(X11 COMPONENTS X11 XRes) | 92 # should compile X11 support. |
93 # X11 | |
94 find_package(X11 COMPONENTS X11 XRes) | |
92 | 95 |
93 if(X11_FOUND) | 96 if(X11_FOUND) |
94 # Getting PIDs from windows... | 97 # Getting PIDs from windows... |
95 if (X11_XRes_FOUND) | 98 if (X11_XRes_FOUND) |
96 list(APPEND DEFINES HAVE_XRES) | 99 list(APPEND DEFINES HAVE_XRES) |
97 else() # NOT X11_XRes_FOUND | 100 else() # NOT X11_XRes_FOUND |
98 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") | 101 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") |
99 endif() # X11_XRes_FOUND | 102 endif() # X11_XRes_FOUND |
100 | 103 |
101 list(APPEND DEFINES X11) | 104 list(APPEND DEFINES X11) |
102 list(APPEND SRC_FILES src/win/x11.cc) | 105 list(APPEND SRC_FILES src/win/x11.cc) |
103 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) | 106 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) |
104 list(APPEND LIBRARIES ${X11_LIBRARIES}) # This will include Xres, I think.. | 107 list(APPEND LIBRARIES ${X11_LIBRARIES}) # This will include Xres, I think.. |
105 else() # NOT X11_FOUND | 108 else() # NOT X11_FOUND |
106 # For some systems, i.e. Debian, FindX11 fails to find X11, so we have | 109 # For some systems, i.e. Debian, FindX11 fails to find X11, so we have |
107 # to use pkg_config as a fallback | 110 # to use pkg_config as a fallback |
108 find_package(PkgConfig) | |
109 if(PKG_CONFIG_FOUND) | |
110 pkg_check_modules(X11 x11) | |
111 if(X11_FOUND) | |
112 # Check for XRes the hard way | |
113 find_path(X11_XRes_HEADER "X11/extensions/XRes.h" PATHS ${X11_INCLUDE_DIRS}) | |
114 find_library(X11_XRes_LIB XRes PATHS ${X11_LIBRARY_DIRS}) | |
115 | |
116 if(X11_XRes_HEADER AND X11_XRes_LIB) | |
117 # TODO: We should REALLY check for XResQueryClientIds here... | |
118 list(APPEND DEFINES HAVE_XRES) | |
119 list(APPEND LIBRARIES ${X11_XRes_LIB}) | |
120 else() | |
121 message(WARNING "libXRes could not be found! Finding PIDs in X11 windows may not work correctly!") | |
122 endif() | |
123 | |
124 list(APPEND DEFINES X11) | |
125 list(APPEND SRC_FILES src/win/x11.cc) | |
126 list(APPEND INCLUDE_DIRS ${X11_INCLUDE_DIRS}) | |
127 list(APPEND LIBRARIES ${X11_LINK_LIBRARIES}) | |
128 endif() # X11_FOUND | |
129 endif() # PKG_CONFIG_FOUND | |
130 endif() # X11_FOUND | |
131 | |
132 find_package(PkgConfig) | 111 find_package(PkgConfig) |
133 if(PKG_CONFIG_FOUND) | 112 if(PKG_CONFIG_FOUND) |
134 pkg_check_modules(WAYLAND wayland-client) | 113 pkg_check_modules(X11 x11) |
135 if(WAYLAND_FOUND) | 114 if(X11_FOUND) |
136 enable_language(C) | 115 # Check for XRes the hard way |
137 list(APPEND DEFINES WAYLAND) | 116 find_path(X11_XRes_HEADER "X11/extensions/XRes.h" PATHS ${X11_INCLUDE_DIRS}) |
138 list(APPEND SRC_FILES | 117 find_library(X11_XRes_LIB XRes PATHS ${X11_LIBRARY_DIRS}) |
139 src/win/wayland.cc | 118 |
140 src/win/wayland/ext-foreign-toplevel-list-v1.c | 119 if(X11_XRes_HEADER AND X11_XRes_LIB) |
141 src/win/wayland/wlr-foreign-toplevel-management-unstable-v1.c | 120 # TODO: We should REALLY check for XResQueryClientIds here... |
142 ) | 121 list(APPEND DEFINES HAVE_XRES) |
143 list(APPEND INCLUDE_DIRS ${WAYLAND_INCLUDE_DIRS}) | 122 list(APPEND LIBRARIES ${X11_XRes_LIB}) |
144 list(APPEND LIBRARIES ${WAYLAND_LINK_LIBRARIES}) | 123 else() |
145 endif() # WAYLAND_FOUND | 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 | |
146 endif() # PKG_CONFIG_FOUND | 132 endif() # PKG_CONFIG_FOUND |
147 endif() # WIN32 AND APPLE | 133 endif() # X11_FOUND |
134 | |
135 # Wayland. | |
136 find_package(PkgConfig) | |
137 if(PKG_CONFIG_FOUND) | |
138 pkg_check_modules(WAYLAND wayland-client) | |
139 if(WAYLAND_FOUND) | |
140 enable_language(C) | |
141 list(APPEND DEFINES WAYLAND) | |
142 list(APPEND SRC_FILES | |
143 src/win/wayland.cc | |
144 src/win/wayland/ext-foreign-toplevel-list-v1.c | |
145 src/win/wayland/wlr-foreign-toplevel-management-unstable-v1.c | |
146 ) | |
147 list(APPEND INCLUDE_DIRS ${WAYLAND_INCLUDE_DIRS}) | |
148 list(APPEND LIBRARIES ${WAYLAND_LINK_LIBRARIES}) | |
149 endif() # WAYLAND_FOUND | |
150 endif() # PKG_CONFIG_FOUND | |
148 | 151 |
149 add_library(animia SHARED ${SRC_FILES}) | 152 add_library(animia SHARED ${SRC_FILES}) |
150 set_target_properties(animia PROPERTIES | 153 set_target_properties(animia PROPERTIES |
151 PUBLIC_HEADER include/animia.h | 154 PUBLIC_HEADER include/animia.h |
152 CXX_STANDARD 17 | 155 CXX_STANDARD 17 |