mirror of
https://github.com/LizardByte/Sunshine.git
synced 2026-08-18 02:55:12 +00:00
build(windows): default to qt6-static (#5497)
This commit is contained in:
4
.github/workflows/ci-windows.yml
vendored
4
.github/workflows/ci-windows.yml
vendored
@ -240,12 +240,10 @@ jobs:
|
||||
-S . \
|
||||
-DBUILD_WERROR=ON \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_PREFIX_PATH="${MINGW_PREFIX}/qt6-static" \
|
||||
-DSUNSHINE_ASSETS_DIR=assets \
|
||||
-DSUNSHINE_PUBLISHER_NAME="${GITHUB_REPOSITORY_OWNER}" \
|
||||
-DSUNSHINE_PUBLISHER_WEBSITE="https://app.lizardbyte.dev" \
|
||||
-DSUNSHINE_PUBLISHER_ISSUE_URL="https://app.lizardbyte.dev/support" \
|
||||
-DSUNSHINE_USE_STATIC_QT=ON
|
||||
-DSUNSHINE_PUBLISHER_ISSUE_URL="https://app.lizardbyte.dev/support"
|
||||
echo "::add-matcher::.github/matchers/gcc.json"
|
||||
ninja -C build
|
||||
echo "::remove-matcher owner=gcc::"
|
||||
|
||||
@ -50,6 +50,7 @@ include(${CMAKE_MODULE_PATH}/prep/build_version.cmake)
|
||||
|
||||
# cmake build flags
|
||||
include(${CMAKE_MODULE_PATH}/prep/options.cmake)
|
||||
include(${CMAKE_MODULE_PATH}/prep/static_qt.cmake)
|
||||
|
||||
# initial prep
|
||||
include(${CMAKE_MODULE_PATH}/prep/init.cmake)
|
||||
|
||||
@ -20,7 +20,7 @@ option(SUNSHINE_ENABLE_TRAY "Enable system tray icon." ON)
|
||||
|
||||
if(WIN32)
|
||||
option(SUNSHINE_USE_STATIC_QT
|
||||
"Require static Qt libraries and their static third-party dependencies." OFF)
|
||||
"Require static Qt libraries and their static third-party dependencies." ON)
|
||||
endif()
|
||||
|
||||
option(SUNSHINE_SYSTEM_VULKAN_HEADERS "Use system installation of vulkan-headers rather than the submodule." OFF)
|
||||
|
||||
34
cmake/prep/static_qt.cmake
Normal file
34
cmake/prep/static_qt.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
# Configure the standard MSYS2 static Qt prefix automatically for Windows builds.
|
||||
|
||||
if(WIN32 AND SUNSHINE_ENABLE_TRAY AND SUNSHINE_USE_STATIC_QT AND NOT Qt6_DIR)
|
||||
set(_sunshine_static_qt_prefix "")
|
||||
|
||||
# Prefer the prefix exported by an interactive MSYS2 environment.
|
||||
if(DEFINED ENV{MINGW_PREFIX} AND NOT "$ENV{MINGW_PREFIX}" STREQUAL "") # cmake-lint: disable=W0106
|
||||
file(TO_CMAKE_PATH "$ENV{MINGW_PREFIX}/qt6-static" _sunshine_static_qt_candidate)
|
||||
if(EXISTS "${_sunshine_static_qt_candidate}/lib/cmake/Qt6/Qt6Config.cmake")
|
||||
set(_sunshine_static_qt_prefix "${_sunshine_static_qt_candidate}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# IDEs may not inherit MINGW_PREFIX, so derive the toolchain root from the compiler path.
|
||||
if(NOT _sunshine_static_qt_prefix)
|
||||
get_filename_component(_sunshine_compiler_bin_dir "${CMAKE_CXX_COMPILER}" DIRECTORY)
|
||||
get_filename_component(_sunshine_compiler_prefix "${_sunshine_compiler_bin_dir}" DIRECTORY)
|
||||
set(_sunshine_static_qt_candidate "${_sunshine_compiler_prefix}/qt6-static")
|
||||
if(EXISTS "${_sunshine_static_qt_candidate}/lib/cmake/Qt6/Qt6Config.cmake")
|
||||
set(_sunshine_static_qt_prefix "${_sunshine_static_qt_candidate}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(_sunshine_static_qt_prefix)
|
||||
list(APPEND CMAKE_PREFIX_PATH "${_sunshine_static_qt_prefix}")
|
||||
list(REMOVE_DUPLICATES CMAKE_PREFIX_PATH)
|
||||
message(STATUS "Using static Qt prefix: ${_sunshine_static_qt_prefix}")
|
||||
endif()
|
||||
|
||||
unset(_sunshine_compiler_bin_dir)
|
||||
unset(_sunshine_compiler_prefix)
|
||||
unset(_sunshine_static_qt_candidate)
|
||||
unset(_sunshine_static_qt_prefix)
|
||||
endif()
|
||||
@ -189,13 +189,13 @@ fi
|
||||
pacman -S "${dependencies[@]}"
|
||||
```
|
||||
|
||||
The static Qt package is installed under a separate prefix. Add the following options when configuring a Windows
|
||||
build so Sunshine and Qt's third-party dependencies are linked statically:
|
||||
Static Qt is enabled by default on Windows. Sunshine automatically adds the MSYS2 static Qt prefix at
|
||||
`${MINGW_PREFIX}/qt6-static` when that package is installed. If an IDE does not inherit `MINGW_PREFIX`, Sunshine
|
||||
derives the same prefix from the selected compiler. If static Qt is installed in a custom location, specify it with
|
||||
`-DCMAKE_PREFIX_PATH=/path/to/qt6-static`.
|
||||
|
||||
```bash
|
||||
-DCMAKE_PREFIX_PATH="${MINGW_PREFIX}/qt6-static" \
|
||||
-DSUNSHINE_USE_STATIC_QT=ON
|
||||
```
|
||||
To use dynamic Qt instead, configure with `-DSUNSHINE_USE_STATIC_QT=OFF` and ensure the dynamic Qt package is
|
||||
available through the normal toolchain prefix.
|
||||
|
||||
To create a WiX installer, you also need to install [.NET](https://dotnet.microsoft.com/download).
|
||||
|
||||
|
||||
Reference in New Issue
Block a user