1+ name : Build OpenModSim Installer (Windows x64, Qt6)
2+
3+ on :
4+ push :
5+ tags :
6+ - " *"
7+
8+ env :
9+ QT_VERSION : 6.9.3
10+ QT_ARCH : win64_msvc2022_64
11+ CMAKE_COMPILER : msvc2022_64
12+ CMAKE_GENERATOR : " Visual Studio 17 2022"
13+ CMAKE_ARCH : x64
14+ BUILD_TYPE : Release
15+
16+ jobs :
17+ build-omodsim :
18+ name : Build OpenModSim installer version ${{ github.ref_name }} with Qt6
19+ runs-on : windows-latest
20+
21+ steps :
22+ - name : Checkout repository
23+ uses : actions/checkout@v4
24+ with :
25+ ref : ${{ github.ref_name }}
26+
27+ - name : Extract version from CMakeLists.txt
28+ run : |
29+ for /f "tokens=2" %%i in ('findstr /R /C:"VERSION [0-9]*\.[0-9]*\.[0-9]*" omodsim\CMakeLists.txt') do echo APP_VERSION=%%i>>%GITHUB_ENV%
30+ shell : cmd
31+
32+ - name : Convert version for dev branch
33+ if : ${{ github.ref_name == 'dev' }}
34+ run : |
35+ for /f "tokens=1,2 delims=." %%a in ("%APP_VERSION%") do (
36+ echo APP_VERSION=%%a.%%b-dev>>%GITHUB_ENV%
37+ )
38+ shell : cmd
39+
40+ - name : Install Python (for aqtinstall)
41+ uses : actions/setup-python@v5
42+ with :
43+ python-version : " 3.11"
44+
45+ - name : Install aqtinstall
46+ run : |
47+ python -m pip install aqtinstall
48+
49+ - name : Install Qt
50+ run : |
51+ python -m aqt install-qt windows desktop ${{ env.QT_VERSION }} ${{ env.QT_ARCH }} -O C:\Qt -m qt5compat qtpdf qtserialport qtserialbus
52+ shell : cmd
53+
54+ - name : Set BUILD_DIR
55+ run : |
56+ echo BUILD_DIR=build-omodsim-Qt_${{ env.QT_VERSION }}_${{ env.CMAKE_COMPILER }}bit-${{ env.BUILD_TYPE }}>>%GITHUB_ENV%
57+ shell : cmd
58+
59+ - name : Configure CMake
60+ run : |
61+ cmake omodsim -B ${{ env.BUILD_DIR }} -G "${{ env.CMAKE_GENERATOR }}" -A ${{ env.CMAKE_ARCH }} -DCMAKE_PREFIX_PATH="C:/Qt/${{ env.QT_VERSION }}/${{ env.CMAKE_COMPILER }}"
62+ shell : cmd
63+
64+ - name : Build
65+ run : |
66+ cmake --build ${{ env.BUILD_DIR }} --config ${{ env.BUILD_TYPE }} --parallel
67+ shell : cmd
68+
69+ - name : Copy docs
70+ run : xcopy %CD%\${{ env.BUILD_DIR }}\docs %CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}\docs /E /I /Y
71+ shell : cmd
72+
73+ - name : Get Visual Studio path
74+ run : |
75+ for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ^
76+ -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do set VS_PATH=%%i
77+ echo VS_PATH=%VS_PATH%>>%GITHUB_ENV%
78+ shell : cmd
79+
80+ - name : Deploy Qt dependencies using windeployqt
81+ run : |
82+ call "${{ env.VS_PATH }}\VC\Auxiliary\Build\vcvars64.bat"
83+ "C:\Qt\${{ env.QT_VERSION }}\${{ env.CMAKE_COMPILER }}\bin\windeployqt.exe" ^
84+ "%CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}\omodsim.exe" ^
85+ --release ^
86+ --no-opengl-sw ^
87+ --plugindir "%CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}\plugins" ^
88+ --skip-plugin-types help,generic,networkinformation,qmltooling,tls ^
89+ --exclude-plugins qsqlibase,qsqlmimer,qsqloci,qsqlodbc,qsqlpsql
90+ shell : cmd
91+
92+ - name : Install NSIS
93+ run : |
94+ choco install nsis -y
95+ shell : cmd
96+
97+ - name : Build NSIS installer
98+ run : |
99+ "C:\Program Files (x86)\NSIS\makensis.exe" ^
100+ /DVERSION="${{ env.APP_VERSION }}" ^
101+ /DBUILD_PATH="%CD%\${{ env.BUILD_DIR }}\${{ env.BUILD_TYPE }}" ^
102+ /DICON_FILE="%CD%\omodsim\res\omodsim.ico" ^
103+ /DLICENSE_FILE="%CD%\omodsim\res\license.txt" ^
104+ /DOUTPUT_FILE="%CD%\qt6-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}.exe" ^
105+ %CD%\.nsis\installer-win64.nsi
106+ shell : cmd
107+
108+ - name : Upload Installer
109+ uses : actions/upload-artifact@v4
110+ if : success()
111+ with :
112+ name : qt6-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}
113+ path : qt6-omodsim-${{ env.APP_VERSION }}_${{ env.CMAKE_ARCH }}.exe
0 commit comments