Skip to content

Commit cedd842

Browse files
authored
Expose IDYNTREE_GLFW_TRY_WAYLAND_FIRST option to try to open Windows with Wayland first on Linux
1 parent 9c82400 commit cedd842

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/visualization/CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,25 @@ if(IDYNTREE_USES_IRRLICHT)
9797
find_library(IOKIT_LIBRARY IOKit)
9898
target_link_libraries(${libraryname} LINK_PRIVATE ${CARBON_LIBRARY} ${COCOA_LIBRARY} ${IOKIT_LIBRARY})
9999
endif ()
100+
101+
# On Linux, in some system for some reason creating a windows with X does not work, but creating it with Wayland
102+
# yes. For this reason, we expose an option to permit to try to create a glfw window via wayland. This is an
103+
# option and is not enabled by default as the glfw version shipped via apt with Ubuntu version before 24.10, so
104+
# we expose this as an option and we enable it by default only if we are configuring inside a conda environment
105+
# Once we drop support for apt dependencies on Ubuntu 24.04, we will be able to remove this code and always
106+
# try wayland first
107+
if(NOT WIN32 AND NOT APPLE)
108+
if(DEFINED ENV{CONDA_PREFIX})
109+
set(IDYNTREE_GLFW_TRY_WAYLAND_FIRST_DEFAULT_VALUE ON)
110+
else()
111+
set(IDYNTREE_GLFW_TRY_WAYLAND_FIRST_DEFAULT_VALUE OFF)
112+
endif()
113+
option(IDYNTREE_GLFW_TRY_WAYLAND_FIRST "If enabled, when creating a window iDynTree will try first to use wayland and only on failure X11" ${IDYNTREE_GLFW_TRY_WAYLAND_FIRST_DEFAULT_VALUE})
114+
mark_as_advanced(IDYNTREE_GLFW_TRY_WAYLAND_FIRST)
115+
if(IDYNTREE_GLFW_TRY_WAYLAND_FIRST)
116+
add_definitions(-DIDYNTREE_GLFW_TRY_WAYLAND_FIRST)
117+
endif()
118+
endif()
100119
endif()
101120

102121
if(IDYNTREE_USES_MESHCATCPP)

0 commit comments

Comments
 (0)