Skip to content

Commit 602dde8

Browse files
authored
Upgrade to CMake 3.21 (#248)
1 parent 05783c6 commit 602dde8

File tree

6 files changed

+18
-24
lines changed

6 files changed

+18
-24
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) Microsoft Corporation.
22
# Licensed under the MIT License.
33

4-
cmake_minimum_required (VERSION 3.20)
4+
cmake_minimum_required (VERSION 3.21)
55

66
set(DIRECTXMESH_VERSION 1.6.9)
77

CMakePresets.json

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": 2,
2+
"version": 3,
33
"configurePresets": [
44
{
55
"name": "base",
@@ -8,7 +8,7 @@
88
"generator": "Ninja",
99
"hidden": true,
1010
"binaryDir": "${sourceDir}/out/build/${presetName}",
11-
"cacheVariables": { "CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}" }
11+
"installDir": "${sourceDir}/out/install/${presetName}"
1212
},
1313

1414
{
@@ -149,12 +149,7 @@
149149
},
150150
{
151151
"name": "VCPKG",
152-
"cacheVariables": {
153-
"CMAKE_TOOLCHAIN_FILE": {
154-
"value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
155-
"type": "FILEPATH"
156-
}
157-
},
152+
"toolchainFile": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
158153
"hidden": true
159154
},
160155
{

DirectXMesh/DirectXMeshClean.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ namespace
2424
_Inout_ std::vector<uint32_t>& dupVerts, bool breakBowties)
2525
{
2626
if (!adjacency && !attributes)
27-
return E_INVALIDARG;
27+
return E_POINTER;
2828

2929
if ((uint64_t(nFaces) * 3) >= UINT32_MAX)
3030
return HRESULT_E_ARITHMETIC_OVERFLOW;

DirectXMesh/DirectXMeshOptimizeTVC.cpp

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ namespace
3535
_In_reads_(nFaces * 3) const uint32_t* adjacency,
3636
const std::vector<std::pair<size_t, size_t>>& subsets)
3737
{
38-
if (!indices || !nFaces || !adjacency || subsets.empty())
39-
return E_INVALIDARG;
38+
if (!indices || !adjacency)
39+
return E_POINTER;
4040

4141
// Convert adjacency to 'physical' adjacency
4242
mPhysicalNeighbors.reset(new (std::nothrow) neighborInfo[nFaces]);
@@ -163,15 +163,12 @@ namespace
163163
_In_reads_(nFaces * 3) const index_t* indices, size_t nFaces,
164164
size_t faceOffset, size_t faceCount) noexcept
165165
{
166-
if (!faceCount || !indices || !nFaces)
167-
return E_INVALIDARG;
166+
if (!indices || !mListElements)
167+
return E_POINTER;
168168

169-
if (faceCount > mMaxSubset)
169+
if (!faceCount || faceCount > mMaxSubset)
170170
return E_UNEXPECTED;
171171

172-
if (!mListElements)
173-
return E_POINTER;
174-
175172
if ((uint64_t(faceOffset) + uint64_t(faceCount)) >= UINT32_MAX)
176173
return HRESULT_E_ARITHMETIC_OVERFLOW;
177174

@@ -457,7 +454,7 @@ namespace
457454
HRESULT initialize(uint32_t cacheSize) noexcept
458455
{
459456
if (!cacheSize)
460-
return E_INVALIDARG;
457+
return E_UNEXPECTED;
461458

462459
mFIFO.reset(new (std::nothrow) uint32_t[cacheSize]);
463460
if (!mFIFO)
@@ -514,8 +511,8 @@ namespace
514511
_Out_writes_(nFaces) uint32_t* faceRemap)
515512
{
516513
auto subsets = ComputeSubsets(attributes, nFaces);
517-
518-
assert(!subsets.empty());
514+
if (subsets.empty())
515+
return E_UNEXPECTED;
519516

520517
mesh_status<index_t> status;
521518
HRESULT hr = status.initialize(indices, nFaces, adjacency, subsets);
@@ -592,8 +589,8 @@ namespace
592589
uint32_t vertexCache, uint32_t restart)
593590
{
594591
auto subsets = ComputeSubsets(attributes, nFaces);
595-
596-
assert(!subsets.empty());
592+
if (subsets.empty())
593+
return E_UNEXPECTED;
597594

598595
mesh_status<index_t> status;
599596
HRESULT hr = status.initialize(indices, nFaces, adjacency, subsets);

DirectXMesh/DirectXMeshletGenerator.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,7 @@ namespace
249249
std::vector<InlineMeshlet<T>>& meshlets)
250250
{
251251
if (!indices || !positions || !adjacency)
252-
return E_INVALIDARG;
252+
return E_POINTER;
253253

254254
if (subset.first + subset.second > nFaces)
255255
return E_UNEXPECTED;

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ FOR SECURITY ADVISORIES, see [GitHub](https://github.com/microsoft/DirectXMesh/s
5454

5555
For a full change history, see [CHANGELOG.md](https://github.com/microsoft/DirectXMesh/blob/main/CHANGELOG.md).
5656

57+
* 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.
58+
5759
* Starting with the March 2025 release, Windows 7 and Windows 8.0 support has been retired.
5860

5961
* Starting with the June 2020 release, this library makes use of typed enum bitmask flags per the recommendation of the _C++ Standard_ section _17.5.2.1.3 Bitmask types_. This is consistent with Direct3D 12's use of the ``DEFINE_ENUM_FLAG_OPERATORS`` macro. This may have _breaking change_ impacts to client code:

0 commit comments

Comments
 (0)