Skip to content

Commit

Permalink
Improve Windows GitHub Actions
Browse files Browse the repository at this point in the history
1. Use sccache, because ccache isn't fully compatible with Windows yet.
   ccache/ccache#1023
2. Package Xbox One build correctly (all the `*.appx` files at archive
   root)
  • Loading branch information
glebm committed Jul 10, 2022
1 parent 3d08f95 commit c6edde7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 7 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/Windows_MSVC_x64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ jobs:

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: v1
variant: sccache

- name: Install latest CMake
uses: lukka/get-cmake@latest
Expand Down
14 changes: 11 additions & 3 deletions .github/workflows/xbox_one.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:

- name: ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
variant: sccache

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.1
Expand All @@ -30,12 +32,18 @@ jobs:
cd ${{ github.workspace }}\Packaging\xbox-one
build.bat
- name:
run: >
New-Item -Path build-uwp-project -Name pkg -ItemType Directory -Force &&
Copy-Item -Recurse
-Path uwp-project\AppxPackages, uwp-project\Release
-Include Microsoft.VCLibs.x64.*.appx, devilutionX_*_x64.appx
-Destination build-uwp-project\pkg\
- name: Upload-Package
if: ${{ !env.ACT }}
uses: actions/upload-artifact@v3
with:
name: devilutionx-xbox-one.zip
if-no-files-found: error
path: |
build/uwp-project/AppxPackages/**/Microsoft.VCLibs.x64.*.appx
build/uwp-project/Release/**/devilutionX_*_x64.appx
path: build/uwp-project/pkg/
2 changes: 2 additions & 0 deletions CMake/platforms/windows.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ list(APPEND DEVILUTIONX_PLATFORM_LINK_LIBRARIES
)

if(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /FS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /FS")
list(APPEND DEVILUTIONX_PLATFORM_COMPILE_OPTIONS "/W3" "/Zc:__cplusplus" "/utf-8")
list(APPEND DEVILUTIONX_PLATFORM_COMPILE_DEFINITIONS _CRT_SECURE_NO_WARNINGS)
else()
Expand Down
14 changes: 10 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,10 +186,16 @@ if(PIE)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
endif()

find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
find_program(SCCACHE_PROGRAM sccache)
if(SCCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
else()
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
endif()
endif()

if(DEVILUTIONX_DISABLE_RTTI)
Expand Down

0 comments on commit c6edde7

Please sign in to comment.