Skip to content

Commit

Permalink
build installer and tweaks
Browse files Browse the repository at this point in the history
* customized CMakeLists.txt to use the Qt installed in C:\Qt
* added deploy.bat to build the installer and the zip file
* added get_qt_path.ps1 to get the path to the Qt installation
  • Loading branch information
Acktarius committed Feb 9, 2025
1 parent 9b569c1 commit 7afe3ce
Show file tree
Hide file tree
Showing 6 changed files with 107 additions and 2 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,5 @@ CMakeLists.txt
*.pro.user
*.pro.user*
*.autosave
cmake-build*
qt_path.ini
cmake-build*
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_REVISION)

set(CRYPTONOTE_LIB cryptonote)
set(CMAKE_PREFIX_PATH "C:\\Qt-ack2\\5.15.2\\msvc2019_64\\lib\\cmake\\")
set(CMAKE_PREFIX_PATH "C:\\Qt\\5.15.2\\msvc2019_64\\lib\\cmake\\")

include_directories(${CMAKE_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
Expand Down
2 changes: 2 additions & 0 deletions installer/windows/.gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
bin/*.exe
bin/*.zip
bin/*.sha256
6 changes: 6 additions & 0 deletions installer/windows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,11 @@ Then follow these steps:
- Start Inno Setup, load `ConcealInstaller.iss` and compile it.
- When the compilation is finished, the installer will be in the `bin` directory.

### or use the deploy.bat script
from within installer/windows , run:
```
deploy.bat
```

## Credits
Special thanks to DomGries who created [InnoDependencyInstaller](https://github.com/DomGries/InnoDependencyInstaller) which is the base of the Conceal Desktop installer.
80 changes: 80 additions & 0 deletions installer/windows/deploy.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
@echo off
setlocal enabledelayedexpansion

echo Starting Conceal Desktop Windows Deployment

REM Get Qt path from CMakeLists.txt using PowerShell script
powershell -ExecutionPolicy Bypass -File get_qt_path.ps1 > qt_path.ini
if %ERRORLEVEL% NEQ 0 (
echo Failed to get Qt path, using default
set "QTDIR=C:\Qt\5.15.2\msvc2019_64"
) else (
for /f "tokens=2 delims==" %%a in ('type qt_path.ini ^| find "QtDir"') do set "QTDIR=%%a"
)

echo Using Qt from: %QTDIR%

REM Run windeployqt
echo Running windeployqt...
"%QTDIR%\bin\windeployqt.exe" --release --no-compiler-runtime "..\..\build\Release\conceal-desktop.exe"
if %ERRORLEVEL% NEQ 0 (
echo Failed to run windeployqt
exit /b 1
)

REM Copy OpenSSL DLLs
echo Copying OpenSSL DLLs...
REM OpenSSL v3
copy "%QTDIR%\..\..\Tools\OpenSSLv3\Win_x64\bin\libcrypto-3-x64.dll" "..\..\build\Release\"
copy "%QTDIR%\..\..\Tools\OpenSSLv3\Win_x64\bin\libssl-3-x64.dll" "..\..\build\Release\"
REM OpenSSL v1.1
copy "%QTDIR%\..\..\Tools\mingw1120_64\opt\bin\libcrypto-1_1-x64.dll" "..\..\build\Release\"
copy "%QTDIR%\..\..\Tools\mingw1120_64\opt\bin\libssl-1_1-x64.dll" "..\..\build\Release\"
if %ERRORLEVEL% NEQ 0 (
echo Error: Failed to copy OpenSSL DLLs
exit /b 1
)

REM Run Inno Setup Compiler
echo Creating installer...
"C:\Program Files (x86)\Inno Setup 6\ISCC.exe" /DQtPath="%QTDIR%" ConcealInstaller.iss
if %ERRORLEVEL% NEQ 0 (
echo Failed to create installer
exit /b 1
)

REM Rename the installer to remove spaces
cd bin
set "finalname="
for %%f in ("Conceal Desktop-*.exe") do (
set "oldname=%%f"
set "newname=!oldname: =!"
)

for %%f in ("Conceal*Desktop-*.exe") do (
set "name=%%f"
set "finalname=!name:.exe=!"
echo Debug: finalname value is: !finalname!

REM Wait for 3 seconds to ensure the file is released
timeout /t 3 /nobreak
echo Creating ZIP archive...
powershell -Command "Compress-Archive -Path '.\!finalname!.exe' -DestinationPath '.\!finalname!.zip' -Force"
)

if %ERRORLEVEL% NEQ 0 (
echo Failed to create ZIP archive
exit /b 1
)
echo Created ZIP archive: !finalname!.zip

REM Generate SHA256 hash for the zip file
certutil -hashfile "!finalname!.zip" SHA256 | findstr /v "hash" | findstr /v "CertUtil" > "!finalname!.zip.sha256"
if %ERRORLEVEL% NEQ 0 (
echo Failed to generate SHA256 for zip
exit /b 1
)
echo Generated SHA256 hash file: !finalname!.zip.sha256

echo Deployment completed successfully
echo Installer, ZIP archive and SHA256 hash can be found in the bin directory
16 changes: 16 additions & 0 deletions installer/windows/get_qt_path.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Read CMakeLists.txt
$content = Get-Content "../../CMakeLists.txt" -Raw

# Extract Qt path using regex
$pattern = 'set\(CMAKE_PREFIX_PATH\s+"([^"]+)"'
if ($content -match $pattern) {
$qtPath = $matches[1]
# Convert to proper path format and remove \lib\cmake\
$qtPath = $qtPath -replace '\\\\', '\' -replace '\\lib\\cmake\\$', ''

# Output in INI format
Write-Output "[Path]`nQtDir=$qtPath"
} else {
Write-Error "Qt path not found in CMakeLists.txt"
exit 1
}

0 comments on commit 7afe3ce

Please sign in to comment.