Skip to content

Commit 5c661fa

Browse files
committed
Move Win installer creation to CMake
1 parent d901dbb commit 5c661fa

2 files changed

Lines changed: 66 additions & 24 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,26 @@ jobs:
8181
8282
- name: Install OpenSSL (Windows)
8383
if: startsWith(matrix.os, 'windows-')
84-
run: |
85-
choco install openssl.light -y --params "/InstallDir:C:\OpenSSL" || echo "OpenSSL may already be installed"
86-
# Persist OPENSSL_ROOT for later CMake configure step
87-
Write-Output "OPENSSL_ROOT=C:\OpenSSL" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
8884
shell: pwsh
85+
run: |
86+
$ErrorActionPreference = 'Stop'
87+
$installDir = 'C:\OpenSSL'
88+
$max = 3
89+
for ($i = 1; $i -le $max; $i++) {
90+
try {
91+
choco install openssl.light -y --params "/InstallDir:$installDir"
92+
break
93+
} catch {
94+
if ($i -eq $max) { throw }
95+
Write-Host "OpenSSL install failed (attempt $i/$max). Retrying in 20s..."
96+
Start-Sleep -Seconds 20
97+
}
98+
}
99+
if (Test-Path "$installDir\bin\openssl.exe") {
100+
"OPENSSL_ROOT=$installDir" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
101+
} else {
102+
Write-Host "OpenSSL not found at $installDir; not setting OPENSSL_ROOT."
103+
}
89104
90105
# Qt
91106
- name: Install Qt
@@ -180,25 +195,9 @@ jobs:
180195
shell: pwsh
181196

182197
# Build
183-
- name: Build (Unix)
184-
if: matrix.os != 'windows-latest'
198+
- name: Build
185199
run: cmake --build build-Release --target package --parallel
186200

187-
- name: Build (Windows)
188-
if: startsWith(matrix.os, 'windows-')
189-
run: cmake --build build-Release --parallel
190-
shell: pwsh
191-
192-
- name: Stage install (Windows)
193-
if: startsWith(matrix.os, 'windows-')
194-
run: cmake --install build-Release --prefix build-Release/staging
195-
shell: pwsh
196-
197-
- name: Create Inno Setup installer (Windows)
198-
if: startsWith(matrix.os, 'windows-')
199-
run: iscc build-Release/setup.iss
200-
shell: pwsh
201-
202201
# Notarize
203202
- name: Notarize DMG with notarytool (macOS)
204203
if: startsWith(matrix.os, 'macos-')

‎src/CMakeLists.txt‎

Lines changed: 46 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -272,9 +272,32 @@ if(WIN32)
272272
install(FILES ${_rn_json_path} DESTINATION doc COMPONENT Application)
273273
endif()
274274
if(OPENSSL_ROOT)
275-
install(FILES ${OPENSSL_ROOT}/bin/openssl.exe DESTINATION bin COMPONENT Application)
276-
install(FILES ${OPENSSL_ROOT}/bin/libcrypto-3-x64.dll DESTINATION bin COMPONENT Application)
277-
install(FILES ${OPENSSL_ROOT}/bin/libssl-3-x64.dll DESTINATION bin COMPONENT Application)
275+
set(_openssl_exe "${OPENSSL_ROOT}/bin/openssl.exe")
276+
set(_openssl_crypto "${OPENSSL_ROOT}/bin/libcrypto-3-x64.dll")
277+
set(_openssl_ssl "${OPENSSL_ROOT}/bin/libssl-3-x64.dll")
278+
if(EXISTS "${_openssl_exe}" AND EXISTS "${_openssl_crypto}" AND EXISTS "${_openssl_ssl}")
279+
install(FILES "${_openssl_exe}" DESTINATION bin COMPONENT Application)
280+
install(FILES "${_openssl_crypto}" DESTINATION bin COMPONENT Application)
281+
install(FILES "${_openssl_ssl}" DESTINATION bin COMPONENT Application)
282+
else()
283+
message(WARNING "OPENSSL_ROOT is set to '${OPENSSL_ROOT}', but required OpenSSL runtime files were not found. Skipping bundling OpenSSL into the installer.")
284+
endif()
285+
endif()
286+
287+
# MinGW runtime DLLs
288+
if(MINGW)
289+
get_filename_component(_mingw_bin_dir "${CMAKE_CXX_COMPILER}" DIRECTORY)
290+
foreach(_dll IN ITEMS
291+
libgomp-1.dll
292+
libgcc_s_seh-1.dll
293+
libstdc++-6.dll
294+
libwinpthread-1.dll)
295+
if(EXISTS "${_mingw_bin_dir}/${_dll}")
296+
install(FILES "${_mingw_bin_dir}/${_dll}" DESTINATION bin COMPONENT Application)
297+
else()
298+
message(WARNING "MinGW runtime DLL not found, skipping: ${_mingw_bin_dir}/${_dll}")
299+
endif()
300+
endforeach()
278301
endif()
279302
elseif(APPLE)
280303
install(DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_TARGET_NAME}/${PROJECT_SHORT_REL_NAME}.app DESTINATION . USE_SOURCE_PERMISSIONS COMPONENT Application)
@@ -441,6 +464,26 @@ if(WIN32)
441464
${CMAKE_BINARY_DIR}/setup.iss
442465
@ONLY
443466
)
467+
468+
find_program(ISCC_EXECUTABLE
469+
NAMES iscc ISCC
470+
PATHS
471+
"$ENV{ProgramFiles\(x86\)}/Inno Setup 6"
472+
"$ENV{ProgramFiles}/Inno Setup 6"
473+
DOC "Inno Setup Compiler (iscc.exe)"
474+
)
475+
476+
if(ISCC_EXECUTABLE)
477+
configure_file(
478+
${CMAKE_SOURCE_DIR}/packaging/windows/run_iscc.cmake.in
479+
${CMAKE_BINARY_DIR}/run_iscc.cmake
480+
@ONLY
481+
)
482+
set(CPACK_POST_BUILD_SCRIPTS "${CMAKE_BINARY_DIR}/run_iscc.cmake")
483+
message(STATUS "Inno Setup found: ${ISCC_EXECUTABLE} — installer .exe will be created by the 'package' target")
484+
else()
485+
message(STATUS "Inno Setup (iscc.exe) not found; installer .exe will not be created. Install from https://jrsoftware.org/isinfo.php")
486+
endif()
444487
endif()
445488

446489
if(APPLE)

0 commit comments

Comments
 (0)