Skip to content

Commit 2d87c06

Browse files
authored
Add GitHub Actions to validate UWP via CMake (#551)
1 parent 79c65ff commit 2d87c06

File tree

6 files changed

+154
-29
lines changed

6 files changed

+154
-29
lines changed

.github/workflows/main.yml

+14-8
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ jobs:
4848
- os: windows-2022
4949
build_type: x86-Release
5050
arch: amd64_x86
51+
- os: windows-2022
52+
build_type: arm64-Debug
53+
arch: amd64_arm64
54+
- os: windows-2022
55+
build_type: arm64-Release
56+
arch: amd64_arm64
57+
- os: windows-2022
58+
build_type: arm64ec-Debug
59+
arch: amd64_arm64
60+
- os: windows-2022
61+
build_type: arm64ec-Release
62+
arch: amd64_arm64
5163
- os: windows-2022
5264
build_type: x64-Debug-Clang
5365
arch: amd64
@@ -61,16 +73,10 @@ jobs:
6173
build_type: x86-Release-Clang
6274
arch: amd64_x86
6375
- os: windows-2022
64-
build_type: arm64-Debug
65-
arch: amd64_arm64
66-
- os: windows-2022
67-
build_type: arm64-Release
76+
build_type: arm64-Debug-Clang
6877
arch: amd64_arm64
6978
- os: windows-2022
70-
build_type: arm64ec-Debug
71-
arch: amd64_arm64
72-
- os: windows-2022
73-
build_type: arm64ec-Release
79+
build_type: arm64-Release-Clang
7480
arch: amd64_arm64
7581

7682
steps:

.github/workflows/uwp.yml

+72
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkId=248926
5+
6+
name: 'CMake (UWP)'
7+
8+
on:
9+
push:
10+
branches: [ "main" ]
11+
pull_request:
12+
branches: [ "main" ]
13+
paths-ignore:
14+
- '*.md'
15+
- LICENSE
16+
- '.nuget/*'
17+
- build/*.cmd
18+
- build/*.json
19+
- build/*.props
20+
- build/*.ps1
21+
- build/*.targets
22+
- build/*.yml
23+
24+
permissions:
25+
contents: read
26+
27+
jobs:
28+
build:
29+
runs-on: windows-2022
30+
31+
strategy:
32+
fail-fast: false
33+
34+
matrix:
35+
build_type: [x64-Debug-UWP, x64-Release-UWP, x64-Debug-UWP-Clang, x64-Release-UWP-Clang]
36+
arch: [amd64]
37+
include:
38+
- build_type: x86-Debug-UWP
39+
arch: amd64_x86
40+
- build_type: x86-Release-UWP
41+
arch: amd64_x86
42+
- build_type: x86-Debug-UWP-Clang
43+
arch: amd64_x86
44+
- build_type: x86-Release-UWP-Clang
45+
arch: amd64_x86
46+
- build_type: arm64-Debug-UWP
47+
arch: amd64_arm64
48+
- build_type: arm64-Release-UWP
49+
arch: amd64_arm64
50+
- build_type: arm64-Debug-UWP-Clang
51+
arch: amd64_arm64
52+
- build_type: arm64-Release-UWP-Clang
53+
arch: amd64_arm64
54+
55+
steps:
56+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
57+
58+
- name: 'Install Ninja'
59+
run: choco install ninja
60+
61+
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
62+
with:
63+
arch: ${{ matrix.arch }}
64+
uwp: true
65+
66+
- name: 'Configure CMake'
67+
working-directory: ${{ github.workspace }}
68+
run: cmake --preset=${{ matrix.build_type }}
69+
70+
- name: 'Build'
71+
working-directory: ${{ github.workspace }}
72+
run: cmake --build out\build\${{ matrix.build_type }}

.github/workflows/vcpkg.yml

+17-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,15 @@ jobs:
3939
- os: windows-2022
4040
build_type: arm64-Debug-VCPKG
4141
arch: amd64_arm64
42+
- os: windows-2022
43+
build_type: arm64ec-Debug-VCPKG
44+
arch: amd64_arm64
45+
- os: windows-2022
46+
build_type: x64-Debug-MinGW
47+
arch: amd64
48+
- os: windows-2022
49+
build_type: x64-Release-MinGW
50+
arch: amd64
4251

4352
steps:
4453
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
@@ -55,7 +64,14 @@ jobs:
5564
run: |
5665
if ("${{ matrix.arch }}" -eq "amd64")
5766
{
58-
echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV
67+
if ("${{ matrix.build_type }}" -match "MinGW")
68+
{
69+
echo "VCPKG_DEFAULT_TRIPLET=x64-mingw-static" >> $env:GITHUB_ENV
70+
}
71+
else
72+
{
73+
echo "VCPKG_DEFAULT_TRIPLET=x64-windows" >> $env:GITHUB_ENV
74+
}
5975
}
6076
elseif ("${{ matrix.arch }}" -eq "amd64_x86")
6177
{

CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ endif()
7777
include(GNUInstallDirs)
7878
include(build/CompilerAndLinker.cmake)
7979

80+
if((DEFINED DIRECTX_ARCH) AND (${DIRECTX_ARCH} STREQUAL "arm64ec"))
81+
# OpenEXR doesn't support ARM64EC
82+
set(ENABLE_OPENEXR_SUPPORT OFF)
83+
endif()
84+
8085
#--- Library
8186
set(LIBRARY_HEADERS
8287
DirectXTex/DirectXTex.h

CMakePresets.json

+40-20
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,10 @@
4545
"strategy": "external"
4646
},
4747
"cacheVariables": { "DIRECTX_ARCH": "arm64ec" },
48+
"environment": {
49+
"CFLAGS": "/arm64EC",
50+
"CXXFLAGS": "/arm64EC"
51+
},
4852
"hidden": true
4953
},
5054

@@ -85,6 +89,22 @@
8589
"strategy": "external"
8690
}
8791
},
92+
{
93+
"name": "Clang-X86",
94+
"environment": {
95+
"CFLAGS": "-m32",
96+
"CXXFLAGS": "-m32"
97+
},
98+
"hidden": true
99+
},
100+
{
101+
"name": "Clang-AArch64",
102+
"environment": {
103+
"CFLAGS": "--target=arm64-pc-windows-msvc",
104+
"CXXFLAGS": "--target=arm64-pc-windows-msvc"
105+
},
106+
"hidden": true
107+
},
88108
{
89109
"name": "GNUC",
90110
"hidden": true,
@@ -194,7 +214,7 @@
194214
},
195215
"cacheVariables": {
196216
"VCPKG_TARGET_TRIPLET": "x86-mingw-static",
197-
"VCPKG_HOST_TRIPLET": "x86-mingw-static"
217+
"VCPKG_HOST_TRIPLET": "x64-windows"
198218
}
199219
},
200220
{
@@ -205,7 +225,7 @@
205225
},
206226
"cacheVariables": {
207227
"VCPKG_TARGET_TRIPLET": "x64-mingw-static",
208-
"VCPKG_HOST_TRIPLET": "x64-mingw-static"
228+
"VCPKG_HOST_TRIPLET": "x64-windows"
209229
}
210230
},
211231
{
@@ -264,8 +284,8 @@
264284
{ "name": "x86-Release" , "description": "MSVC for x86 (Release) with DX12", "inherits": [ "base", "x86", "Release", "MSVC" ] },
265285
{ "name": "arm64-Debug" , "description": "MSVC for ARM64 (Debug) with DX12", "inherits": [ "base", "ARM64", "Debug", "MSVC" ] },
266286
{ "name": "arm64-Release" , "description": "MSVC for ARM64 (Release) with DX12", "inherits": [ "base", "ARM64", "Release", "MSVC" ] },
267-
{ "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) with DX12", "inherits": [ "base", "ARM64EC", "Debug", "MSVC" ], "environment": { "CXXFLAGS": "/arm64EC" } },
268-
{ "name": "arm64ec-Release", "description": "MSVC for ARM64EC (Release) with DX12", "inherits": [ "base", "ARM64EC", "Release", "MSVC" ], "environment": { "CXXFLAGS": "/arm64EC" } },
287+
{ "name": "arm64ec-Debug" , "description": "MSVC for ARM64EC (Debug) with DX12", "inherits": [ "base", "ARM64EC", "Debug", "MSVC" ] },
288+
{ "name": "arm64ec-Release", "description": "MSVC for ARM64EC (Release) with DX12", "inherits": [ "base", "ARM64EC", "Release", "MSVC" ] },
269289

270290
{ "name": "x64-Debug-UWP" , "description": "MSVC for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "MSVC", "UWP" ] },
271291
{ "name": "x64-Release-UWP" , "description": "MSVC for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "MSVC", "UWP" ] },
@@ -294,8 +314,8 @@
294314
{ "name": "x86-Release-VCPKG" , "description": "MSVC for x86 (Release) using VCPKG", "inherits": [ "base", "x86", "Release", "MSVC", "VCPKG" ] },
295315
{ "name": "arm64-Debug-VCPKG" , "description": "MSVC for ARM64 (Debug) using VCPKG", "inherits": [ "base", "ARM64", "Debug", "MSVC", "VCPKG" ] },
296316
{ "name": "arm64-Release-VCPKG" , "description": "MSVC for ARM64 (Release) using VCPKG", "inherits": [ "base", "ARM64", "Release", "MSVC", "VCPKG" ] },
297-
{ "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) using VCPKG", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "VCPKG" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } },
298-
{ "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) using VCPKG", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "VCPKG" ], "environment": { "CXXFLAGS": "/arm64EC" }, "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } },
317+
{ "name": "arm64ec-Debug-VCPKG" , "description": "MSVC for ARM64EC (Debug) using VCPKG", "inherits": [ "base", "ARM64EC", "Debug", "MSVC", "VCPKG" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } },
318+
{ "name": "arm64ec-Release-VCPKG", "description": "MSVC for ARM64EC (Release) using VCPKG", "inherits": [ "base", "ARM64EC", "Release", "MSVC", "VCPKG" ], "cacheVariables": { "VCPKG_TARGET_TRIPLET": "arm64ec-windows" } },
299319

300320
{ "name": "x64-Debug-EXR" , "description": "MSVC for x64 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "x64", "Debug", "MSVC", "VCPKG", "EXR" ] },
301321
{ "name": "x64-Release-EXR" , "description": "MSVC for x64 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "x64", "Release", "MSVC", "VCPKG", "EXR" ] },
@@ -305,29 +325,29 @@
305325

306326
{ "name": "x64-Debug-Clang" , "description": "Clang/LLVM for x64 (Debug) with DX12", "inherits": [ "base", "x64", "Debug", "Clang" ] },
307327
{ "name": "x64-Release-Clang" , "description": "Clang/LLVM for x64 (Release) with DX12", "inherits": [ "base", "x64", "Release", "Clang" ] },
308-
{ "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) with DX12", "inherits": [ "base", "x86", "Debug", "Clang" ], "environment": { "CXXFLAGS": "-m32" } },
309-
{ "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) with DX12", "inherits": [ "base", "x86", "Release", "Clang" ], "environment": { "CXXFLAGS": "-m32" } },
310-
{ "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) with DX12", "inherits": [ "base", "ARM64", "Debug", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
311-
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) with DX12", "inherits": [ "base", "ARM64", "Release", "Clang" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
328+
{ "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) with DX12", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86" ] },
329+
{ "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) with DX12", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86" ] },
330+
{ "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) with DX12", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64" ] },
331+
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) with DX12", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64" ] },
312332

313333
{ "name": "x64-Debug-UWP-Clang" , "description": "Clang/LLVM for x64 (Debug) for UWP", "inherits": [ "base", "x64", "Debug", "Clang", "UWP" ] },
314334
{ "name": "x64-Release-UWP-Clang" , "description": "Clang/LLVM for x64 (Release) for UWP", "inherits": [ "base", "x64", "Release", "Clang", "UWP" ] },
315-
{ "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } },
316-
{ "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "-m32" } },
317-
{ "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
318-
{ "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "UWP" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
335+
{ "name": "x86-Debug-UWP-Clang" , "description": "Clang/LLVM for x86 (Debug) for UWP", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "UWP" ] },
336+
{ "name": "x86-Release-UWP-Clang" , "description": "Clang/LLVM for x86 (Release) for UWP", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "UWP" ] },
337+
{ "name": "arm64-Debug-UWP-Clang" , "description": "Clang/LLVM for AArch64 (Debug) for UWP", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64", "UWP" ] },
338+
{ "name": "arm64-Release-UWP-Clang", "description": "Clang/LLVM for AArch64 (Release) for UWP", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64", "UWP" ] },
319339

320340
{ "name": "x64-Debug-Win7-Clang" , "description": "Clang/LLVM for x64 (Debug) for Windows 7", "inherits": [ "base", "x64", "Debug", "Clang", "Win7" ] },
321341
{ "name": "x64-Release-Win7-Clang", "description": "Clang/LLVM for x64 (Release) for Windows 7", "inherits": [ "base", "x64", "Release", "Clang", "Win7" ] },
322-
{ "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
323-
{ "name": "x86-Release-Win7-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "Clang", "Win7" ], "environment": { "CXXFLAGS": "-m32" } },
342+
{ "name": "x86-Debug-Win7-Clang" , "description": "Clang/LLVM for x86 (Debug) for Windows 7", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "Win7" ] },
343+
{ "name": "x86-Release-Win7-Clang", "description": "Clang/LLVM for x86 (Release) for Windows 7", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "Win7" ] },
324344

325345
{ "name": "x64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "x64", "Debug", "Clang", "VCPKG" ] },
326346
{ "name": "x64-Release-Clang-VCPKG" , "description": "Clang/LLVM for x64 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "x64", "Release", "Clang", "VCPKG" ] },
327-
{ "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "x86", "Debug", "Clang", "VCPKG" ], "environment": { "CXXFLAGS": "-m32" } },
328-
{ "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "x86", "Release", "Clang", "VCPKG" ], "environment": { "CXXFLAGS": "-m32" } },
329-
{ "name": "arm64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for AArch64 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "ARM64", "Debug", "Clang", "VCPKG" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
330-
{ "name": "arm64-Release-Clang-VCPKG", "description": "Clang/LLVM for AArch64 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "ARM64", "Release", "Clang", "VCPKG" ], "environment": { "CXXFLAGS": "--target=arm64-pc-windows-msvc" } },
347+
{ "name": "x86-Debug-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86", "VCPKG" ] },
348+
{ "name": "x86-Release-Clang-VCPKG" , "description": "Clang/LLVM for x86 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86", "VCPKG" ] },
349+
{ "name": "arm64-Debug-Clang-VCPKG" , "description": "Clang/LLVM for AArch64 (Debug) using VCPKG/OpenEXR", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64", "VCPKG" ] },
350+
{ "name": "arm64-Release-Clang-VCPKG", "description": "Clang/LLVM for AArch64 (Release) using VCPKG/OpenEXR", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64", "VCPKG" ] },
331351

332352
{ "name": "x64-Debug-Clang-JPEG-PNG" , "description": "Clang/LLVM for x64 (Debug) with DX12", "inherits": [ "base", "x64", "Debug", "Clang", "VCPKG", "JPEG_PNG" ] },
333353
{ "name": "x64-Release-Clang-JPEG-PNG" , "description": "Clang/LLVM for x64 (Release) with DX12", "inherits": [ "base", "x64", "Release", "Clang", "VCPKG", "JPEG_PNG" ] },

build/CompilerAndLinker.cmake

+6
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$")
3030
set(DIRECTX_ARCH arm64)
3131
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64EC$")
3232
set(DIRECTX_ARCH arm64ec)
33+
elseif((NOT (DEFINED DIRECTX_ARCH)) AND (CMAKE_SYSTEM_NAME STREQUAL "Linux"))
34+
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
35+
set(DIRECTX_ARCH x64)
36+
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64")
37+
set(DIRECTX_ARCH arm64)
38+
endif()
3339
endif()
3440

3541
#--- Determines host architecture

0 commit comments

Comments
 (0)