Updated .gitlab-ci.yml (refactorized build:windows)

This commit is contained in:
Patrix
2024-03-02 23:50:39 +01:00
parent bcdce71694
commit feec0c8b49

View File

@@ -1,3 +1,6 @@
variables:
GIT_SUBMODULE_STRATEGY: recursive
stages: stages:
- build - build
- release - release
@@ -7,22 +10,36 @@ build:windows:
tags: tags:
- windows - windows
when: manual when: manual
before_script: |
function loadenv($bat_file)
{
$env_file = New-TemporaryFile
cmd /c " `"$bat_file`" $args && set > `"$env_file`" "
foreach($line in Get-Content "$env_file")
{
if($line -match "^(.*?)=(.*)$")
{
Set-Content "env:\$($matches[1])" $matches[2]
}
}
Remove-Item "$env_file"
}
script: script:
- choco install -y cmake --installargs '"ADD_CMAKE_TO_PATH=System"' - loadenv "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" ${PLATFORM}
- $env:Path += ";C:\Program Files\CMake\bin" - cmake . --preset Windows-${PLATFORM}-Release
- cmake . -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN.cmake" - cmake --build --preset Windows-${PLATFORM}-Release
- cmake --build . --config Release - cp out/build/Windows-${PLATFORM}-Release/${CI_PROJECT_NAME}.*.dll ./
- cp Release/$CI_PROJECT_NAME.*.dll ./
after_script: after_script:
- $env = "${TOOLCHAIN}_JOB_ID=$CI_JOB_ID" -replace "-", "_" - Add-Content -Path job.env -Value "windows_${PLATFORM}_JOB_ID=${CI_JOB_ID}"
- Add-Content -Path job.env -Value $env
parallel: parallel:
matrix: matrix:
- TOOLCHAIN: [windows-x86, windows-x64] - PLATFORM: [x86, x64]
artifacts: artifacts:
name: $CI_PROJECT_NAME name: ${CI_PROJECT_NAME}
paths: paths:
- $CI_PROJECT_NAME.*.dll - ${CI_PROJECT_NAME}.*.dll
expire_in: never expire_in: never
reports: reports:
dotenv: job.env dotenv: job.env