Skip to content

Commit f4d4c9e

Browse files
authored
Add GitHub Action for MacOS (#325)
1 parent e934760 commit f4d4c9e

6 files changed

Lines changed: 81 additions & 8 deletions

File tree

.github/copilot-instructions.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ These instructions define how GitHub Copilot should assist with this project. Th
88
- **Project Name**: DirectXMath SIMD C++ linear algebra library
99
- **Language**: C++ (minimum C++11; C++14, C++17, and C++20 features used conditionally)
1010
- **Framework / Libraries**: STL / CMake / CTest
11-
- **Compiler Requirement**: Visual C++ 2017 or later (`_MSC_VER >= 1910`) when using MSVC
11+
- **Compiler Requirement**: Visual C++ 2019 (16.11), Visual Studio 2022, or Visual Studio 2026 or later when using MSVC.
1212

1313
## Getting Started
1414

@@ -27,7 +27,7 @@ These instructions define how GitHub Copilot should assist with this project. Th
2727
- **Testing**: Unit tests for this project are implemented in a separate repository [Test Suite](https://github.com/walbourn/directxmathtest/) and can be run using CTest per the instructions at [Test Documentation](https://github.com/walbourn/directxmathtest/wiki). See [test copilot instructions](https://github.com/walbourn/directxmathtest/blob/main/.github/copilot-instructions.md) for additional information on the tests.
2828
- **Security**: This project uses secure coding practices from the Microsoft Secure Coding Guidelines, and is subject to the `SECURITY.md` file in the root of the repository.
2929
- **Dependencies**: The project has minimal dependencies, primarily relying on compiler intrinsics. It is designed to be self-contained and portable across different platforms and toolsets.
30-
- **Continuous Integration**: This project has 18 GitHub Actions workflows covering MSVC, Clang/LLVM, GCC (WSL), ARM64, Address Sanitizer, CodeQL, and super-linter. Workflows are in `.github/workflows/` and include compiler-specific builds (`msvc.yml`, `clangcl.yml`, `cxx.yml`), platform-specific builds (`arm64.yml`, `wsl.yml`), extension tests (`shmath.yml`, `xdsp.yml`), and static analysis (`codeql.yml`, `lint.yml`, `asan.yml`). Azure DevOps pipeline configurations are in `.azuredevops/`.
30+
- **Continuous Integration**: This project has 20 GitHub Actions workflows covering MSVC, Clang/LLVM, GCC (WSL), ARM64, macOS, Address Sanitizer, CodeQL, and super-linter. Workflows are in `.github/workflows/` and include compiler-specific builds (`msvc.yml`, `clangcl.yml`, `cxx.yml`), platform-specific builds (`arm64.yml`, `arm64test.yml`, `macos.yml`, `wsl.yml`, `wslcxx.yml`), extension tests (`shmath.yml`, `shmathclang.yml`, `xdsp.yml`, `xdspclang.yml`), and static analysis (`codeql.yml`, `lint.yml`, `asan.yml`). Additional workflows include `main.yml`, `msbuild.yml`, `msbuildex.yml`, and `test.yml`. Azure DevOps pipeline configurations are in `.azuredevops/`.
3131
- **Code of Conduct**: The project adheres to the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/). All contributors are expected to follow this code of conduct in all interactions related to the project.
3232

3333
## File Structure
@@ -494,6 +494,8 @@ Use these established guards — do not invent new ones:
494494
| `_M_ARM64EC` | ARM64EC ABI (ARM64 code with x64 interop using ARM-NEON) for MSVC |
495495
| `__aarch64__` / `__x86_64__` / `__i386__` / `__powerpc64__` | Additional architecture-specific symbols for MinGW/GNUC (`#if`) |
496496
| `_M_ARM` / `__arm__` | This is the legacy 32-bit Windows on ARM which is deprecated. |
497+
| `__linux__` | This is used in some tests to check for Linux platform. |
498+
| `__APPLE__` | This is used in some tests to check for Apple platform. |
497499

498500
> GNU predefined architecture macros (`__aarch64__`, `__x86_64__`, `__i386__`, `__powerpc64__`, `__arm__`) are always defined to `1` by the compiler — they are **not** merely defined/undefined like MSVC's `_M_ARM64`. Use them **bare** (without `defined()`) in `#if` expressions: `#if __aarch64__`, not `#if defined(__aarch64__)`. Using `defined()` is technically valid but inconsistent with the project's convention and suppresses `-Wundef` unnecessarily.
499501

.github/workflows/macos.yml

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
5+
6+
name: 'CMake (MacOS)'
7+
8+
on:
9+
push:
10+
branches: "main"
11+
paths-ignore:
12+
- '*.md'
13+
- LICENSE
14+
- '.azuredevops/**'
15+
- '.github/*.md'
16+
- '.nuget/*'
17+
- build/*.ps1
18+
pull_request:
19+
branches: "main"
20+
paths-ignore:
21+
- '*.md'
22+
- LICENSE
23+
- '.azuredevops/**'
24+
- '.github/*.md'
25+
- '.nuget/*'
26+
- build/*.ps1
27+
28+
permissions:
29+
contents: read
30+
31+
jobs:
32+
build:
33+
runs-on: macos-latest
34+
35+
strategy:
36+
fail-fast: false
37+
38+
matrix:
39+
build_type: [arm64-Debug-Linux, arm64-Release-Linux]
40+
41+
steps:
42+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
43+
44+
- name: Clone test repository
45+
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
46+
with:
47+
repository: walbourn/directxmathtest
48+
path: Tests
49+
ref: main
50+
51+
- name: 'Configure CMake'
52+
working-directory: ${{ github.workspace }}
53+
run: cmake --preset=${{ matrix.build_type }}
54+
55+
- name: 'Build'
56+
working-directory: ${{ github.workspace }}
57+
run: cmake --build out/build/${{ matrix.build_type }}

.github/workflows/mingw.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,16 @@ permissions:
3030

3131
jobs:
3232
build:
33-
runs-on: windows-2022
3433
timeout-minutes: 20
3534

3635
strategy:
3736
fail-fast: false
3837

3938
matrix:
4039
build_type: [x64-Debug-MinGW, x64-Release-MinGW]
40+
os: [windows-2022, windows-2025]
41+
42+
runs-on: ${{ matrix.os }}
4143

4244
steps:
4345
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0

CMakePresets.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,8 +231,10 @@
231231
{ "name": "x86-Debug-MinGW" , "description": "MinG-W32 (Debug) - SSE/SSE2", "inherits": [ "base", "x86", "Debug", "GNUC", "MinGW32" ] },
232232
{ "name": "x86-Release-MinGW" , "description": "MinG-W32 (Release) - SSE/SSE2", "inherits": [ "base", "x86", "Release", "GNUC", "MinGW32" ] },
233233

234-
{ "name": "x64-Debug-Linux" , "description": "WSL x64 (Debug) - SSE/SSE2", "inherits": [ "base", "x64", "Debug" ] },
235-
{ "name": "x64-Release-Linux" , "description": "WSL x64 (Release) - SSE/SSE2", "inherits": [ "base", "x64", "Release" ] }
234+
{ "name": "x64-Debug-Linux", "description": "WSL Linux x64 (Debug)", "inherits": [ "base", "x64", "Debug" ] },
235+
{ "name": "x64-Release-Linux", "description": "WSL Linux x64 (Release)", "inherits": [ "base", "x64", "Release" ] },
236+
{ "name": "arm64-Debug-Linux", "description": "WSL Linux AArch64 (Debug)", "inherits": [ "base", "ARM64", "Debug" ] },
237+
{ "name": "arm64-Release-Linux", "description": "WSL Linux AArch64 (Release)", "inherits": [ "base", "ARM64", "Release" ] }
236238
],
237239

238240
"testPresets": [
@@ -250,6 +252,11 @@
250252
{ "name": "x86-Debug-Clang" , "configurePreset": "x86-Debug-Clang" },
251253
{ "name": "x86-Release-Clang" , "configurePreset": "x86-Release-Clang" },
252254
{ "name": "arm64-Debug-Clang" , "configurePreset": "arm64-Debug-Clang" },
253-
{ "name": "arm64-Release-Clang", "configurePreset": "arm64-Release-Clang" }
255+
{ "name": "arm64-Release-Clang", "configurePreset": "arm64-Release-Clang" },
256+
257+
{ "name": "x64-Debug-Linux", "configurePreset": "x64-Debug-Linux" },
258+
{ "name": "x64-Release-Linux", "configurePreset": "x64-Release-Linux" },
259+
{ "name": "arm64-Debug-Linux", "configurePreset": "arm64-Debug-Linux" },
260+
{ "name": "arm64-Release-Linux", "configurePreset": "arm64-Release-Linux" }
254261
]
255262
}

Inc/DirectXMath.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@
155155

156156
#include "sal.h"
157157
#include <assert.h>
158+
#include <stddef.h>
158159

159160
#ifdef _MSC_VER
160161
#pragma warning(push)

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ copilot
7575

7676
## Compiler support
7777

78-
Officially the library is supported with Microsoft Visual C++ 2019 (16.11) or later, clang/LLVM v12 or later, and GCC 10 or later. It should also compile with the Intel C++ and MinGW compilers.
78+
Officially the library is supported with Microsoft Visual C++ 2019 (16.11) or later, clang/LLVM v12 or later, and GCC 10 or later. It should also compile with the Intel C++, MinGW, and Apple Clang compilers.
7979

8080
When building with clang/LLVM or other GNU C compilers, the ``_XM_NO_XMVECTOR_OVERLOADS_`` control define is set because these compilers do not support creating operator overloads for the ``XMVECTOR`` type. You can choose to enable this preprocessor define explicitly to do the same thing with Visual C++ for improved portability.
8181

@@ -105,6 +105,8 @@ FOR SECURITY ADVISORIES, see [GitHub](https://github.com/microsoft/DirectXMath/s
105105

106106
For a full change history, see [CHANGELOG.md](https://github.com/microsoft/DirectXMath/blob/main/CHANGELOG.md).
107107

108+
* The *directxmath* NuGet package is deprecated. The best way to integrate the latest DirectXMath into your C++ project is using [vcpkg](https://github.com/microsoft/vcpkg/tree/master/ports/directxmath).
109+
108110
* The CMake projects require 3.21 or later. VS 2019 users will need to install a standalone version of CMake 3.21 or later and add it to their PATH.
109111

110112
* The clang/LLVM toolset currently does not respect the ``float_control`` pragma for SSE instrinsics. Therefore, the use of ``/fp:fast`` is not recommended on clang/LLVM until this issue is fixed. See [55713](https://github.com/llvm/llvm-project/issues/55713).
@@ -145,6 +147,8 @@ Thanks to Dave Eberly for his contributions particularly in improving the transc
145147

146148
Thanks to Bruce Dawson for his help with the rounding functions.
147149

148-
Thanks to Andrew Farrier for the fixes to ``XMVerifyCPUSupport`` to properly support clang.
150+
Thanks to Andrew Farrier and Ruiji-Shi for the fixes to ``XMVerifyCPUSupport`` to properly support clang.
149151

150152
Thanks to Scott Matloff for his help in getting the library updated to use Intel SVML for VS 2019.
153+
154+
Thanks to Shawn Hargreaves and Nada Ouf for their continued support for this library.

0 commit comments

Comments
 (0)