Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/ci-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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::"
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion cmake/prep/options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
34 changes: 34 additions & 0 deletions cmake/prep/static_qt.cmake
Original file line number Diff line number Diff line change
@@ -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()
12 changes: 6 additions & 6 deletions docs/building.md
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Expand Down
Loading