Skip to content

Commit 722d234

Browse files
authored
Add build options to CMake for XDSP and SHMath (#240)
1 parent b09f268 commit 722d234

File tree

11 files changed

+521
-35
lines changed

11 files changed

+521
-35
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: approver_count
2+
description: Approver count policy for mscodehub/DirectXMath/DirectXMath repository
3+
resource: repository
4+
where:
5+
configuration:
6+
approverCountPolicySettings:
7+
isBlocking: true
8+
requireMinimumApproverCount: 1
9+
creatorVoteCounts: false
10+
allowDownvotes: false
11+
sourcePushOptions:
12+
resetOnSourcePush: false
13+
requireVoteOnLastIteration: true
14+
requireVoteOnEachIteration: false
15+
resetRejectionsOnSourcePush: false
16+
blockLastPusherVote: true
17+
branchNames:
18+
- refs/heads/release
19+
- refs/heads/main
20+
displayName: mscodehub/DirectXMath/DirectXMath Approver Count Policy

.github/workflows/main.yml

-6
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,9 @@ jobs:
3535
- os: windows-2019
3636
build_type: x86-Debug
3737
arch: amd64_x86
38-
- os: windows-2019
39-
build_type: x86-Release
40-
arch: amd64_x86
4138
- os: windows-2019
4239
build_type: x86-Debug-Clang
4340
arch: amd64_x86
44-
- os: windows-2019
45-
build_type: x86-Release-Clang
46-
arch: amd64_x86
4741
- os: windows-2022
4842
build_type: x86-Debug
4943
arch: amd64_x86

.github/workflows/shmath.yml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
5+
6+
name: 'CMake (SHMath)'
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/*.ps1
18+
- build/*.yml
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build:
25+
runs-on: ${{ matrix.os }}
26+
27+
strategy:
28+
fail-fast: false
29+
30+
matrix:
31+
os: [windows-2019, windows-2022]
32+
build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang]
33+
arch: [amd64]
34+
include:
35+
- os: windows-2019
36+
build_type: x86-Debug
37+
arch: amd64_x86
38+
- os: windows-2019
39+
build_type: x86-Debug-Clang
40+
arch: amd64_x86
41+
- os: windows-2022
42+
build_type: x86-Debug
43+
arch: amd64_x86
44+
- os: windows-2022
45+
build_type: x86-Release
46+
arch: amd64_x86
47+
- os: windows-2022
48+
build_type: arm64-Debug
49+
arch: amd64_arm64
50+
- os: windows-2022
51+
build_type: arm64-Release
52+
arch: amd64_arm64
53+
- os: windows-2022
54+
build_type: arm64ec-Debug
55+
arch: amd64_arm64
56+
- os: windows-2022
57+
build_type: arm64ec-Release
58+
arch: amd64_arm64
59+
- os: windows-2022
60+
build_type: x86-Debug-Clang
61+
arch: amd64_x86
62+
- os: windows-2022
63+
build_type: x86-Release-Clang
64+
arch: amd64_x86
65+
- os: windows-2022
66+
build_type: arm64-Debug-Clang
67+
arch: amd64_arm64
68+
- os: windows-2022
69+
build_type: arm64-Release-Clang
70+
arch: amd64_arm64
71+
72+
steps:
73+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
74+
75+
- name: Clone test repository
76+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
77+
with:
78+
repository: walbourn/directxmathtest
79+
path: Tests
80+
ref: main
81+
82+
- name: 'Install Ninja'
83+
run: choco install ninja
84+
85+
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
86+
with:
87+
arch: ${{ matrix.arch }}
88+
89+
- name: 'Configure CMake'
90+
working-directory: ${{ github.workspace }}
91+
run: cmake --preset=${{ matrix.build_type }} -DBUILD_SHMATH=ON -DBUILD_DX11=ON -DBUILD_DX12=ON
92+
93+
- name: 'Build'
94+
working-directory: ${{ github.workspace }}
95+
run: cmake --build out\build\${{ matrix.build_type }}

.github/workflows/xdsp.yml

+95
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
5+
6+
name: 'CMake (XDSP)'
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/*.ps1
18+
- build/*.yml
19+
20+
permissions:
21+
contents: read
22+
23+
jobs:
24+
build:
25+
runs-on: ${{ matrix.os }}
26+
27+
strategy:
28+
fail-fast: false
29+
30+
matrix:
31+
os: [windows-2019, windows-2022]
32+
build_type: [x64-Debug, x64-Release, x64-Debug-Clang, x64-Release-Clang]
33+
arch: [amd64]
34+
include:
35+
- os: windows-2019
36+
build_type: x86-Debug
37+
arch: amd64_x86
38+
- os: windows-2019
39+
build_type: x86-Debug-Clang
40+
arch: amd64_x86
41+
- os: windows-2022
42+
build_type: x86-Debug
43+
arch: amd64_x86
44+
- os: windows-2022
45+
build_type: x86-Release
46+
arch: amd64_x86
47+
- os: windows-2022
48+
build_type: arm64-Debug
49+
arch: amd64_arm64
50+
- os: windows-2022
51+
build_type: arm64-Release
52+
arch: amd64_arm64
53+
- os: windows-2022
54+
build_type: arm64ec-Debug
55+
arch: amd64_arm64
56+
- os: windows-2022
57+
build_type: arm64ec-Release
58+
arch: amd64_arm64
59+
- os: windows-2022
60+
build_type: x86-Debug-Clang
61+
arch: amd64_x86
62+
- os: windows-2022
63+
build_type: x86-Release-Clang
64+
arch: amd64_x86
65+
- os: windows-2022
66+
build_type: arm64-Debug-Clang
67+
arch: amd64_arm64
68+
- os: windows-2022
69+
build_type: arm64-Release-Clang
70+
arch: amd64_arm64
71+
72+
steps:
73+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
74+
75+
- name: Clone test repository
76+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
77+
with:
78+
repository: walbourn/directxmathtest
79+
path: Tests
80+
ref: main
81+
82+
- name: 'Install Ninja'
83+
run: choco install ninja
84+
85+
- uses: ilammy/msvc-dev-cmd@0b201ec74fa43914dc39ae48a89fd1d8cb592756 # v1.13.0
86+
with:
87+
arch: ${{ matrix.arch }}
88+
89+
- name: 'Configure CMake'
90+
working-directory: ${{ github.workspace }}
91+
run: cmake --preset=${{ matrix.build_type }} -DBUILD_XDSP=ON
92+
93+
- name: 'Build'
94+
working-directory: ${{ github.workspace }}
95+
run: cmake --build out\build\${{ matrix.build_type }}

CMakeLists.txt

+13-25
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ project(DirectXMath
1515
HOMEPAGE_URL "https://go.microsoft.com/fwlink/?LinkID=615560"
1616
LANGUAGES CXX)
1717

18+
option(BUILD_XDSP "Build XDSP math" OFF)
19+
20+
option(BUILD_SHMATH "Build Spherical Harmonics math" OFF)
21+
1822
include(GNUInstallDirs)
1923

2024
#--- Library
@@ -86,31 +90,15 @@ configure_file(
8690
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DirectXMath.pc"
8791
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
8892

89-
#--- Test suite
90-
if(DEFINED VCPKG_TARGET_ARCHITECTURE)
91-
set(DXMATH_ARCHITECTURE ${VCPKG_TARGET_ARCHITECTURE})
92-
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Ww][Ii][Nn]32$")
93-
set(DXMATH_ARCHITECTURE x86)
94-
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Xx]64$")
95-
set(DXMATH_ARCHITECTURE x64)
96-
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]$")
97-
set(DXMATH_ARCHITECTURE arm)
98-
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64$")
99-
set(DXMATH_ARCHITECTURE arm64)
100-
elseif(CMAKE_GENERATOR_PLATFORM MATCHES "^[Aa][Rr][Mm]64EC$")
101-
set(DXMATH_ARCHITECTURE arm64ec)
102-
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Ww][Ii][Nn]32$")
103-
set(DXMATH_ARCHITECTURE x86)
104-
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Xx]64$")
105-
set(DXMATH_ARCHITECTURE x64)
106-
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]$")
107-
set(DXMATH_ARCHITECTURE arm)
108-
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64$")
109-
set(DXMATH_ARCHITECTURE arm64)
110-
elseif(CMAKE_VS_PLATFORM_NAME_DEFAULT MATCHES "^[Aa][Rr][Mm]64EC$")
111-
set(DXMATH_ARCHITECTURE arm64ec)
112-
elseif(NOT (DEFINED DXMATH_ARCHITECTURE))
113-
set(DXMATH_ARCHITECTURE "x64")
93+
#--- Optional extension libraries
94+
if(BUILD_XDSP)
95+
message(STATUS "Including XDSP Digital Signal Processing (DSP)")
96+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/XDSP)
97+
endif()
98+
99+
if(BUILD_SHMATH)
100+
message(STATUS "Including C++ Spherical Harmonics Math")
101+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/SHMath)
114102
endif()
115103

116104
#--- Test suite

CMakePresets.json

+23-1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,20 @@
147147
"strategy": "external"
148148
}
149149
},
150+
{
151+
"name": "MinGW32",
152+
"hidden": true,
153+
"environment": {
154+
"PATH": "$penv{PATH};c:/mingw32/bin;c:/mingw32/libexec/gcc/i686-w64-mingw32/12.2.0"
155+
}
156+
},
157+
{
158+
"name": "MinGW64",
159+
"hidden": true,
160+
"environment": {
161+
"PATH": "$penv{PATH};c:/mingw64/bin;c:/mingw64/libexec/gcc/x86_64-w64-mingw32/12.2.0"
162+
}
163+
},
150164
{
151165
"name": "Intel",
152166
"hidden": true,
@@ -186,7 +200,15 @@
186200
{ "name": "x86-Debug-Clang" , "description": "Clang/LLVM for x86 (Debug) - SSE/SSE2", "inherits": [ "base", "x86", "Debug", "Clang", "Clang-X86" ] },
187201
{ "name": "x86-Release-Clang" , "description": "Clang/LLVM for x86 (Release) - SSE/SSE2", "inherits": [ "base", "x86", "Release", "Clang", "Clang-X86" ] },
188202
{ "name": "arm64-Debug-Clang" , "description": "Clang/LLVM for AArch64 (Debug) - ARM-NEON", "inherits": [ "base", "ARM64", "Debug", "Clang", "Clang-AArch64" ] },
189-
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) - ARM-NEON", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64" ] }
203+
{ "name": "arm64-Release-Clang", "description": "Clang/LLVM for AArch64 (Release) - ARM-NEON", "inherits": [ "base", "ARM64", "Release", "Clang", "Clang-AArch64" ] },
204+
205+
{ "name": "x64-Debug-MinGW" , "description": "MinG-W64 (Debug) - SSE/SSE2", "inherits": [ "base", "x64", "Debug", "GNUC", "MinGW64" ] },
206+
{ "name": "x64-Release-MinGW" , "description": "MinG-W64 (Release) - SSE/SSE2", "inherits": [ "base", "x64", "Release", "GNUC", "MinGW64" ] },
207+
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug) - SSE/SSE2", "inherits": [ "base", "x86", "Debug", "GNUC", "MinGW32" ] },
208+
{ "name": "x86-Release-MinGW" , "description": "MinG-W32 (Release) - SSE/SSE2", "inherits": [ "base", "x86", "Release", "GNUC", "MinGW32" ] },
209+
210+
{ "name": "x64-Debug-Linux" , "description": "WSL x64 (Debug) - SSE/SSE2", "inherits": [ "base", "x64", "Debug" ] },
211+
{ "name": "x64-Release-Linux" , "description": "WSL x64 (Release) - SSE/SSE2", "inherits": [ "base", "x64", "Release" ] }
190212
],
191213
"testPresets": [
192214
{ "name": "x64-Debug" , "configurePreset": "x64-Debug" },

0 commit comments

Comments
 (0)