From ef57c4e4801844aeb603d95cfc60946a58e2bd3a Mon Sep 17 00:00:00 2001 From: Chuck Walbourn Date: Wed, 15 Nov 2023 15:42:41 -0800 Subject: [PATCH] Update ADO build pipelines (#115) --- DirectXMesh/DirectXMeshAdjacency.cpp | 4 ++-- DirectXMesh/DirectXMeshConcat.cpp | 8 ++++---- DirectXMesh/DirectXMeshOptimize.cpp | 6 +++--- DirectXMesh/DirectXMeshOptimizeTVC.cpp | 8 ++++---- DirectXMesh/DirectXMeshRemap.cpp | 2 +- DirectXMesh/DirectXMeshVBReader.cpp | 8 ++++---- DirectXMesh/DirectXMeshVBWriter.cpp | 8 ++++---- DirectXMesh/DirectXMeshWeldVertices.cpp | 2 +- Utilities/WaveFrontReader.h | 7 +++++++ build/DirectXMesh-GitHub-MinGW.yml | 6 +++--- build/DirectXMesh-GitHub-Test-Dev17.yml | 23 +++++++++++++++++++---- build/DirectXMesh-GitHub-Test.yml | 2 +- build/DirectXMesh-GitHub-WSL-11.yml | 4 ++-- build/DirectXMesh-GitHub-WSL.yml | 4 ++-- build/DirectXMesh-SDL.yml | 23 ++++++++++++----------- 15 files changed, 69 insertions(+), 46 deletions(-) diff --git a/DirectXMesh/DirectXMeshAdjacency.cpp b/DirectXMesh/DirectXMeshAdjacency.cpp index 9ab953d..56a6071 100644 --- a/DirectXMesh/DirectXMeshAdjacency.cpp +++ b/DirectXMesh/DirectXMeshAdjacency.cpp @@ -39,9 +39,9 @@ namespace _Out_writes_(nVerts) uint32_t *index, _In_reads_(nVerts) const XMFLOAT3* positions, size_t nVerts) noexcept { - for (uint32_t vert = 0; vert < nVerts; ++vert) + for (size_t vert = 0; vert < nVerts; ++vert) { - index[vert] = vert; + index[vert] = static_cast(vert); } if (nVerts > 1) diff --git a/DirectXMesh/DirectXMeshConcat.cpp b/DirectXMesh/DirectXMeshConcat.cpp index 55cc4a2..9b39ff8 100644 --- a/DirectXMesh/DirectXMeshConcat.cpp +++ b/DirectXMesh/DirectXMeshConcat.cpp @@ -42,15 +42,15 @@ HRESULT __cdecl DirectX::ConcatenateMesh( return E_FAIL; auto const baseFace = static_cast(totalFaces); - for (uint32_t j = 0; j < nFaces; ++j) + for (size_t j = 0; j < nFaces; ++j) { - faceDestMap[j] = baseFace + j; + faceDestMap[j] = baseFace + static_cast(j); } auto const baseVert = static_cast(totalVerts); - for (uint32_t j = 0; j < nVerts; ++j) + for (size_t j = 0; j < nVerts; ++j) { - vertexDestMap[j] = baseVert + j; + vertexDestMap[j] = baseVert + static_cast(j); } totalFaces = static_cast(newFaceCount); diff --git a/DirectXMesh/DirectXMeshOptimize.cpp b/DirectXMesh/DirectXMeshOptimize.cpp index fddbb2c..e64fdcf 100644 --- a/DirectXMesh/DirectXMeshOptimize.cpp +++ b/DirectXMesh/DirectXMeshOptimize.cpp @@ -108,9 +108,9 @@ HRESULT DirectX::AttributeSort( std::vector list; list.reserve(nFaces); - for (uint32_t j = 0; j < nFaces; ++j) + for (size_t j = 0; j < nFaces; ++j) { - list.emplace_back(intpair_t(attributes[j], j)); + list.emplace_back(intpair_t(attributes[j], static_cast(j))); } std::stable_sort(list.begin(), list.end(), [](const intpair_t& a, const intpair_t& b) noexcept -> bool @@ -119,7 +119,7 @@ HRESULT DirectX::AttributeSort( }); auto it = list.begin(); - for (uint32_t j = 0; j < nFaces; ++j, ++it) + for (size_t j = 0; j < nFaces; ++j, ++it) { attributes[j] = it->first; faceRemap[j] = it->second; diff --git a/DirectXMesh/DirectXMeshOptimizeTVC.cpp b/DirectXMesh/DirectXMeshOptimizeTVC.cpp index 02a7414..55c9856 100644 --- a/DirectXMesh/DirectXMeshOptimizeTVC.cpp +++ b/DirectXMesh/DirectXMeshOptimizeTVC.cpp @@ -570,12 +570,12 @@ namespace // inverse remap memset(faceRemap, 0xff, sizeof(uint32_t) * nFaces); - for (uint32_t j = 0; j < nFaces; ++j) + for (size_t j = 0; j < nFaces; ++j) { uint32_t f = faceRemapInverse[j]; if (f < nFaces) { - faceRemap[f] = j; + faceRemap[f] = static_cast(j); } } @@ -751,12 +751,12 @@ namespace // inverse remap memset(faceRemap, 0xff, sizeof(uint32_t) * nFaces); - for (uint32_t j = 0; j < nFaces; ++j) + for (size_t j = 0; j < nFaces; ++j) { uint32_t f = faceRemapInverse[j]; if (f < nFaces) { - faceRemap[f] = j; + faceRemap[f] = static_cast(j); } } diff --git a/DirectXMesh/DirectXMeshRemap.cpp b/DirectXMesh/DirectXMeshRemap.cpp index a369a29..b574eac 100644 --- a/DirectXMesh/DirectXMeshRemap.cpp +++ b/DirectXMesh/DirectXMeshRemap.cpp @@ -853,7 +853,7 @@ HRESULT DirectX::FinalizeVBAndPointReps( HRESULT hr = SwapVertices(vb, stride, nVerts, pointRep, vertexRemap); // clean up point reps for any removed vertices - for (uint32_t i = 0; i < nVerts; ++i) + for (size_t i = 0; i < nVerts; ++i) { if (vertexRemap[i] == UNUSED32) { diff --git a/DirectXMesh/DirectXMeshVBReader.cpp b/DirectXMesh/DirectXMeshVBReader.cpp index 9111791..3633a13 100644 --- a/DirectXMesh/DirectXMeshVBReader.cpp +++ b/DirectXMesh/DirectXMeshVBReader.cpp @@ -164,7 +164,7 @@ HRESULT VBReader::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl) ComputeInputLayout(reinterpret_cast(vbDecl), nDecl, offsets, mDefaultStrides); #endif - for (uint32_t j = 0; j < nDecl; ++j) + for (size_t j = 0; j < nDecl; ++j) { if (vbDecl[j].InputSlotClass == PER_INSTANCE_DATA) { @@ -177,18 +177,18 @@ HRESULT VBReader::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl) mInputDesc[j].AlignedByteOffset = offsets[j]; - auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, j); + auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, static_cast(j)); mSemantics.insert(decl); // Add common aliases if (_stricmp(vbDecl[j].SemanticName, "POSITION") == 0) { - auto decl2 = SemanticMap::value_type("SV_Position", j); + auto decl2 = SemanticMap::value_type("SV_Position", static_cast(j)); mSemantics.insert(decl2); } else if (_stricmp(vbDecl[j].SemanticName, "SV_Position") == 0) { - auto decl2 = SemanticMap::value_type("POSITION", j); + auto decl2 = SemanticMap::value_type("POSITION", static_cast(j)); mSemantics.insert(decl2); } } diff --git a/DirectXMesh/DirectXMeshVBWriter.cpp b/DirectXMesh/DirectXMeshVBWriter.cpp index 56b7aae..4a218f0 100644 --- a/DirectXMesh/DirectXMeshVBWriter.cpp +++ b/DirectXMesh/DirectXMeshVBWriter.cpp @@ -163,7 +163,7 @@ HRESULT VBWriter::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl) ComputeInputLayout(reinterpret_cast(vbDecl), nDecl, offsets, mDefaultStrides); #endif - for (uint32_t j = 0; j < nDecl; ++j) + for (size_t j = 0; j < nDecl; ++j) { if (vbDecl[j].InputSlotClass == PER_INSTANCE_DATA) { @@ -176,18 +176,18 @@ HRESULT VBWriter::Impl::Initialize(const InputElementDesc* vbDecl, size_t nDecl) mInputDesc[j].AlignedByteOffset = offsets[j]; - auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, j); + auto decl = SemanticMap::value_type(vbDecl[j].SemanticName, static_cast(j)); mSemantics.insert(decl); // Add common aliases if (_stricmp(vbDecl[j].SemanticName, "POSITION") == 0) { - auto decl2 = SemanticMap::value_type("SV_Position", j); + auto decl2 = SemanticMap::value_type("SV_Position", static_cast(j)); mSemantics.insert(decl2); } else if (_stricmp(vbDecl[j].SemanticName, "SV_Position") == 0) { - auto decl2 = SemanticMap::value_type("POSITION", j); + auto decl2 = SemanticMap::value_type("POSITION", static_cast(j)); mSemantics.insert(decl2); } } diff --git a/DirectXMesh/DirectXMeshWeldVertices.cpp b/DirectXMesh/DirectXMeshWeldVertices.cpp index 1e24579..a6480ed 100644 --- a/DirectXMesh/DirectXMeshWeldVertices.cpp +++ b/DirectXMesh/DirectXMeshWeldVertices.cpp @@ -114,7 +114,7 @@ namespace return S_FALSE; // Apply map to indices - for (uint32_t j = 0; j < nFaces * 3; ++j) + for (size_t j = 0; j < nFaces * 3; ++j) { index_t i = indices[j]; if (i == index_t(-1)) diff --git a/Utilities/WaveFrontReader.h b/Utilities/WaveFrontReader.h index 7f9bcc0..9db523f 100644 --- a/Utilities/WaveFrontReader.h +++ b/Utilities/WaveFrontReader.h @@ -26,6 +26,9 @@ #pragma warning(pop) #include +#ifdef __MINGW32__ +#include +#endif #else // !WIN32 #include #include @@ -103,6 +106,7 @@ public: for (;; ) { std::wstring strCommand; + InFile.width(MAX_PATH); InFile >> strCommand; if (!InFile) break; @@ -327,12 +331,14 @@ public: else if (0 == wcscmp(strCommand.c_str(), L"mtllib")) { // Material library + InFile.width(MAX_PATH); InFile >> strMaterialFilename; } else if (0 == wcscmp(strCommand.c_str(), L"usemtl")) { // Material wchar_t strName[MAX_PATH] = {}; + InFile.width(MAX_PATH); InFile >> strName; bool bFound = false; @@ -429,6 +435,7 @@ public: { // Switching active materials wchar_t strName[MAX_PATH] = {}; + InFile.width(MAX_PATH); InFile >> strName; curMaterial = materials.end(); diff --git a/build/DirectXMesh-GitHub-MinGW.yml b/build/DirectXMesh-GitHub-MinGW.yml index b801eea..ae5d409 100644 --- a/build/DirectXMesh-GitHub-MinGW.yml +++ b/build/DirectXMesh-GitHub-MinGW.yml @@ -62,7 +62,7 @@ jobs: # We can use the preinstalled vcpkg instead of the latest when MS Hosted updates their vcpkg to the newer DirectX-Headers displayName: Fetch VCPKG inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git workingDirectory: $(Build.SourcesDirectory) - task: CmdLine@2 displayName: VCPKG Bootstrap @@ -135,12 +135,12 @@ jobs: - task: CmdLine@2 displayName: Fetch VCPKG inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/vcpkg.git workingDirectory: $(Build.SourcesDirectory) - task: CmdLine@2 displayName: Fetch tests inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests - task: CmdLine@2 displayName: VCPKG Bootstrap inputs: diff --git a/build/DirectXMesh-GitHub-Test-Dev17.yml b/build/DirectXMesh-GitHub-Test-Dev17.yml index 088e0f4..f1eb1f7 100644 --- a/build/DirectXMesh-GitHub-Test-Dev17.yml +++ b/build/DirectXMesh-GitHub-Test-Dev17.yml @@ -32,7 +32,7 @@ variables: jobs: - job: DESKTOP_BUILD displayName: 'Win32 Desktop for x64/x86' - timeoutInMinutes: 120 + timeoutInMinutes: 60 cancelTimeoutInMinutes: 1 steps: - checkout: self @@ -48,7 +48,7 @@ jobs: - task: CmdLine@2 displayName: Fetch Tests inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests workingDirectory: $(Build.SourcesDirectory) failOnStderr: true - task: VSBuild@1 @@ -144,7 +144,7 @@ jobs: - job: CMAKE_BUILD displayName: 'CMake BUILD_TESTING=ON' - timeoutInMinutes: 120 + timeoutInMinutes: 60 steps: - checkout: self clean: true @@ -159,7 +159,7 @@ jobs: - task: CmdLine@2 displayName: Fetch Tests inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests workingDirectory: $(Build.SourcesDirectory) failOnStderr: true - task: ChocolateyCommand@0 @@ -194,6 +194,9 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out/build/x64-Debug -v + - task: DeleteFiles@1 + inputs: + Contents: 'out' - task: CMake@1 displayName: CMake (MSVC; x64-Release) Config inputs: @@ -204,6 +207,9 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out/build/x64-Release -v + - task: DeleteFiles@1 + inputs: + Contents: 'out' - task: CMake@1 displayName: CMake (clang/LLVM; x64-Debug) Config inputs: @@ -214,6 +220,9 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out/build/x64-Debug-Clang -v + - task: DeleteFiles@1 + inputs: + Contents: 'out' - task: CMake@1 displayName: CMake (clang/LLVM; x64-Release) Config inputs: @@ -224,6 +233,9 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out/build/x64-Release-Clang -v + - task: DeleteFiles@1 + inputs: + Contents: 'out' - task: CmdLine@2 displayName: Set LIB for ARM64 inputs: @@ -245,6 +257,9 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: --build out/build/arm64-Debug-Clang -v + - task: DeleteFiles@1 + inputs: + Contents: 'out' - task: CMake@1 displayName: CMake (clang/LLVM; arm64-Release) Config inputs: diff --git a/build/DirectXMesh-GitHub-Test.yml b/build/DirectXMesh-GitHub-Test.yml index 99b0105..6669102 100644 --- a/build/DirectXMesh-GitHub-Test.yml +++ b/build/DirectXMesh-GitHub-Test.yml @@ -67,7 +67,7 @@ jobs: - task: CmdLine@2 displayName: Fetch Tests inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/walbourn/directxmeshtest.git Tests workingDirectory: $(Build.SourcesDirectory) failOnStderr: true - task: VSBuild@1 diff --git a/build/DirectXMesh-GitHub-WSL-11.yml b/build/DirectXMesh-GitHub-WSL-11.yml index d32cb01..1c4ebbb 100644 --- a/build/DirectXMesh-GitHub-WSL-11.yml +++ b/build/DirectXMesh-GitHub-WSL-11.yml @@ -42,7 +42,7 @@ jobs: - task: CmdLine@2 displayName: Fetch directx-headers inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers - task: CMake@1 displayName: CMake DirectX-Headers inputs: @@ -61,7 +61,7 @@ jobs: - task: CmdLine@2 displayName: Fetch directxmath inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath - task: CMake@1 displayName: CMake DirectXMath inputs: diff --git a/build/DirectXMesh-GitHub-WSL.yml b/build/DirectXMesh-GitHub-WSL.yml index 21ffd55..3c6ab65 100644 --- a/build/DirectXMesh-GitHub-WSL.yml +++ b/build/DirectXMesh-GitHub-WSL.yml @@ -61,7 +61,7 @@ jobs: - task: CmdLine@2 displayName: Fetch directx-headers inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectX-Headers.git directx-headers - task: CMake@1 displayName: CMake DirectX-Headers inputs: @@ -80,7 +80,7 @@ jobs: - task: CmdLine@2 displayName: Fetch directxmath inputs: - script: git clone --quiet https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath + script: git clone --quiet --no-tags https://%GITHUB_PAT%@github.com/microsoft/DirectXMath.git directxmath - task: CMake@1 displayName: CMake DirectXMath inputs: diff --git a/build/DirectXMesh-SDL.yml b/build/DirectXMesh-SDL.yml index 630351b..c18eaf1 100644 --- a/build/DirectXMesh-SDL.yml +++ b/build/DirectXMesh-SDL.yml @@ -58,18 +58,19 @@ jobs: inputs: cwd: '$(Build.SourcesDirectory)' cmakeArgs: '-G "$(VS_GENERATOR)" -A x64 -B out -DENABLE_SPECTRE_MITIGATION=ON' - - task: Semmle@1 - displayName: 'Run CodeQL (Semmle) (C++)' - env: - SYSTEM_ACCESSTOKEN: $(System.AccessToken) + - task: CodeQL3000Init@0 inputs: - sourceCodeDirectory: '$(Build.SourcesDirectory)' - language: 'cpp' - querySuite: 'Recommended' - timeout: '1800' - ram: '16384' - addProjectDirToScanningExclusionList: true - buildCommandsString: '"%ProgramFiles%\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsMSBuildCmd.bat" && msbuild $(Build.SourcesDirectory)/out/DirectXMesh.sln /p:Configuration=Release' + Enabled: true + - task: VSBuild@1 + displayName: 'Build C++ with CodeQL' + inputs: + solution: '$(Build.SourcesDirectory)/out/DirectXMesh.sln' + vsVersion: 17.0 + platform: x64 + configuration: Release + msbuildArchitecture: x64 + - task: CodeQL3000Finalize@0 + condition: always() - task: CMake@1 displayName: 'CMake (MSVC): Build x64 Release' inputs: