refactor(sonar): migrate worker threads to std::jthread (#5398)

This commit is contained in:
Dave Lane
2026-07-12 00:30:05 -04:00
committed by GitHub
parent 40ae6c8002
commit 3377f7a73f
24 changed files with 79 additions and 48 deletions

View File

@@ -25,11 +25,17 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-uninitialized)
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^(Apple)?Clang$")
# Clang specific compile options
# Clang doesn't actually complain about this this, so disabling for now
# list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-uninitialized)
# Some libc++ versions on Apple and FreeBSD guard std::jthread behind this flag.
if(APPLE OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD")
list(APPEND SUNSHINE_COMPILE_OPTIONS -fexperimental-library)
list(APPEND SUNSHINE_LINK_OPTIONS -fexperimental-library)
endif()
endif()
if(BUILD_WERROR)
list(APPEND SUNSHINE_COMPILE_OPTIONS -Werror)

View File

@@ -34,6 +34,7 @@ if(CUDA_INHERIT_COMPILE_OPTIONS)
endif()
target_compile_options(sunshine PRIVATE $<$<COMPILE_LANGUAGE:CXX>:${SUNSHINE_COMPILE_OPTIONS}>;$<$<COMPILE_LANGUAGE:CUDA>:${SUNSHINE_COMPILE_OPTIONS_CUDA};-std=c++17>) # cmake-lint: disable=C0301
target_link_options(sunshine PRIVATE ${SUNSHINE_LINK_OPTIONS})
# Homebrew build fails the vite build if we set these environment variables
if(${SUNSHINE_BUILD_HOMEBREW})

View File

@@ -2,8 +2,11 @@
if(NOT FREEBSD)
# Using newer c++ compilers / features on older distros causes runtime dyn link errors
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
-static-libgcc
-static-libstdc++
)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES -static-libgcc)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 15)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES stdc++)
else()
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES -static-libstdc++)
endif()
endif()