Fix the Linux build of the qt6 branch, compile QML to bytecode only

- Remove Core5Compat (unused, not part of the Steam Frame's system Qt).
- Request GuiPrivate explicitly (required since Qt 6.10 for QRhi); temporary
  until rendering moves to public API.
- Compile QML to bytecode only: C++ generated from QML uses private Qt API
  that only matches the exact Qt version it was built with.
- Pick the OpenVR library per architecture (linux64, linuxarm64, win64) for
  linking and for the copy next to the binary; RPATH $ORIGIN.
- Link libXtst, needed by input_sender_X11.cpp.
- Include d3d11.h and handle QRhi::D3D11 only on Windows.
- Replace leftover easylogging LOG(INFO) calls with qInfo().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Matthias Janetschek
2026-10-07 13:29:53 +02:00
co-authored by Claude Opus 5.5
parent aac3edf7e3
commit 266a2f9ce9
5 changed files with 86 additions and 17 deletions
+37 -8
View File
@@ -12,7 +12,12 @@ set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1)
#find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
#find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Gui Multimedia Qml Quick WebSockets Widgets QuickControls2 QuickDialogs2 Svg)
#find_package(Qt${QT_VERSION_MAJOR} OPTIONAL_COMPONENTS DBus)
find_package(Qt6 REQUIRED COMPONENTS Gui Multimedia Qml Quick WebSockets Widgets QuickControls2 QuickDialogs2 Svg Qml Core5Compat)
# Core5Compat removed: nothing uses it, and the Steam Frame's system Qt
# doesn't ship it.
# GuiPrivate: QRhi (overlaycontroller.cpp) needs it. Since Qt 6.10 private
# modules must be requested explicitly. Temporary: it goes away when rendering
# switches to public API (docs/steamframe/DESIGN.md, section 3).
find_package(Qt6 REQUIRED COMPONENTS Gui Multimedia Qml Quick WebSockets Widgets QuickControls2 QuickDialogs2 Svg Qml GuiPrivate)
find_package(Vulkan REQUIRED)
qt_standard_project_setup(REQUIRES 6.8)
@@ -246,6 +251,15 @@ qt_add_executable(AdvancedSettings
)
#src/res/resources.qrc
# Compile QML to bytecode only, not to C++. C++ generated from QML calls Qt's
# private API (QQmlPrivate::AOTCompiledContext), which only matches the exact
# Qt version it was built with. Bytecode keeps the binary on public API, so it
# runs on another Qt 6 patch release, e.g. the Steam Frame's system Qt.
# Must be set before qt_add_qml_module() reads it.
set_target_properties(AdvancedSettings PROPERTIES
QT_QMLCACHEGEN_ARGUMENTS --only-bytecode
)
qt_add_qml_module(AdvancedSettings
URI AdvancedSettings
QML_FILES
@@ -264,6 +278,12 @@ target_include_directories(AdvancedSettings PUBLIC
# Avoid collision between executable name and QML module directory (QTBUG-98568).
if(NOT WIN32 AND NOT APPLE)
set_property(TARGET AdvancedSettings PROPERTY OUTPUT_NAME AdvancedSettings_app)
# libopenvr_api.so is copied next to the executable (see "openvrApiCopy");
# $ORIGIN makes the loader look there, in the build tree and in packages.
set_target_properties(AdvancedSettings PROPERTIES
BUILD_RPATH "$ORIGIN"
INSTALL_RPATH "$ORIGIN"
)
endif()
target_compile_definitions(AdvancedSettings PRIVATE
@@ -282,16 +302,20 @@ target_compile_definitions(AdvancedSettings PRIVATE
# NO_DEFAULT_PATH
# NO_CMAKE_FIND_ROOT_PATH)
# Directory of the OpenVR library for the target platform. Linux distinguishes
# x86_64 (linux64) from aarch64 (linuxarm64, e.g. the Steam Frame).
if (WIN32)
target_link_directories(AdvancedSettings PRIVATE
${CMAKE_SOURCE_DIR}/third-party/openvr/lib/win64
)
set(OPENVR_LIB_DIR ${CMAKE_SOURCE_DIR}/third-party/openvr/lib/win64)
elseif (CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64|arm64|ARM64)$")
set(OPENVR_LIB_DIR ${CMAKE_SOURCE_DIR}/third-party/openvr/lib/linuxarm64)
else ()
set(OPENVR_LIB_DIR ${CMAKE_SOURCE_DIR}/third-party/openvr/lib/linux64)
endif ()
target_link_directories(AdvancedSettings PRIVATE ${OPENVR_LIB_DIR})
target_link_libraries(AdvancedSettings PRIVATE
Qt::Gui
Qt6::Core5Compat
# For QRhi
# For QRhi; temporary, see find_package(Qt6 ...) above.
Qt::GuiPrivate
Qt::Multimedia
Qt::Qml
@@ -377,7 +401,7 @@ if (WIN32)
else ()
add_custom_command(TARGET AdvancedSettings POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/third-party/openvr/lib/linux64/libopenvr_api.so" "${COPY_DEST_DIR}/libopenvr_api.so"
"${OPENVR_LIB_DIR}/libopenvr_api.so" "${COPY_DEST_DIR}/libopenvr_api.so"
)
endif ()
@@ -430,7 +454,12 @@ elseif (UNIX)
src/keyboard_input/input_sender_X11.cpp
)
find_package(X11 REQUIRED)
target_link_libraries(AdvancedSettings PRIVATE ${X11_LIBRARIES})
# input_sender_X11.cpp uses the XTest extension (XTestFakeKeyEvent,
# XTestGrabControl), which lives in its own library.
if (NOT X11_XTest_FOUND)
message(FATAL_ERROR "libXtst (X11 XTest extension) not found")
endif ()
target_link_libraries(AdvancedSettings PRIVATE ${X11_LIBRARIES} ${X11_XTest_LIB})
elseif (NOT APPLE AND noX11)
target_sources(AdvancedSettings PRIVATE
src/keyboard_input/input_sender_dummy.cpp