build(windows): fix windows.rc line too long errors (#4048)

This commit is contained in:
ReenigneArcher
2025-07-04 11:43:45 -04:00
committed by GitHub
parent 2259141bd2
commit 7e95d536a9
3 changed files with 26 additions and 16 deletions

View File

@ -38,10 +38,17 @@ if(NOT DEFINED SUNSHINE_ICON_PATH)
set(SUNSHINE_ICON_PATH "${CMAKE_SOURCE_DIR}/sunshine.ico")
endif()
configure_file("${CMAKE_SOURCE_DIR}/src/platform/windows/windows.rc.in" windows.rc @ONLY)
# Create a separate object library for the RC file with minimal includes
add_library(sunshine_rc_object OBJECT "${CMAKE_SOURCE_DIR}/src/platform/windows/windows.rc")
# Set minimal properties for RC compilation - only what's needed for the resource file
# Otherwise compilation can fail due to "line too long" errors
set_target_properties(sunshine_rc_object PROPERTIES
COMPILE_DEFINITIONS "PROJECT_ICON_PATH=${SUNSHINE_ICON_PATH};PROJECT_NAME=${PROJECT_NAME};PROJECT_VENDOR=${SUNSHINE_PUBLISHER_NAME};PROJECT_VERSION=${PROJECT_VERSION};PROJECT_VERSION_MAJOR=${PROJECT_VERSION_MAJOR};PROJECT_VERSION_MINOR=${PROJECT_VERSION_MINOR};PROJECT_VERSION_PATCH=${PROJECT_VERSION_PATCH}" # cmake-lint: disable=C0301
INCLUDE_DIRECTORIES ""
)
set(PLATFORM_TARGET_FILES
"${CMAKE_CURRENT_BINARY_DIR}/windows.rc"
"${CMAKE_SOURCE_DIR}/src/platform/windows/publish.cpp"
"${CMAKE_SOURCE_DIR}/src/platform/windows/misc.h"
"${CMAKE_SOURCE_DIR}/src/platform/windows/misc.cpp"

View File

@ -3,5 +3,6 @@ set_target_properties(sunshine PROPERTIES LINK_SEARCH_START_STATIC 1)
set(CMAKE_FIND_LIBRARY_SUFFIXES ".dll")
find_library(ZLIB ZLIB1)
list(APPEND SUNSHINE_EXTERNAL_LIBRARIES
$<TARGET_OBJECTS:sunshine_rc_object>
Windowsapp.lib
Wtsapi32.lib)

View File

@ -1,13 +1,15 @@
/**
* @file src/platform/windows/windows.rc.in
* @brief Windows resource file template.
* @note The final `windows.rc` is generated from this file during the CMake build.
* @todo Use CMake definitions directly, instead of configuring this file.
* @file src/platform/windows/windows.rc
* @brief Windows resource file.
*/
#include "winver.h"
#define STRINGIFY(x) #x
#define TOSTRING(x) STRINGIFY(x)
VS_VERSION_INFO VERSIONINFO
FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
PRODUCTVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
FILEVERSION PROJECT_VERSION_MAJOR,PROJECT_VERSION_MINOR,PROJECT_VERSION_PATCH,0
PRODUCTVERSION PROJECT_VERSION_MAJOR,PROJECT_VERSION_MINOR,PROJECT_VERSION_PATCH,0
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
@ -16,13 +18,13 @@ BEGIN
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "CompanyName", "LizardByte\0"
VALUE "FileDescription", "Sunshine\0"
VALUE "FileVersion", "@PROJECT_VERSION@\0"
VALUE "InternalName", "Sunshine\0"
VALUE "LegalCopyright", "https://raw.githubusercontent.com/LizardByte/Sunshine/master/LICENSE\0"
VALUE "ProductName", "Sunshine\0"
VALUE "ProductVersion", "@PROJECT_VERSION@\0"
VALUE "CompanyName", TOSTRING(PROJECT_VENDOR)
VALUE "FileDescription", TOSTRING(PROJECT_NAME)
VALUE "FileVersion", TOSTRING(PROJECT_VERSION)
VALUE "InternalName", TOSTRING(PROJECT_NAME)
VALUE "ProductName", TOSTRING(PROJECT_NAME)
VALUE "ProductVersion", TOSTRING(PROJECT_VERSION)
VALUE "LegalCopyright", "https://raw.githubusercontent.com/LizardByte/Sunshine/master/LICENSE"
END
END
@ -39,4 +41,4 @@ BEGIN
END
END
SuperDuperAmazing ICON DISCARDABLE "@SUNSHINE_ICON_PATH@"
SuperDuperAmazing ICON DISCARDABLE PROJECT_ICON_PATH