Skip to content

Commit

Permalink
github action #126
Browse files Browse the repository at this point in the history
  • Loading branch information
yousefvand committed Nov 27, 2024
1 parent 965057f commit 65f0cad
Showing 1 changed file with 34 additions and 13 deletions.
47 changes: 34 additions & 13 deletions .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,24 +57,23 @@ jobs:
choco install python3 -y
choco install llvm -y
choco install gperf -y
pip install html5lib
- name: Cache Qt Source (Windows)
if: matrix.os == 'windows-latest'
uses: actions/cache@v3
with:
path: D:\qt-source
path: D:/qt-source
key: qt-source-6.5.3
restore-keys: qt-source-

- name: Download Qt Source if Missing (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
$qtSourceDir = "D:\qt-source"
$qtZip = "$qtSourceDir\qt-everywhere-src-6.5.3.zip"
$qtSourceDir = "D:/qt-source"
$qtZip = "$qtSourceDir/qt-everywhere-src-6.5.3.zip"
if (-Not (Test-Path "$qtSourceDir\qt-everywhere-src-6.5.3\qtbase\configure.bat")) {
if (-Not (Test-Path "$qtSourceDir/qt-everywhere-src-6.5.3/qtbase/configure.bat")) {
Write-Host "Qt source not found in cache. Downloading..."
New-Item -ItemType Directory -Path $qtSourceDir -Force
Invoke-WebRequest -Uri "https://download.qt.io/official_releases/qt/6.5/6.5.3/single/qt-everywhere-src-6.5.3.zip" -OutFile $qtZip
Expand All @@ -83,6 +82,28 @@ jobs:
Write-Host "Qt source found in cache."
}
- name: Install bison Manually (Windows)
if: matrix.os == 'windows-latest'
shell: powershell
run: |
$bisonPath = "C:/ProgramData/chocolatey/bin/bison.exe"
if (-not (Test-Path $bisonPath)) {
Write-Host "bison is not available. Installing manually..."
$bisonUrl = "https://mirrors.kernel.org/gnu/bison/bison-3.8.2.tar.gz"
$bisonDir = "D:/bison"
$bisonTar = "$bisonDir/bison.tar.gz"
$bisonExtractDir = "$bisonDir/bison-3.8.2"
New-Item -ItemType Directory -Path $bisonDir -Force
# Download and extract bison
Invoke-WebRequest -Uri $bisonUrl -OutFile $bisonTar -UseBasicParsing
tar -xvf $bisonTar -C $bisonDir
$env:PATH += ";$bisonExtractDir/bin"
[System.Environment]::SetEnvironmentVariable("PATH", $env:PATH, [System.EnvironmentVariableTarget]::Process)
} else {
Write-Host "bison found at $bisonPath"
}
- name: Build and Install Qt from Source (Windows)
if: matrix.os == 'windows-latest'
shell: cmd
Expand All @@ -97,12 +118,12 @@ jobs:
CALL "%VS_VARS_CMD%" || exit /b 1
REM Build Qt from source
SET QT_SOURCE=D:\qt-source\qt-everywhere-src-6.5.3
IF NOT EXIST "%QT_SOURCE%\qtbase\configure.bat" (
echo "configure.bat not found in %QT_SOURCE%\qtbase" && exit /b 1
SET QT_SOURCE=D:/qt-source/qt-everywhere-src-6.5.3
IF NOT EXIST "%QT_SOURCE%/qtbase/configure.bat" (
echo "configure.bat not found in %QT_SOURCE%/qtbase" && exit /b 1
)
cd "%QT_SOURCE%\qtbase"
call configure.bat -top-level -prefix C:\Qt -release -opensource -confirm-license -nomake examples -nomake tests -platform win32-msvc -cmake-generator Ninja ^
cd "%QT_SOURCE%/qtbase"
call configure.bat -top-level -prefix C:/Qt -release -opensource -confirm-license -nomake examples -nomake tests -platform win32-msvc -cmake-generator Ninja ^
-DFEATURE_clang=ON ^
-DFEATURE_clangcpp=ON ^
-DLLVM_INSTALL_DIR="C:/Program Files/LLVM" ^
Expand All @@ -121,9 +142,9 @@ jobs:
if: matrix.os == 'windows-latest'
shell: powershell
run: |
echo "Qt6_DIR=C:\Qt\lib\cmake\Qt6" >> $env:GITHUB_ENV
echo "QT_PLUGIN_PATH=C:\Qt\plugins" >> $env:GITHUB_ENV
echo "QML2_IMPORT_PATH=C:\Qt\qml" >> $env:GITHUB_ENV
echo "Qt6_DIR=C:/Qt/lib/cmake/Qt6" >> $env:GITHUB_ENV
echo "QT_PLUGIN_PATH=C:/Qt/plugins" >> $env:GITHUB_ENV
echo "QML2_IMPORT_PATH=C:/Qt/qml" >> $env:GITHUB_ENV
- name: Configure CMake
run: |
Expand Down

0 comments on commit 65f0cad

Please sign in to comment.