15
15
# You should have received a copy of the GNU Lesser General Public License
16
16
# along with this program. If not, see <http://www.gnu.org/licenses/>.
17
17
18
- cmake_minimum_required (VERSION 3.10 )
18
+ cmake_minimum_required (VERSION 3.19.5 )
19
19
20
- project (uiohook VERSION 1.2 .0 LANGUAGES C )
20
+ project (uiohook VERSION 1.3 .0 LANGUAGES C )
21
21
22
22
23
23
if (WIN32 OR WIN64 )
@@ -28,13 +28,26 @@ else()
28
28
set (UIOHOOK_SOURCE_DIR "x11" )
29
29
endif ()
30
30
31
- add_library (uiohook
32
- "src/logger.c"
33
- "src/${UIOHOOK_SOURCE_DIR} /input_helper.c"
34
- "src/${UIOHOOK_SOURCE_DIR} /input_hook.c"
35
- "src/${UIOHOOK_SOURCE_DIR} /post_event.c"
36
- "src/${UIOHOOK_SOURCE_DIR} /system_properties.c"
37
- )
31
+ if (WIN32 OR WIN64 )
32
+ add_library (uiohook
33
+ "src/logger.c"
34
+ "src/${UIOHOOK_SOURCE_DIR} /dispatch_event.c"
35
+ "src/${UIOHOOK_SOURCE_DIR} /input_helper.c"
36
+ "src/${UIOHOOK_SOURCE_DIR} /input_hook.c"
37
+ "src/${UIOHOOK_SOURCE_DIR} /post_event.c"
38
+ "src/${UIOHOOK_SOURCE_DIR} /system_properties.c"
39
+ "src/${UIOHOOK_SOURCE_DIR} /monitor_helper.c"
40
+ )
41
+ else ()
42
+ add_library (uiohook
43
+ "src/logger.c"
44
+ "src/${UIOHOOK_SOURCE_DIR} /dispatch_event.c"
45
+ "src/${UIOHOOK_SOURCE_DIR} /input_helper.c"
46
+ "src/${UIOHOOK_SOURCE_DIR} /input_hook.c"
47
+ "src/${UIOHOOK_SOURCE_DIR} /post_event.c"
48
+ "src/${UIOHOOK_SOURCE_DIR} /system_properties.c"
49
+ )
50
+ endif ()
38
51
39
52
set_target_properties (uiohook PROPERTIES
40
53
C_STANDARD 99
@@ -130,6 +143,10 @@ if(ENABLE_TEST)
130
143
target_link_libraries (uiohook_tests uiohook "${CMAKE_THREAD_LIBS_INIT} " )
131
144
endif ()
132
145
146
+ option (USE_EPOCH_TIME "Use Unix epoch time for event timestamps (default: ON)" ON )
147
+ if (USE_EPOCH_TIME )
148
+ add_compile_definitions (uiohook PRIVATE USE_EPOCH_TIME )
149
+ endif ()
133
150
134
151
if (UNIX AND NOT APPLE )
135
152
find_package (PkgConfig REQUIRED )
@@ -148,26 +165,6 @@ if(UNIX AND NOT APPLE)
148
165
include (CheckIncludeFile )
149
166
check_include_file (X11/extensions/record.h HAVE_RECORD_H "-include X11/Xlib.h" )
150
167
151
- option (USE_XKB_COMMON "X Keyboard Common Extension (default: ON)" ON )
152
- if (USE_XKB_COMMON )
153
- pkg_check_modules (XKB_COMMON REQUIRED xkbcommon-x11 )
154
- add_compile_definitions (uiohook PRIVATE USE_XKB_COMMON )
155
- target_include_directories (uiohook PRIVATE "${XKB_COMMON_INCLUDE_DIRS} " )
156
- target_link_libraries (uiohook "${XKB_COMMON_LDFLAGS} " )
157
-
158
- pkg_check_modules (X11_XCB REQUIRED x11-xcb )
159
- target_include_directories (uiohook PRIVATE "${X11_XCB_INCLUDE_DIRS} " )
160
- target_link_libraries (uiohook "${X11_XCB_LDFLAGS} " )
161
- endif ()
162
-
163
- option (USE_XKB_FILE "X Keyboard File Extension (default: ON)" ON )
164
- if (USE_XKB_FILE )
165
- pkg_check_modules (XKB_FILE REQUIRED xkbfile )
166
- add_compile_definitions (uiohook PRIVATE USE_XKB_FILE )
167
- target_include_directories (uiohook PRIVATE "${XKB_FILE_INCLUDE_DIRS} " )
168
- target_link_libraries (uiohook "${XKB_FILE_LDFLAGS} " )
169
- endif ()
170
-
171
168
option (USE_XT "X Toolkit Extension (default: ON)" ON )
172
169
if (USE_XT )
173
170
pkg_check_modules (XT REQUIRED xt )
@@ -206,12 +203,6 @@ if(UNIX AND NOT APPLE)
206
203
add_compile_definitions (uiohook PRIVATE USE_XRECORD_ASYNC )
207
204
endif ()
208
205
209
- option (USE_XTEST "XTest API (default: ON)" ON )
210
- if (USE_XTEST )
211
- # XTest API is provided by Xtst
212
- add_compile_definitions (uiohook PRIVATE USE_XTEST )
213
- endif ()
214
-
215
206
if (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
216
207
option (USE_EVDEV "Generic Linux input driver (default: ON)" ON )
217
208
if (USE_EVDEV )
@@ -220,14 +211,25 @@ if(UNIX AND NOT APPLE)
220
211
endif ()
221
212
elseif (APPLE )
222
213
set (CMAKE_MACOSX_RPATH 1 )
223
- set (CMAKE_OSX_DEPLOYMENT_TARGET "10.5" )
224
214
225
- find_package (Threads REQUIRED )
226
- target_link_libraries (uiohook "${CMAKE_THREAD_LIBS_INIT} " )
227
-
228
- find_library (CARBON Carbon REQUIRED )
229
- target_include_directories (uiohook PRIVATE "${CARBON} " )
230
- target_link_libraries (uiohook "${CARBON} " )
215
+ option (MAC_CATALYST "Build for Mac Catalyst (default: OFF)" OFF )
216
+ if (MAC_CATALYST )
217
+ add_compile_definitions (uiohook PRIVATE MAC_CATALYST )
218
+ find_library (CORE_FOUNDATION CoreFoundation REQUIRED )
219
+ target_include_directories (uiohook PRIVATE "${CORE_FOUNDATION} " )
220
+ target_link_libraries (uiohook "${CORE_FOUNDATION} " )
221
+ find_library (CORE_GRAPHICS CoreGraphics REQUIRED )
222
+ target_include_directories (uiohook PRIVATE "${CORE_GRAPHICS} " )
223
+ target_link_libraries (uiohook "${CORE_GRAPHICS} " )
224
+ else ()
225
+ set (CMAKE_OSX_DEPLOYMENT_TARGET "10.15" )
226
+ find_package (Threads REQUIRED )
227
+ target_link_libraries (uiohook "${CMAKE_THREAD_LIBS_INIT} " )
228
+
229
+ find_library (CARBON Carbon REQUIRED )
230
+ target_include_directories (uiohook PRIVATE "${CARBON} " )
231
+ target_link_libraries (uiohook "${CARBON} " )
232
+ endif ()
231
233
232
234
option (USE_APPLICATION_SERVICES "ApplicationServices framework (default: ON)" ON )
233
235
if (USE_APPLICATION_SERVICES )
@@ -245,31 +247,13 @@ elseif(APPLE)
245
247
target_link_libraries (uiohook "${IOKIT} " )
246
248
endif ()
247
249
248
- # FIXME Change USE_OBJC flag to USE_APPKIT
249
- #option(USE_APPKIT "AppKit framework (default: ON)" ON)
250
- option (USE_OBJC "Objective-C API (default: ON)" ON )
251
- if (USE_OBJC )
252
- # FIXME Drop USE_OBJC as it is included in AppKit
253
- find_library (OBJC objc REQUIRED )
254
- add_compile_definitions (USE_OBJC )
255
- target_include_directories (uiohook PRIVATE "${OBJC} " )
256
- target_link_libraries (uiohook "${OBJC} " )
257
-
250
+ option (USE_APPKIT "AppKit framework (default: ON)" ON )
251
+ if (USE_APPKIT )
258
252
find_library (APPKIT AppKit REQUIRED )
259
253
add_compile_definitions (USE_APPKIT )
260
254
target_include_directories (uiohook PRIVATE "${APPKIT} " )
261
255
target_link_libraries (uiohook "${APPKIT} " )
262
256
endif ()
263
-
264
- option (USE_CARBON_LEGACY "Legacy Carbon framework functionality (default: OFF)" OFF )
265
- if (USE_CARBON_LEGACY )
266
- message (DEPRECATION "Legacy Carbon functionality has been deprecated." )
267
- add_compile_definitions (USE_CARBON_LEGACY )
268
-
269
- if (USE_CARBON_LEGACY AND CMAKE_SIZEOF_VOID_P EQUAL 8 )
270
- message (WARNING "Legacy Carbon functionality should not be used with 64-bit targets." )
271
- endif ()
272
- endif ()
273
257
elseif (WIN32 )
274
258
target_link_libraries (uiohook Advapi32 )
275
259
endif ()
0 commit comments