From 756b9b0d22e5d00062c07757d0db48ab1fe42485 Mon Sep 17 00:00:00 2001 From: Sergio Ricardo Zerbetto Masson Date: Tue, 14 Jul 2026 15:59:16 -0300 Subject: [PATCH] Update Windows CI and samples to Visual Studio 2026 The CI Windows runners no longer provide Visual Studio 2022, so the "Visual Studio 17 2022" CMake generator fails to configure. Move the Windows build to Visual Studio 2026: - windows.yml: use the "Visual Studio 18 2026" generator (requires CMake >= 4.2) and bump jwlawson/actions-setup-cmake to v2.2.0. - ci.yml: pin the Windows CMake version to 4.2.7. - Set CMAKE_POLICY_VERSION_MINIMUM=3.5 for the Windows job: CMake 4.x removed compatibility with cmake_minimum_required(VERSION < 3.5), and the vendored RapidJSON source (downloaded at configure time) still declares an older minimum. Also bump the RapidJSON and googletest download drivers' own minimums to 3.5. - Port the samples to std::filesystem: the VS 2026 MSVC toolset removed , which the samples used. Build the samples as C++17 and use the standard header. The GLTFSDK library itself still targets C++14. Validated locally with VS 2026 + CMake 4.2.7 for x64 and Win32 (RelWithDebInfo and Debug); all 389 unit tests pass. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 039828de-4db2-48f8-a5de-c9f7d33baffa --- .github/workflows/ci.yml | 2 +- .github/workflows/windows.yml | 9 +++++++-- .../RapidJSON/CMakeRapidJSONDownload.txt.in | 2 +- .../googletest/CMakeGoogleTestDownload.txt.in | 2 +- GLTFSDK.Samples/CMakeLists.txt | 7 +++++++ GLTFSDK.Samples/Deserialize/Source/main.cpp | 20 +++++++++---------- GLTFSDK.Samples/Serialize/Source/main.cpp | 20 +++++++++---------- 7 files changed, 35 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e7a40be..257bb81 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,7 +10,7 @@ jobs: build-windows: uses: ./.github/workflows/windows.yml with: - cmake-version: '3.31.0' + cmake-version: '4.2.7' platforms: "['x64', 'Win32', 'ARM64']" configurations: "['RelWithDebInfo', 'Debug']" # MacOS diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 7f45fef..17df12d 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -16,6 +16,11 @@ on: jobs: build: runs-on: windows-latest + env: + # CMake 4.x removed compatibility with cmake_minimum_required(VERSION < 3.5). + # The vendored RapidJSON source (downloaded at configure time) still declares an + # older minimum, so clamp the policy version for its nested/child configures. + CMAKE_POLICY_VERSION_MINIMUM: "3.5" strategy: matrix: platform: ${{ fromJson(inputs.platforms) }} @@ -26,11 +31,11 @@ jobs: with: submodules: 'true' - name: Setup CMake - uses: jwlawson/actions-setup-cmake@v2.0.2 + uses: jwlawson/actions-setup-cmake@v2.2.0 with: cmake-version: ${{ inputs.cmake-version }} - name: CMake Configure - run: cmake -G "Visual Studio 17 2022" -A ${{ matrix.platform }} -B ./Built/Int/cmake_${{ matrix.platform }} . + run: cmake -G "Visual Studio 18 2026" -A ${{ matrix.platform }} -B ./Built/Int/cmake_${{ matrix.platform }} . - name: CMake Build run: cmake --build . --target install --config ${{ matrix.config }} working-directory: ./Built/Int/cmake_${{ matrix.platform }} diff --git a/External/RapidJSON/CMakeRapidJSONDownload.txt.in b/External/RapidJSON/CMakeRapidJSONDownload.txt.in index ed9135e..9e3be43 100644 --- a/External/RapidJSON/CMakeRapidJSONDownload.txt.in +++ b/External/RapidJSON/CMakeRapidJSONDownload.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.2) +cmake_minimum_required(VERSION 3.5) project(RapidJSON-download NONE) diff --git a/External/googletest/CMakeGoogleTestDownload.txt.in b/External/googletest/CMakeGoogleTestDownload.txt.in index c55d79e..a8cb131 100644 --- a/External/googletest/CMakeGoogleTestDownload.txt.in +++ b/External/googletest/CMakeGoogleTestDownload.txt.in @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 2.8.2) +cmake_minimum_required(VERSION 3.5) project(googletest-download NONE) diff --git a/GLTFSDK.Samples/CMakeLists.txt b/GLTFSDK.Samples/CMakeLists.txt index a66ed93..1657a9d 100644 --- a/GLTFSDK.Samples/CMakeLists.txt +++ b/GLTFSDK.Samples/CMakeLists.txt @@ -1,4 +1,11 @@ cmake_minimum_required(VERSION 3.5) +# Visual Studio 2026 (MSVC 14.5x) removed the header that +# these samples previously used. Build the samples as C++17 so they use the standard +# header instead (see each sample's Source/main.cpp). The GLTFSDK library +# itself continues to target C++14. +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + add_subdirectory(Deserialize) add_subdirectory(Serialize) diff --git a/GLTFSDK.Samples/Deserialize/Source/main.cpp b/GLTFSDK.Samples/Deserialize/Source/main.cpp index 80198fa..e22d5d4 100644 --- a/GLTFSDK.Samples/Deserialize/Source/main.cpp +++ b/GLTFSDK.Samples/Deserialize/Source/main.cpp @@ -6,9 +6,7 @@ #include #include -// Replace this with (and use std::filesystem rather than -// std::experimental::filesystem) if your toolchain fully supports C++17 -#include +#include #include #include @@ -28,7 +26,7 @@ namespace class StreamReader : public IStreamReader { public: - StreamReader(std::experimental::filesystem::path pathBase) : m_pathBase(std::move(pathBase)) + StreamReader(std::filesystem::path pathBase) : m_pathBase(std::move(pathBase)) { assert(m_pathBase.has_root_path()); } @@ -44,7 +42,7 @@ namespace // if appropriate. // 3. Always open the file stream in binary mode. The glTF SDK will handle any text // encoding issues for us. - auto streamPath = m_pathBase / std::experimental::filesystem::u8path(filename); + auto streamPath = m_pathBase / std::filesystem::u8path(filename); auto stream = std::make_shared(streamPath, std::ios_base::binary); // Check if the stream has no errors and is ready for I/O operations @@ -57,7 +55,7 @@ namespace } private: - std::experimental::filesystem::path m_pathBase; + std::filesystem::path m_pathBase; }; // Uses the Document class to print some basic information about various top-level glTF entities @@ -185,13 +183,13 @@ namespace } } - void PrintInfo(const std::experimental::filesystem::path& path) + void PrintInfo(const std::filesystem::path& path) { // Pass the absolute path, without the filename, to the stream reader auto streamReader = std::make_unique(path.parent_path()); - std::experimental::filesystem::path pathFile = path.filename(); - std::experimental::filesystem::path pathFileExt = pathFile.extension(); + std::filesystem::path pathFile = path.filename(); + std::filesystem::path pathFileExt = pathFile.extension(); std::string manifest; @@ -271,11 +269,11 @@ int main(int argc, char* argv[]) throw std::runtime_error("Unexpected number of command line arguments"); } - std::experimental::filesystem::path path = argv[1U]; + std::filesystem::path path = argv[1U]; if (path.is_relative()) { - auto pathCurrent = std::experimental::filesystem::current_path(); + auto pathCurrent = std::filesystem::current_path(); // Convert the relative path into an absolute path by appending the command line argument to the current path pathCurrent /= path; diff --git a/GLTFSDK.Samples/Serialize/Source/main.cpp b/GLTFSDK.Samples/Serialize/Source/main.cpp index ac87c10..9c4039f 100644 --- a/GLTFSDK.Samples/Serialize/Source/main.cpp +++ b/GLTFSDK.Samples/Serialize/Source/main.cpp @@ -8,9 +8,7 @@ #include #include -// Replace this with (and use std::filesystem rather than -// std::experimental::filesystem) if your toolchain fully supports C++17 -#include +#include #include #include @@ -30,7 +28,7 @@ namespace class StreamWriter : public IStreamWriter { public: - StreamWriter(std::experimental::filesystem::path pathBase) : m_pathBase(std::move(pathBase)) + StreamWriter(std::filesystem::path pathBase) : m_pathBase(std::move(pathBase)) { assert(m_pathBase.has_root_path()); } @@ -46,7 +44,7 @@ namespace // if appropriate. // 3. Always open the file stream in binary mode. The glTF SDK will handle any text // encoding issues for us. - auto streamPath = m_pathBase / std::experimental::filesystem::u8path(filename); + auto streamPath = m_pathBase / std::filesystem::u8path(filename); auto stream = std::make_shared(streamPath, std::ios_base::binary); // Check if the stream has no errors and is ready for I/O operations @@ -59,7 +57,7 @@ namespace } private: - std::experimental::filesystem::path m_pathBase; + std::filesystem::path m_pathBase; }; void CreateTriangleResources(Document& document, BufferBuilder& bufferBuilder, std::string& accessorIdIndices, std::string& accessorIdPositions) @@ -171,13 +169,13 @@ namespace document.SetDefaultScene(std::move(scene), AppendIdPolicy::GenerateOnEmpty); } - void SerializeTriangle(const std::experimental::filesystem::path& path) + void SerializeTriangle(const std::filesystem::path& path) { // Pass the absolute path, without the filename, to the stream writer auto streamWriter = std::make_unique(path.parent_path()); - std::experimental::filesystem::path pathFile = path.filename(); - std::experimental::filesystem::path pathFileExt = pathFile.extension(); + std::filesystem::path pathFile = path.filename(); + std::filesystem::path pathFileExt = pathFile.extension(); auto MakePathExt = [](const std::string& ext) { @@ -261,11 +259,11 @@ int main(int argc, char* argv[]) throw std::runtime_error("Unexpected number of command line arguments"); } - std::experimental::filesystem::path path = argv[1U]; + std::filesystem::path path = argv[1U]; if (path.is_relative()) { - auto pathCurrent = std::experimental::filesystem::current_path(); + auto pathCurrent = std::filesystem::current_path(); // Convert the relative path into an absolute path by appending the command line argument to the current path pathCurrent /= path;