Skip to content

Commit 36850d1

Browse files
authored
Fix CMake version to match release notes format (#200)
1 parent 4bf02b8 commit 36850d1

File tree

10 files changed

+194
-5
lines changed

10 files changed

+194
-5
lines changed

.github/workflows/codeql.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- '*.md'
1515
- LICENSE
1616
- '.nuget/*'
17+
- build/*.ps1
1718
- build/*.yml
1819
schedule:
1920
- cron: '34 18 * * 6'

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- '*.md'
1515
- LICENSE
1616
- '.nuget/*'
17+
- build/*.ps1
1718
- build/*.yml
1819

1920
jobs:

.github/workflows/msvc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ on:
1414
- '*.md'
1515
- LICENSE
1616
- '.nuget/*'
17+
- build/*.ps1
1718
- build/*.yml
19+
1820
schedule:
1921
- cron: '34 20 * * 6'
2022

.github/workflows/test.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ on:
1414
- '*.md'
1515
- LICENSE
1616
- '.nuget/*'
17+
- build/*.ps1
1718
- build/*.yml
1819

1920
jobs:

.github/workflows/wsl.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Copyright (c) Microsoft Corporation.
2+
# Licensed under the MIT License.
3+
#
4+
# http://go.microsoft.com/fwlink/?LinkID=615560
5+
6+
name: 'CMake (WSL)'
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+
jobs:
21+
build:
22+
runs-on: ubuntu-latest
23+
24+
strategy:
25+
fail-fast: false
26+
27+
matrix:
28+
build_type: [x64-Debug-Linux, x64-Release-Linux]
29+
gcc: [10, 11, 12]
30+
# x64-Debug-NI-Linux, x64-Release-NI-Linux trigger issue with GCC
31+
32+
steps:
33+
- uses: actions/checkout@v4
34+
35+
- name: Clone test repository
36+
uses: actions/checkout@v4
37+
with:
38+
repository: walbourn/directxmathtest
39+
path: Tests
40+
ref: main
41+
42+
- uses: seanmiddleditch/gha-setup-ninja@v5
43+
44+
- name: 'Configure CMake'
45+
working-directory: ${{ github.workspace }}/Tests
46+
run: cmake --preset=${{ matrix.build_type }}
47+
env:
48+
CC: gcc-${{ matrix.gcc }}
49+
CXX: g++-${{ matrix.gcc }}
50+
51+
- name: 'Build'
52+
working-directory: ${{ github.workspace }}/Tests
53+
run: cmake --build out/build/${{ matrix.build_type }}

CMakeLists.txt

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
cmake_minimum_required (VERSION 3.20)
55

6-
set(DIRECTXMATH_VERSION 3.1.9)
6+
set(DIRECTXMATH_VERSION 3.19)
77

88
project(DirectXMath
99
VERSION ${DIRECTXMATH_VERSION}
@@ -110,8 +110,10 @@ elseif(NOT (DEFINED DXMATH_ARCHITECTURE))
110110
endif()
111111

112112
#--- Test suite
113-
include(CTest)
114-
if(BUILD_TESTING AND WIN32 AND (NOT WINDOWS_STORE) AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
115-
enable_testing()
116-
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests)
113+
if(NOT WINDOWS_STORE)
114+
include(CTest)
115+
if(BUILD_TESTING AND WIN32 AND (NOT WINDOWS_STORE) AND (EXISTS "${CMAKE_CURRENT_LIST_DIR}/Tests/CMakeLists.txt"))
116+
enable_testing()
117+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/Tests)
118+
endif()
117119
endif()

build/DirectXMath-GitHub-CMake.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ trigger:
2222
- LICENSE
2323
- '.github/*'
2424
- '.nuget/*'
25+
- build/*.ps1
2526

2627
pr:
2728
branches:

build/DirectXMath-GitHub-MinGW.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ trigger:
2222
- LICENSE
2323
- '.github/*'
2424
- '.nuget/*'
25+
- build/*.ps1
2526

2627
pr:
2728
branches:

build/DirectXMath-GitHub-WSL.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ trigger:
2222
- LICENSE
2323
- '.github/*'
2424
- '.nuget/*'
25+
- build/*.ps1
2526

2627
pr:
2728
branches:

build/preparerelease.ps1

Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
<#
2+
3+
.NOTES
4+
Copyright (c) Microsoft Corporation.
5+
Licensed under the MIT License.
6+
7+
.SYNOPSIS
8+
Prepares a PR for release
9+
10+
.DESCRIPTION
11+
This script is used to do the edits required for preparing a release PR.
12+
13+
.PARAMETER BaseBranch
14+
This the branch to use as the base of the release. Defaults to 'main'.
15+
16+
.PARAMETER TargetBranch
17+
This is the name of the newly created branch for the release PR. Defaults to '<DATETAG>release'. If set to 'none', then no branch is created.
18+
19+
.PARAMETER UpdateVersion
20+
This is a $true or $false value that indicates if the library version number should be incremented. Defaults to $true.
21+
22+
.LINK
23+
https://github.com/microsoft/DirectXMath/wiki
24+
25+
#>
26+
27+
param(
28+
[string]$BaseBranch = "main",
29+
[string]$TargetBranch = $null,
30+
[bool]$UpdateVersion = $true
31+
)
32+
33+
$reporoot = Split-Path -Path $PSScriptRoot -Parent
34+
$cmake = $reporoot + "\CMakeLists.txt"
35+
$header = $reporoot + "\Inc\DirectXMath.h"
36+
$readme = $reporoot + "\README.md"
37+
$history = $reporoot + "\CHANGELOG.md"
38+
39+
if ((-Not (Test-Path $cmake)) -Or (-Not (Test-Path $header)) -Or (-Not (Test-Path $readme)) -Or (-Not (Test-Path $history))) {
40+
Write-Error "ERROR: Unexpected location of script file!" -ErrorAction Stop
41+
}
42+
43+
$branch = git branch --show-current
44+
if ($branch -ne $BaseBranch) {
45+
Write-Error "ERROR: Must be in the $BaseBranch branch!" -ErrorAction Stop
46+
}
47+
48+
git pull -q
49+
if ($LastExitCode -ne 0) {
50+
Write-Error "ERROR: Failed to sync branch!" -ErrorAction Stop
51+
}
52+
53+
$version = Get-Content ($cmake) | Select-String -Pattern "set\(DIRECTXMATH_VERSION" -CaseSensitive
54+
if (-Not ($version -match "([0-9]?\.[0-9]+)")) {
55+
Write-Error "ERROR: Failed to current version!" -ErrorAction Stop
56+
}
57+
$version = $Matches.0
58+
$rawversion = $version.replace('.','')
59+
60+
$newreleasedate = Get-Date -Format "MMMM yyyy"
61+
$newreleasetag = (Get-Date -Format "MMMyyyy").ToLower()
62+
63+
if($UpdateVersion) {
64+
[string]$newrawversion = ([int]$rawversion + 1)
65+
}
66+
else {
67+
$newrawversion = $rawversion
68+
}
69+
70+
$newversion = $newrawversion[0] + "." + $newrawversion[1] + $newrawversion[2]
71+
72+
$rawreleasedate = $(Get-Content $readme) | Select-String -Pattern "\*\*[A-Z][a-z]+\S.?\S.\d\d\d\d\*\*"
73+
if ([string]::IsNullOrEmpty($rawreleasedate)) {
74+
Write-Error "ERROR: Failed to current release date!" -ErrorAction Stop
75+
}
76+
$releasedate = $rawreleasedate -replace '\*',''
77+
78+
if($releasedate -eq $newreleasedate) {
79+
Write-Error ("ERROR: Release "+$releasedate+" already exists!") -ErrorAction Stop
80+
}
81+
82+
if ($TargetBranch -ne 'none') {
83+
if ([string]::IsNullOrEmpty($TargetBranch)) {
84+
$TargetBranch = $newreleasetag + "release"
85+
}
86+
87+
git checkout -b $TargetBranch
88+
if ($LastExitCode -ne 0) {
89+
Write-Error "ERROR: Failed to create new topic branch!" -ErrorAction Stop
90+
}
91+
}
92+
93+
Write-Host " Old Version: " $version
94+
Write-Host "Old Release Date: " $releasedate
95+
Write-Host "->"
96+
Write-Host " Release Date: " $newreleasedate
97+
Write-Host " Release Tag: " $newreleasetag
98+
Write-Host " Release Version: " $newversion
99+
100+
if($UpdateVersion) {
101+
(Get-Content $cmake).Replace("set(DIRECTXMATH_VERSION $version)","set(DIRECTXMATH_VERSION $newversion)") | Set-Content $cmake
102+
(Get-Content $header).Replace("#define DIRECTX_MATH_VERSION $rawversion","#define DIRECTX_MATH_VERSION $newrawversion") | Set-Content $header
103+
}
104+
105+
(Get-Content $readme).Replace("$rawreleasedate", "**$newreleasedate**") | Set-Content $readme
106+
107+
Get-ChildItem -Path ($reporoot + "\.nuget") -Filter *.nuspec | Foreach-Object {
108+
(Get-Content -Path $_.Fullname).Replace("$releasedate", "$newreleasedate") | Set-Content -Path $_.Fullname -Encoding utf8
109+
}
110+
111+
[System.Collections.ArrayList]$file = Get-Content $history
112+
$inserthere = @()
113+
114+
for ($i=0; $i -lt $file.count; $i++) {
115+
if ($file[$i] -match "## Release History") {
116+
$inserthere += $i + 1
117+
}
118+
}
119+
120+
$file.insert($inserthere[0], "`n### $newreleasedate`n* change history here")
121+
Set-Content -Path $history -Value $file
122+
123+
code $history $readme
124+
if ($LastExitCode -ne 0) {
125+
Write-Error "ERROR: Failed to launch VS Code!" -ErrorAction Stop
126+
}

0 commit comments

Comments
 (0)