Skip to content

Commit f653c28

Browse files
authored
merge:合并官方代码 (#157)
* merge:合并官方代码 * fix: 无法获取PIN设备列表 * fix: 无法获取PIN设备列表
1 parent 1ab2b9b commit f653c28

25 files changed

Lines changed: 482 additions & 683 deletions

File tree

CMakeLists.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
cmake_minimum_required(VERSION 3.18)
1+
cmake_minimum_required(VERSION 3.20)
22
# `CMAKE_CUDA_ARCHITECTURES` requires 3.18
3-
# set_source_files_properties requires 3.18
3+
# `set_source_files_properties` requires 3.18
4+
# `cmake_path(CONVERT ... TO_NATIVE_PATH_LIST ...)` requires 3.20
45
# todo - set this conditionally
56

67
project(Sunshine VERSION 0.0.0

cmake/compile_definitions/common.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
153153
${MINIUPNP_LIBRARIES}
154154
${CMAKE_THREAD_LIBS_INIT}
155155
enet
156+
nlohmann_json::nlohmann_json
156157
opus
157158
${FFMPEG_LIBRARIES}
158159
${Boost_LIBRARIES}

cmake/compile_definitions/windows.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
1010
# gcc complains about misleading indentation in some mingw includes
1111
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-misleading-indentation)
1212

13+
# gcc15 complains about non-template type 'coroutine_handle' used as a template in Windows.Foundation.h
14+
# can remove after https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120495 is available in mingw-w64
15+
list(APPEND SUNSHINE_COMPILE_OPTIONS -Wno-template-body)
16+
1317
# see gcc bug 98723
1418
add_definitions(-DUSE_BOOST_REGEX)
1519

cmake/dependencies/common.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/moonlight-common-c/enet")
1313
add_subdirectory("${CMAKE_SOURCE_DIR}/third-party/Simple-Web-Server")
1414

1515
# common dependencies
16+
include("${CMAKE_MODULE_PATH}/dependencies/nlohmann_json.cmake")
1617
find_package(OpenSSL REQUIRED)
1718
find_package(PkgConfig REQUIRED)
1819
find_package(Threads REQUIRED)

cmake/packaging/windows.cmake

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/service/"
1818
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/migration/"
1919
DESTINATION "scripts"
2020
COMPONENT assets)
21-
21+
# add sunshine enviroment to PATH
22+
# install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/path/"
23+
# DESTINATION "scripts"
24+
# COMPONENT assets)
2225
# Configurable options for the service
2326
install(DIRECTORY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/misc/autostart/"
2427
DESTINATION "scripts"
@@ -52,9 +55,9 @@ file(COPY "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/"
5255
DESTINATION "${CMAKE_BINARY_DIR}/assets"
5356
PATTERN "shaders" EXCLUDE)
5457
# use junction for shaders directory
55-
file(TO_NATIVE_PATH "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/shaders" shaders_in_build_src_native)
56-
file(TO_NATIVE_PATH "${CMAKE_BINARY_DIR}/assets/shaders" shaders_in_build_dest_native)
57-
execute_process(COMMAND cp -rpf "${shaders_in_build_src_native}" "${shaders_in_build_dest_native}")
58+
cmake_path(CONVERT "${SUNSHINE_SOURCE_ASSETS_DIR}/windows/assets/shaders"
59+
TO_NATIVE_PATH_LIST shaders_in_build_src_native)
60+
cmake_path(CONVERT "${CMAKE_BINARY_DIR}/assets/shaders" TO_NATIVE_PATH_LIST shaders_in_build_dest_native)
5861

5962
set(CPACK_PACKAGE_ICON "${CMAKE_SOURCE_DIR}\\\\sunshine.ico")
6063

cmake/prep/init.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ elseif (UNIX)
88
endif()
99

1010
if(SUNSHINE_BUILD_FLATPAK)
11-
set(SUNSHINE_SERVICE_START_COMMAND "ExecStart=${PROJECT_FQDN}")
11+
set(SUNSHINE_SERVICE_START_COMMAND "ExecStart=flatpak run --command=sunshine ${PROJECT_FQDN}")
1212
set(SUNSHINE_SERVICE_STOP_COMMAND "ExecStop=flatpak kill ${PROJECT_FQDN}")
1313
else()
1414
set(SUNSHINE_SERVICE_START_COMMAND "ExecStart=${SUNSHINE_EXECUTABLE_PATH}")

cmake/prep/options.cmake

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ set(SUNSHINE_PUBLISHER_ISSUE_URL "https://app.lizardbyte.dev/support"
99

1010
option(BUILD_DOCS "Build documentation" OFF)
1111
option(BUILD_TESTS "Build tests" OFF)
12-
option(TESTS_ENABLE_PYTHON_TESTS "Enable Python tests" OFF)
12+
option(NPM_OFFLINE "Use offline npm packages. You must ensure packages are in your npm cache." OFF)
1313

1414
option(BUILD_WERROR "Enable -Werror flag." OFF)
1515

@@ -28,6 +28,7 @@ else()
2828
option(BOOST_USE_STATIC "Use static boost libraries." ON)
2929
endif()
3030

31+
option(CUDA_FAIL_ON_MISSING "Fail the build if CUDA is not found." ON)
3132
option(CUDA_INHERIT_COMPILE_OPTIONS
3233
"When building CUDA code, inherit compile options from the the main project. You may want to disable this if
3334
your IDE throws errors about unknown flags after running cmake." ON)
@@ -65,6 +66,4 @@ elseif(UNIX) # Linux
6566
"Enable building wayland specific code." ON)
6667
option(SUNSHINE_ENABLE_X11
6768
"Enable X11 grab if available." ON)
68-
option(SUNSHINE_USE_LEGACY_INPUT # TODO: Remove this legacy option after the next stable release
69-
"Use the legacy virtual input implementation." OFF)
7069
endif()

cmake/targets/common.cmake

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,17 @@ endif()
5353

5454
#WebUI build
5555
find_program(NPM npm REQUIRED)
56+
57+
if (NPM_OFFLINE)
58+
set(NPM_INSTALL_FLAGS "--offline")
59+
else()
60+
set(NPM_INSTALL_FLAGS "")
61+
endif()
62+
5663
add_custom_target(web-ui ALL
5764
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
5865
COMMENT "Installing NPM Dependencies and Building the Web UI"
59-
COMMAND "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" install
66+
COMMAND "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" install ${NPM_INSTALL_FLAGS}
6067
COMMAND "${CMAKE_COMMAND}" -E env "SUNSHINE_BUILD_HOMEBREW=${NPM_BUILD_HOMEBREW}" "SUNSHINE_SOURCE_ASSETS_DIR=${NPM_SOURCE_ASSETS_DIR}" "SUNSHINE_ASSETS_DIR=${NPM_ASSETS_DIR}" "$<$<BOOL:${WIN32}>:cmd;/C>" "${NPM}" run build # cmake-lint: disable=C0301
6168
COMMAND_EXPAND_LISTS
6269
VERBATIM)

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
"@popperjs/core": "2.11.8",
1313
"bootstrap": "5.3.3",
1414
"nanoid": "^5.0.7",
15-
"vue": "3.4.38",
16-
"vue-i18n": "9.14.0",
15+
"vue": "3.5.18",
16+
"vue-i18n": "11.1.11",
1717
"vuedraggable": "^4.1.0"
1818
},
1919
"devDependencies": {
2020
"@vitejs/plugin-vue": "4.6.2",
2121
"express": "^4.18.2",
22-
"vite": "4.5.2",
22+
"vite": "4.5.14",
2323
"vite-plugin-ejs": "1.6.4",
2424
"vite-plugin-mkcert": "^1.17.8"
2525
}

src/config.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1022,9 +1022,12 @@ namespace config {
10221022

10231023
void
10241024
apply_config(std::unordered_map<std::string, std::string> &&vars) {
1025+
#ifndef __ANDROID__
1026+
// TODO: Android can possibly support this
10251027
if (!fs::exists(stream.file_apps.c_str())) {
10261028
fs::copy_file(SUNSHINE_ASSETS_DIR "/apps.json", stream.file_apps);
10271029
}
1030+
#endif
10281031

10291032
for (auto &[name, val] : vars) {
10301033
BOOST_LOG(info) << "config: '"sv << name << "' = "sv << val;
@@ -1051,7 +1054,7 @@ namespace config {
10511054
bool_f(vars, "nvenc_opengl_vulkan_on_dxgi", video.nv_opengl_vulkan_on_dxgi);
10521055
bool_f(vars, "nvenc_latency_over_power", video.nv_sunshine_high_power_mode);
10531056

1054-
#ifndef __APPLE__
1057+
#if !defined(__ANDROID__) && !defined(__APPLE__)
10551058
video.nv_legacy.preset = video.nv.quality_preset + 11;
10561059
video.nv_legacy.multipass = video.nv.two_pass == nvenc::nvenc_two_pass::quarter_resolution ? NV_ENC_TWO_PASS_QUARTER_RESOLUTION :
10571060
video.nv.two_pass == nvenc::nvenc_two_pass::full_resolution ? NV_ENC_TWO_PASS_FULL_RESOLUTION :

0 commit comments

Comments
 (0)