diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 614306b..e4f3718 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -79,11 +79,26 @@ jobs: - name: Install OpenSSL (Windows) if: startsWith(matrix.os, 'windows-') - run: | - choco install openssl.light -y --params "/InstallDir:C:\OpenSSL" || echo "OpenSSL may already be installed" - # Persist OPENSSL_ROOT for later CMake configure step - Write-Output "OPENSSL_ROOT=C:\OpenSSL" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append shell: pwsh + run: | + $ErrorActionPreference = 'Stop' + $installDir = 'C:\OpenSSL' + $max = 3 + for ($i = 1; $i -le $max; $i++) { + try { + choco install openssl.light -y --params "/InstallDir:$installDir" + break + } catch { + if ($i -eq $max) { throw } + Write-Host "OpenSSL install failed (attempt $i/$max). Retrying in 20s..." + Start-Sleep -Seconds 20 + } + } + if (Test-Path "$installDir\bin\openssl.exe") { + "OPENSSL_ROOT=$installDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append + } else { + Write-Host "OpenSSL not found at $installDir; not setting OPENSSL_ROOT." + } # Qt - name: Install Qt 6.10.2 + QtIFW diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 8076670..dd807c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -283,9 +283,16 @@ if(WIN32) install(DIRECTORY ${_qt_deploy_dir}/ DESTINATION bin COMPONENT Application) install(FILES ${CMAKE_BINARY_DIR}/LICENSE.txt DESTINATION doc COMPONENT Application) if(OPENSSL_ROOT) - install(FILES ${OPENSSL_ROOT}/bin/openssl.exe DESTINATION bin COMPONENT Application) - install(FILES ${OPENSSL_ROOT}/bin/libcrypto-3-x64.dll DESTINATION bin COMPONENT Application) - install(FILES ${OPENSSL_ROOT}/bin/libssl-3-x64.dll DESTINATION bin COMPONENT Application) + set(_openssl_exe "${OPENSSL_ROOT}/bin/openssl.exe") + set(_openssl_crypto "${OPENSSL_ROOT}/bin/libcrypto-3-x64.dll") + set(_openssl_ssl "${OPENSSL_ROOT}/bin/libssl-3-x64.dll") + if(EXISTS "${_openssl_exe}" AND EXISTS "${_openssl_crypto}" AND EXISTS "${_openssl_ssl}") + install(FILES "${_openssl_exe}" DESTINATION bin COMPONENT Application) + install(FILES "${_openssl_crypto}" DESTINATION bin COMPONENT Application) + install(FILES "${_openssl_ssl}" DESTINATION bin COMPONENT Application) + else() + message(WARNING "OPENSSL_ROOT is set to '${OPENSSL_ROOT}', but required OpenSSL runtime files were not found. Skipping bundling OpenSSL into the installer.") + endif() endif() elseif(APPLE) install(DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_TARGET_NAME}/${PROJECT_SHORT_REL_NAME}.app DESTINATION . USE_SOURCE_PERMISSIONS COMPONENT Application)