Skip to content

Update CMakeLists.txt #633

Update CMakeLists.txt

Update CMakeLists.txt #633

Workflow file for this run

name: Windows Server 2025 build x86 MSVC and Clang
on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]
env:
ACTIONS_STEP_DEBUG: true
ACTIONS_RUNNER_DEBUG: true
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Debug
BUILD_DIR: build
BUILD_DIR_RELEASE: build_release
VULKAN_VERSION: 1.4.321.1
CLANG_VERSION: 21.1.1
VULKAN_SDK_PATH: C:\VulkanSDK
CLANG_PROFILE_PRESET: x64-ClangCL-Windows-Profile
jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally well on Windows or Mac.
# You can convert this to a matrix build if you need cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: windows-2025
# env:
# VULKAN_SDK: C:\VulkanSDK\
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
submodules: recursive
#################################################################################################################
######################################## Prepare deps ###########################################################
#################################################################################################################
- name: Install Windows Dependencies
shell: pwsh
run: |
./Scripts/Windows/setup-dependencies.ps1 `
-VulkanVersion ${{ env.VULKAN_VERSION }} `
-ClangVersion ${{ env.CLANG_VERSION }} `
-VulkanSdkPath '${{ env.VULKAN_SDK_PATH }}'
# - name: Add NSIS to PATH
# run: |
# echo "C:\Program Files (x86)\NSIS" >> $GITHUB_PATH
#################################################################################################################
####################### Run unit/integration/coverage/tests/static analyzers ####################################
#################################################################################################################
########################################## MSVC #################################################################
- name: CMake Build for MSVC
shell: powershell
run: |
cmake -B "${{github.workspace}}/${{ env.BUILD_DIR }}" --preset "x64-MSVC-Windows-Debug" -Dmyproject_ENABLE_CPPCHECK="OFF" -DWINDOWS_CI=ON
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR }}"
ctest
########################################## CLANG-CL #############################################################
# for now cppcehck is buggy on windows 2025 github runner. so disable
# a github runner has issues with running vulkan driver code; therefore just verify successful build :)
- name: Prepare for ClangCL Debug
run: |
Remove-Item -Path "${{github.workspace}}/${{ env.BUILD_DIR }}" -Recurse -Force
clang --version
- name: CMake Build for Clang
shell: powershell
run: |
cmake -B "${{github.workspace}}/${{ env.BUILD_DIR }}" --preset "x64-ClangCL-Windows-Debug" -Dmyproject_ENABLE_CPPCHECK="OFF" -DWINDOWS_CI=ON
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR }}" --preset "x64-ClangCL-Windows-Debug"
ctest
& "llvm-profdata.exe" merge -sparse "Test\compile\default.profraw" -o "${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata"
& "llvm-cov.exe" report "compileTestSuite.exe" -instr-profile="${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata"
& "llvm-cov.exe" export "compileTestSuite.exe" -format=text -instr-profile="${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata" | Out-File -FilePath "coverage.json" -Encoding UTF8
& "llvm-cov.exe" show "compileTestSuite.exe" -instr-profile="${{ github.workspace }}/${{ env.BUILD_DIR }}/compileTestSuite.profdata"
- name: Run clang-tidy
shell: pwsh
continue-on-error: true
run: |
$sourceFiles = Get-ChildItem -Path "Src" -Recurse -Include "*.cpp", "*.cc" | ForEach-Object { $_.FullName }
clang-tidy -p="./${{ env.BUILD_DIR }}/compile_commands.json" $sourceFiles
- name: Run Clang static analysis (HTML)
shell: pwsh
continue-on-error: true
run: |
# HTML output (correct flag form)
$sourceFiles = Get-ChildItem -Path "Src" -Recurse -Include "*.cpp", "*.cc" | ForEach-Object { $_.FullName }
clang++ --analyze -DUSE_RUST=1 -Xanalyzer -analyzer-output=html $sourceFiles
#
- name: Run Clang static analysis (scan-build)
shell: pwsh
continue-on-error: true
run: |
New-Item -ItemType Directory -Path "scan-build-reports" -Force
scan-build --use-analyzer="C:\Program Files\LLVM\bin\clang-cl.exe" -o scan-build-reports cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR }}" --preset x64-ClangCL-Windows-Debug
#################################################################################################################
############################# Now run on performance benchmarking/profiling #####################################
#################################################################################################################
- name: Prepare for Profiling
run: |
clang --version
shell: pwsh
- name: Configure/build CMake for Profiling (select preset by compiler)
shell: pwsh
# cppcheck has weird bug
run: |
$PRESET = $env:CLANG_PROFILE_PRESET
Write-Output "Using preset: $PRESET"
cmake -B "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset "$PRESET" -Dmyproject_ENABLE_CPPCHECK=OFF
cmake --build "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" --preset "$PRESET"
- name: Run performance benchmarks
working-directory: ${{ env.BUILD_DIR_RELEASE }}
run: .\perfTestSuite.exe
#################################################################################################################
################################### Now run release and build package for clang #################################
#################################################################################################################
- name: Prepare for Release
run: |
Remove-Item -Path "${{ github.workspace }}/${{ env.BUILD_DIR_RELEASE }}" -Recurse -Force
clang --version
shell: pwsh
- name: Configure CMake for Release (Clang only)
# -DCPACK_GENERATOR=ZIP; NSIS has problems on github windows runner
run: |
cmake -B "${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}" --preset "x64-ClangCL-Windows-Release" -Dmyproject_ENABLE_CPPCHECK="OFF" -DWINDOWS_CI=ON
- name: Build Release (Clang only)
shell: pwsh
run: |
$env:CMAKE_BUILD_PARALLEL_LEVEL = $env:NUMBER_OF_PROCESSORS
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}" --preset "x64-ClangCL-Windows-Release" -DWINDOWS_CI=ON
- name: Package (Clang only)
run: |
cmake --build "${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}" --target package --verbose
# I limited the size of the builded package for storage restriction reasons on a github runner
# see also the install commands in the bottom of the CMakeLists.txt
- name: Upload Installers & Zip
uses: actions/[email protected]
with:
name: windows-installers
path: |
"${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}"/*.msi
"${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}"/*.exe
"${{github.workspace}}/${{ env.BUILD_DIR_RELEASE }}"/*.zip