Skip to content

Commit

Permalink
Refactoring and try move to pwsh for clang
Browse files Browse the repository at this point in the history
  • Loading branch information
Stepanov Igor committed Dec 22, 2024
1 parent b458df4 commit d699764
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 42 deletions.
55 changes: 19 additions & 36 deletions .github/workflows/windows-clang.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,54 +21,37 @@ jobs:
- uses: actions/checkout@v2
with:
submodules: 'true'
- uses: msys2/setup-msys2@v2
id: msys2
name: Setup MSYS2
with:
msystem: clang64
install: >-
mingw-w64-clang-x86_64-toolchain
mingw-w64-clang-x86_64-cmake
mingw-w64-clang-x86_64-ninja
mingw-w64-clang-x86_64-luajit
git

- name: Get latest CMake and Ninja
uses: lukka/get-cmake@latest

- name: Bootstrap vcpkg
shell: msys2 {0}
shell: pwsh
run: |
git clone https://github.com/microsoft/vcpkg.git
./vcpkg/bootstrap-vcpkg.bat
./vcpkg/vcpkg integrate install
${{ github.workspace }}/vcpkg/bootstrap-vcpkg.bat
- name: Configure project with CMake and vcpkg
shell: msys2 {0}
shell: pwsh
env:
VCPKG_ROOT: ./vcpkg
VCPKG_DEFAULT_TRIPLET: x64-mingw-static
VCPKG_DEFAULT_HOST_TRIPLET: x64-mingw-static
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
run: |
cmake --preset default-ninja-clang-windows -DVCPKG_TARGET_TRIPLET=x64-mingw-static
cmake --preset default-ninja-clang-windows
cmake --build --preset default-ninja-clang-windows --config Release
- name: Run tests
run: ctest --preset default-vs-msvc-windows
- name: Run engine tests
run: |
build/vctest/Release/vctest.exe -e build/Release/VoxelEngine.exe -d dev/tests -u build --output-always
timeout-minutes: 1
- name: Package for Windows
run: |
mkdir packaged
mkdir packaged/res
cp build/Release/VoxelEngine.exe packaged/
cp build/vctest/Release/vctest.exe packaged/
cp build/*.dll packaged/
cp -r build/Release/res/* packaged/res/
mv packaged/VoxelEngine.exe packaged/VoxelCore.exe
- env:
MSYS2_LOCATION: ${{ steps.msys2.outputs.msys2-location }}
name: Add lua51.dll to the package
run: |
cp $env:MSYS2_LOCATION/clang64/bin/lua51.dll ${{ github.workspace }}/packaged/
cp -r build/* packaged/
cp C:/Windows/System32/msvcp140.dll packaged/Release/msvcp140.dll
mv packaged/Release/VoxelEngine.exe packaged/Release/VoxelCore.exe
working-directory: ${{ github.workspace }}
- uses: actions/upload-artifact@v4
with:
name: Windows-Build
path: 'packaged/*'
- name: Run engine tests
shell: msys2 {0}
working-directory: ${{ github.workspace }}
run: |
packaged/vctest.exe -e packaged/VoxelCore.exe -d dev/tests -u build --output-always
path: 'build/Release/*'
9 changes: 3 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,10 @@ set(LIBS "")

if (CMAKE_SYSTEM_NAME STREQUAL "Windows")
# Use directly linking to lib instead PkgConfig (because pkg-config dont install on windows as default)
# TODO: Do it with findLua
# TODO: Do it with findLua. I think, also we can use pwsh for build clang on agents instead MSYS2.
set(LUA_INCLUDE_DIR "$ENV{VCPKG_ROOT}/packages/luajit_${VCPKG_TARGET_TRIPLET}/include/luajit")
if (MSVC)
set(LUA_LIBRARIES "$ENV{VCPKG_ROOT}/packages/luajit_x64-windows/lib/lua51.lib")
else()
find_package(Lua REQUIRED)
endif()
find_package(Lua REQUIRED)

message(STATUS "LUA Libraries: ${LUA_LIBRARIES}")
message(STATUS "LUA Include Dir: ${LUA_INCLUDE_DIR}")
find_package(glfw3 REQUIRED)
Expand Down

0 comments on commit d699764

Please sign in to comment.