From 40f862135b933c2f5660055baa1c4c08bacedb2b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Mon, 24 Nov 2025 09:27:35 +0100 Subject: [PATCH] windows cmake test build (#1321) --- .github/workflows/build-pr.yml | 74 ++++++++++++++++++++++++++++++++++ README.md | 6 +++ 2 files changed, 80 insertions(+) diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index edb09855d..0497a81c5 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -82,6 +82,80 @@ jobs: Editor_Windows.exe + windows_cmake: + runs-on: windows-latest + name: windows (cmake) + env: + # needed on Windows because wiRenderer conditionally includes wiShaderDump.h + # and only our CMake config has a workaround for it + CCACHE_NODIRECT: 1 + steps: + - uses: actions/checkout@v4 + + - name: Restore Ccache database + id: restore-ccache + uses: actions/cache/restore@v4 + with: + path: C:\Users\runneradmin\AppData\Local\ccache + key: ccache-win-${{ github.run_id }} + restore-keys: ccache-win- + + - name: Install Ccache + run: | + curl -sOSL https://github.com/ccache/ccache/releases/download/v$Env:CCACHE_VERSION/ccache-$Env:CCACHE_VERSION-windows-x86_64.zip + unzip -qj ccache-$Env:CCACHE_VERSION-windows-x86_64.zip ccache-$Env:CCACHE_VERSION-windows-x86_64/ccache.exe + mv ccache.exe cl.exe + mv .github/workflows/Directory.Build.props.ghbuild Directory.Build.props + + - name: Initial compile + shell: cmd + run: | + cmake -B build -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache + cmake --build build --config Release --parallel + + - name: Generate shader dump + shell: cmd + run: | + mv build/WickedEngine/Release/offlineshadercompiler.exe build/WickedEngine + cd build/WickedEngine + offlineshadercompiler.exe hlsl6 spirv rebuild shaderdump strip_reflection + mv wiShaderDump.h ../../WickedEngine/ + + - name: Recompile with shader dump + shell: cmd + run: | + cmake -B build -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_C_COMPILER_LAUNCHER=ccache + cmake --build build --config Release --parallel + + - name: Save Ccache database + id: save-ccache + if: always() && steps.restore-ccache.cache-hit != 'true' + uses: actions/cache/save@v4 + with: + path: C:\Users\runneradmin\AppData\Local\ccache + key: ${{ steps.restore-ccache.outputs.cache-primary-key }} + + - name: Move files + shell: cmd + run: | + move build\Editor\Release\Editor.exe .\Editor_Windows.exe + move Editor\config.ini .\ + move Editor\startup.lua .\ + move Editor\languages .\ + move Editor\fonts .\ + + - name: Package Editor + uses: actions/upload-artifact@v4 + with: + name: Editor (Windows) [Cmake build] + path: | + languages/ + fonts/ + config.ini + startup.lua + Editor_Windows.exe + + linux: runs-on: ubuntu-latest name: linux (${{ matrix.cc }}) diff --git a/README.md b/README.md index e4eaabb12..159e3363e 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,12 @@ To build Wicked Engine for Windows 10 or newer, open the `WickedEngine.sln` solu If you want to develop a C++ application that uses Wicked Engine, you can build the WickedEngine_Windows static library project and link against it. Including the `"WickedEngine.h"` header will attempt to link the binaries for the appropriate platform, but search directories should be set up beforehand. For example, you can set additional library directories to `$(SolutionDir)BUILD\$(Platform)\$(Configuration)` by default. For examples, see the `Samples/Template_Windows`, `Samples/Tests`, and `Editor_Windows` projects. +You can also use cmake to build on windows with these commands: +``` +cmake -B build +cmake --build build --config Release +``` + #### Linux