Bundle VC runtime DLLs for Windows installer

- Support user-level install (no admin required)
- Bundle MSVC runtime DLLs from deps/vcruntime
- Offer system-wide VCRedist install when running as admin
- Add portable ZIP artifact (windows_zip target)
- Add combined windows_all target for installer + ZIP
This commit is contained in:
Andrew Rabert committed 2025-12-26 03:49:48 -05:00
1 parent 01a50a8bab
commit 747275054e
4 files changed
+118 -65

No files matched your search

+21
View File
@@ -48,6 +48,27 @@ else()
message(STATUS "Not using separate ANGLE deps")
endif()
# Bundle MSVC runtime DLLs (pre-extracted by setup-windows.bat)
set(VCRUNTIME_DIR "@PROJECT_SOURCE_DIR@/deps/vcruntime")
set(VCREDIST_EXE "@PROJECT_SOURCE_DIR@/deps/vc_redist.x64.exe")
if(EXISTS "${VCRUNTIME_DIR}" AND EXISTS "${VCREDIST_EXE}")
# Copy runtime DLLs to redist subfolder
file(MAKE_DIRECTORY "${CMAKE_INSTALL_PREFIX}/redist")
file(GLOB RUNTIME_DLLS "${VCRUNTIME_DIR}/*.dll")
foreach(dll_path ${RUNTIME_DLLS})
get_filename_component(dll_name "${dll_path}" NAME)
file(INSTALL "${dll_path}" DESTINATION "${CMAKE_INSTALL_PREFIX}/redist")
message(STATUS "Bundled runtime: ${dll_name}")
endforeach()
# Copy VCRedist installer for bundling
file(INSTALL "${VCREDIST_EXE}" DESTINATION "${CMAKE_INSTALL_PREFIX}")
message(STATUS "Bundled VCRedist installer: vc_redist.x64.exe")
else()
message(WARNING "VCRuntime DLLs not found. Run setup-windows.bat first.")
endif()
if(@DO_SIGN@)
file(GLOB_RECURSE EXES ${CMAKE_INSTALL_PREFIX}/*.exe ${CMAKE_INSTALL_PREFIX}/*.dll)
set(ENV{errorlevel} 1)
+32
View File
@@ -59,4 +59,36 @@ add_custom_target(JellyfinDesktopInstaller
# Alias target for convenience
add_custom_target(windows_package DEPENDS JellyfinDesktopInstaller)
# Create portable ZIP archive (includes bundled runtime DLLs in root)
set(ZIP_OUTPUT_NAME "${INSTALLER_BASE_NAME}.zip")
set(ZIP_STAGING_DIR "${CMAKE_CURRENT_BINARY_DIR}/portable")
# Configure the prepare script
configure_file(
${PROJECT_SOURCE_DIR}/CMakeModules/PreparePortableZip.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/PreparePortableZip.cmake
@ONLY
)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${ZIP_OUTPUT_NAME}
DEPENDS innosetup_install ${CMAKE_CURRENT_BINARY_DIR}/PreparePortableZip.cmake
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/PreparePortableZip.cmake
COMMAND ${CMAKE_COMMAND} -E tar cf ${CMAKE_CURRENT_BINARY_DIR}/${ZIP_OUTPUT_NAME} --format=zip .
WORKING_DIRECTORY ${ZIP_STAGING_DIR}
COMMENT "Building portable ZIP: ${ZIP_OUTPUT_NAME}"
VERBATIM
)
add_custom_target(JellyfinDesktopZip
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${ZIP_OUTPUT_NAME}
)
add_custom_target(windows_zip DEPENDS JellyfinDesktopZip)
# Combined target for both installer and ZIP
add_custom_target(windows_all DEPENDS JellyfinDesktopInstaller JellyfinDesktopZip)
message(STATUS "Windows installer target configured: windows_package")
message(STATUS "Windows portable ZIP target configured: windows_zip")
message(STATUS "Windows combined target configured: windows_all")