|
1
|
+From 105d6c1fede00c3a9055e5a531ebf3d99bac406e Mon Sep 17 00:00:00 2001
|
|
2
|
+From: Charles Giessen <charles@lunarg.com>
|
|
3
|
+Date: Thu, 17 Jul 2025 09:56:40 -0500
|
|
4
|
+Subject: [PATCH] build: Remove pkg-config provided library names
|
|
5
|
+
|
|
6
|
+The library names of Xcb, Xlib, and Wayland do not need to be queried from pkg-config,
|
|
7
|
+instead they can be hardcoded to use the fallback names.
|
|
8
|
+
|
|
9
|
+The intent of querying the library names was to prevent issues where the hardcoded name
|
|
10
|
+was not the platform-appropriate name. But because <library>_LINK_LIBRARIES can have
|
|
11
|
+more than one library name, the logic to assign <library>_LINK_LIBRARIES into a compile
|
|
12
|
+definition breaks horribly. While it is possible to handle this in CMake, the dlopen code would
|
|
13
|
+also have to handle it which is much more error prone.
|
|
14
|
+---
|
|
15
|
+ cube/CMakeLists.txt | 20 --------------------
|
|
16
|
+ cube/wayland_loader.h | 3 ---
|
|
17
|
+ cube/xcb_loader.h | 3 ---
|
|
18
|
+ cube/xlib_loader.h | 3 ---
|
|
19
|
+ 4 files changed, 29 deletions(-)
|
|
20
|
+
|
|
21
|
+diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt
|
|
22
|
+index 7e135e79..dac6bfed 100644
|
|
23
|
+--- a/cube/CMakeLists.txt
|
|
24
|
++++ b/cube/CMakeLists.txt
|
|
25
|
+@@ -307,16 +307,6 @@ if (ANDROID)
|
|
26
|
+ return()
|
|
27
|
+ endif()
|
|
28
|
+
|
|
29
|
+-if (XCB_LINK_LIBRARIES)
|
|
30
|
+- target_compile_definitions(vkcube PRIVATE "XCB_LIBRARY=\"${XCB_LINK_LIBRARIES}\"")
|
|
31
|
+-endif()
|
|
32
|
+-if (X11_LINK_LIBRARIES)
|
|
33
|
+- target_compile_definitions(vkcube PRIVATE "XLIB_LIBRARY=\"${X11_LINK_LIBRARIES}\"")
|
|
34
|
+-endif()
|
|
35
|
+-if (WAYLAND_CLIENT_LINK_LIBRARIES)
|
|
36
|
+- target_compile_definitions(vkcube PRIVATE "WAYLAND_LIBRARY=\"${WAYLAND_CLIENT_LINK_LIBRARIES}\"")
|
|
37
|
+-endif()
|
|
38
|
+-
|
|
39
|
+ # ----------------------------------------------------------------------------
|
|
40
|
+ # vkcubepp
|
|
41
|
+
|
|
42
|
+@@ -360,16 +350,6 @@ target_include_directories(vkcubepp PRIVATE .)
|
|
43
|
+ target_compile_definitions(vkcubepp PRIVATE ${ENABLED_CUBE_PLATFORMS})
|
|
44
|
+ target_link_libraries(vkcubepp ${CMAKE_DL_LIBS} Vulkan::Headers)
|
|
45
|
+
|
|
46
|
+-if (XCB_LINK_LIBRARIES )
|
|
47
|
+- target_compile_definitions(vkcubepp PUBLIC "XCB_LIBRARY=\"${XCB_LINK_LIBRARIES}\"")
|
|
48
|
+-endif()
|
|
49
|
+-if (X11_LINK_LIBRARIES)
|
|
50
|
+- target_compile_definitions(vkcubepp PUBLIC "XLIB_LIBRARY=\"${X11_LINK_LIBRARIES}\"")
|
|
51
|
+-endif()
|
|
52
|
+-if (WAYLAND_CLIENT_LINK_LIBRARIES)
|
|
53
|
+- target_compile_definitions(vkcubepp PUBLIC "WAYLAND_LIBRARY=\"${WAYLAND_CLIENT_LINK_LIBRARIES}\"")
|
|
54
|
+-endif()
|
|
55
|
+-
|
|
56
|
+ if(APPLE)
|
|
57
|
+ install(
|
|
58
|
+ TARGETS vkcubepp
|
|
59
|
+diff --git a/cube/wayland_loader.h b/cube/wayland_loader.h
|
|
60
|
+index 2afab6e9..7d7d9141 100644
|
|
61
|
+--- a/cube/wayland_loader.h
|
|
62
|
++++ b/cube/wayland_loader.h
|
|
63
|
+@@ -80,9 +80,6 @@ static PFN_wl_display_disconnect cube_wl_display_disconnect = NULL;
|
|
64
|
+
|
|
65
|
+ static inline void *initialize_wayland() {
|
|
66
|
+ void *wayland_library = NULL;
|
|
67
|
+-#if defined(WAYLAND_LIBRARY)
|
|
68
|
+- wayland_library = dlopen(WAYLAND_LIBRARY, RTLD_NOW | RTLD_LOCAL);
|
|
69
|
+-#endif
|
|
70
|
+ if (NULL == wayland_library) {
|
|
71
|
+ wayland_library = dlopen("libwayland-client.so.0", RTLD_NOW | RTLD_LOCAL);
|
|
72
|
+ }
|
|
73
|
+diff --git a/cube/xcb_loader.h b/cube/xcb_loader.h
|
|
74
|
+index a94d5ab5..cecd2540 100644
|
|
75
|
+--- a/cube/xcb_loader.h
|
|
76
|
++++ b/cube/xcb_loader.h
|
|
77
|
+@@ -88,9 +88,6 @@ static PFN_xcb_screen_next cube_xcb_screen_next = NULL;
|
|
78
|
+
|
|
79
|
+ void *initialize_xcb() {
|
|
80
|
+ void *xcb_library = NULL;
|
|
81
|
+-#if defined(XCB_LIBRARY)
|
|
82
|
+- xcb_library = dlopen(XCB_LIBRARY, RTLD_NOW | RTLD_LOCAL);
|
|
83
|
+-#endif
|
|
84
|
+ if (NULL == xcb_library) {
|
|
85
|
+ xcb_library = dlopen("libxcb.so.1", RTLD_NOW | RTLD_LOCAL);
|
|
86
|
+ }
|
|
87
|
+diff --git a/cube/xlib_loader.h b/cube/xlib_loader.h
|
|
88
|
+index c7874d0e..881789f1 100644
|
|
89
|
+--- a/cube/xlib_loader.h
|
|
90
|
++++ b/cube/xlib_loader.h
|
|
91
|
+@@ -72,9 +72,6 @@ static PFN_XFlush cube_XFlush = NULL;
|
|
92
|
+
|
|
93
|
+ void* initialize_xlib() {
|
|
94
|
+ void* xlib_library = NULL;
|
|
95
|
+-#if defined(XLIB_LIBRARY)
|
|
96
|
+- xlib_library = dlopen(XLIB_LIBRARY, RTLD_NOW | RTLD_LOCAL);
|
|
97
|
+-#endif
|
|
98
|
+ if (NULL == xlib_library) {
|
|
99
|
+ xlib_library = dlopen("libX11.so.6", RTLD_NOW | RTLD_LOCAL);
|
|
100
|
+ }
|
|
101
|
+--
|
|
102
|
+2.48.1
|
|
103
|
+ |