[Bf-blender-cvs] [c4255992163] master: Fix linker order of X11 and Wayland libs

Sebastian Parborg noreply at git.blender.org
Tue Oct 11 14:55:01 CEST 2022


Commit: c4255992163da64e3fab7b8fe196cb119dffccc2
Author: Sebastian Parborg
Date:   Tue Oct 11 14:52:35 2022 +0200
Branches: master
https://developer.blender.org/rBc4255992163da64e3fab7b8fe196cb119dffccc2

Fix linker order of X11 and Wayland libs

For some compiler and linker configurations, linking would fail as the
wayland libs were linked at a high level and not at the actual code
where they were needed.

After talking to Campbell, we decided to clean up this part and now
only link both the X11 and Wayland libs where they are used.

===================================================================

M	build_files/cmake/platform/platform_unix.cmake
M	intern/ghost/CMakeLists.txt

===================================================================

diff --git a/build_files/cmake/platform/platform_unix.cmake b/build_files/cmake/platform/platform_unix.cmake
index 0b137ae93d6..7b7937959bf 100644
--- a/build_files/cmake/platform/platform_unix.cmake
+++ b/build_files/cmake/platform/platform_unix.cmake
@@ -778,31 +778,11 @@ if(WITH_GHOST_WAYLAND)
       endif()
     endif()
 
-    list(APPEND PLATFORM_LINKLIBS
-      ${xkbcommon_LINK_LIBRARIES}
-    )
-
-    if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
-      list(APPEND PLATFORM_LINKLIBS
-        ${wayland-client_LINK_LIBRARIES}
-        ${wayland-egl_LINK_LIBRARIES}
-        ${wayland-cursor_LINK_LIBRARIES}
-      )
-    endif()
-
     if(WITH_GHOST_WAYLAND_DBUS)
-      list(APPEND PLATFORM_LINKLIBS
-        ${dbus_LINK_LIBRARIES}
-      )
       add_definitions(-DWITH_GHOST_WAYLAND_DBUS)
     endif()
 
     if(WITH_GHOST_WAYLAND_LIBDECOR)
-      if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
-        list(APPEND PLATFORM_LINKLIBS
-          ${libdecor_LIBRARIES}
-        )
-      endif()
       add_definitions(-DWITH_GHOST_WAYLAND_LIBDECOR)
     endif()
 
@@ -855,12 +835,8 @@ if(WITH_GHOST_X11)
   find_path(X11_XF86keysym_INCLUDE_PATH X11/XF86keysym.h ${X11_INC_SEARCH_PATH})
   mark_as_advanced(X11_XF86keysym_INCLUDE_PATH)
 
-  list(APPEND PLATFORM_LINKLIBS ${X11_X11_LIB})
-
   if(WITH_X11_XINPUT)
-    if(X11_Xinput_LIB)
-      list(APPEND PLATFORM_LINKLIBS ${X11_Xinput_LIB})
-    else()
+    if(NOT X11_Xinput_LIB)
       message(FATAL_ERROR "LibXi not found. Disable WITH_X11_XINPUT if you
       want to build without tablet support")
     endif()
@@ -870,18 +846,14 @@ if(WITH_GHOST_X11)
     # XXX, why doesn't cmake make this available?
     find_library(X11_Xxf86vmode_LIB Xxf86vm   ${X11_LIB_SEARCH_PATH})
     mark_as_advanced(X11_Xxf86vmode_LIB)
-    if(X11_Xxf86vmode_LIB)
-      list(APPEND PLATFORM_LINKLIBS ${X11_Xxf86vmode_LIB})
-    else()
+    if(NOT X11_Xxf86vmode_LIB)
       message(FATAL_ERROR "libXxf86vm not found. Disable WITH_X11_XF86VMODE if you
       want to build without")
     endif()
   endif()
 
   if(WITH_X11_XFIXES)
-    if(X11_Xfixes_LIB)
-      list(APPEND PLATFORM_LINKLIBS ${X11_Xfixes_LIB})
-    else()
+    if(NOT X11_Xfixes_LIB)
       message(FATAL_ERROR "libXfixes not found. Disable WITH_X11_XFIXES if you
       want to build without")
     endif()
@@ -890,9 +862,7 @@ if(WITH_GHOST_X11)
   if(WITH_X11_ALPHA)
     find_library(X11_Xrender_LIB Xrender  ${X11_LIB_SEARCH_PATH})
     mark_as_advanced(X11_Xrender_LIB)
-    if(X11_Xrender_LIB)
-      list(APPEND PLATFORM_LINKLIBS ${X11_Xrender_LIB})
-    else()
+    if(NOT X11_Xrender_LIB)
       message(FATAL_ERROR "libXrender not found. Disable WITH_X11_ALPHA if you
       want to build without")
     endif()
diff --git a/intern/ghost/CMakeLists.txt b/intern/ghost/CMakeLists.txt
index aa23618ca39..9e3a15dd543 100644
--- a/intern/ghost/CMakeLists.txt
+++ b/intern/ghost/CMakeLists.txt
@@ -262,6 +262,9 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
       ${xkbcommon_INCLUDE_DIRS}
       ${wayland-cursor_INCLUDE_DIRS}
     )
+    list(APPEND LIB
+      ${xkbcommon_LINK_LIBRARIES}
+    )
 
     if(WITH_GHOST_WAYLAND_DYNLOAD)
       list(APPEND INC_SYS
@@ -271,18 +274,32 @@ elseif(WITH_GHOST_X11 OR WITH_GHOST_WAYLAND)
         bf_intern_wayland_dynload
       )
       add_definitions(-DWITH_GHOST_WAYLAND_DYNLOAD)
+    else()
+      list(APPEND LIB
+        ${wayland-client_LINK_LIBRARIES}
+        ${wayland-egl_LINK_LIBRARIES}
+        ${wayland-cursor_LINK_LIBRARIES}
+      )
     endif()
 
     if(WITH_GHOST_WAYLAND_DBUS)
       list(APPEND INC_SYS
         ${dbus_INCLUDE_DIRS}
       )
+      list(APPEND LIB
+        ${dbus_LINK_LIBRARIES}
+      )
     endif()
 
     if(WITH_GHOST_WAYLAND_LIBDECOR)
       list(APPEND INC_SYS
         ${libdecor_INCLUDE_DIRS}
       )
+      if(NOT WITH_GHOST_WAYLAND_DYNLOAD)
+        list(APPEND LIB
+          ${libdecor_LIBRARIES}
+        )
+      endif()
     endif()
 
     include(CheckSymbolExists)



More information about the Bf-blender-cvs mailing list