From 862c24873de9c16056f7c21973771645e00789ee Mon Sep 17 00:00:00 2001 From: Ryan Shepherd Date: Mon, 16 Mar 2026 21:57:48 -0700 Subject: [PATCH] Start moving to v3.0 --- .pipelines/OneBranch.Official.yml | 2 +- .pipelines/OneBranch.PullRequest.yml | 2 +- .pipelines/variables/version.yml | 2 +- CMakeLists.txt | 4 ++-- Directory.Build.Props | 2 +- prebuild/main.cpp | 18 ++++++++++++++---- 6 files changed, 20 insertions(+), 10 deletions(-) diff --git a/.pipelines/OneBranch.Official.yml b/.pipelines/OneBranch.Official.yml index 7a73b263b..158d3bf4e 100644 --- a/.pipelines/OneBranch.Official.yml +++ b/.pipelines/OneBranch.Official.yml @@ -12,7 +12,7 @@ variables: parameters: debug: ${{ parameters.debug }} -name: 2.0.$(date:yyMMdd)$(rev:.r) +name: 3.0.$(date:yyMMdd)$(rev:.r) trigger: none diff --git a/.pipelines/OneBranch.PullRequest.yml b/.pipelines/OneBranch.PullRequest.yml index 9e18821b4..d92dccaa2 100644 --- a/.pipelines/OneBranch.PullRequest.yml +++ b/.pipelines/OneBranch.PullRequest.yml @@ -10,7 +10,7 @@ variables: parameters: debug: ${{ parameters.debug }} -name: PullRequest_2.0.$(date:yyMMdd)$(rev:.r) +name: PullRequest_3.0.$(date:yyMMdd)$(rev:.r) trigger: none diff --git a/.pipelines/variables/version.yml b/.pipelines/variables/version.yml index 15382e7df..46a535ee0 100644 --- a/.pipelines/variables/version.yml +++ b/.pipelines/variables/version.yml @@ -4,7 +4,7 @@ parameters: default: false variables: - MajorVersion: "2" + MajorVersion: "3" MinorVersion: "0" VersionDate: $[format('{0:yyMMdd}', pipeline.startTime)] VersionCounter: $[counter(variables['VersionDate'], 1)] diff --git a/CMakeLists.txt b/CMakeLists.txt index 139da8379..c08db08ea 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,8 +13,8 @@ project(cppwinrt LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED True) -set(CPPWINRT_BUILD_VERSION "2.3.4.5" CACHE STRING "The version string used for cppwinrt.") -if(CPPWINRT_BUILD_VERSION STREQUAL "2.3.4.5" OR CPPWINRT_BUILD_VERSION STREQUAL "0.0.0.0") +set(CPPWINRT_BUILD_VERSION "3.3.4.5" CACHE STRING "The version string used for cppwinrt.") +if(CPPWINRT_BUILD_VERSION STREQUAL "3.3.4.5" OR CPPWINRT_BUILD_VERSION STREQUAL "0.0.0.0") message(WARNING "CPPWINRT_BUILD_VERSION has been set to a dummy version string. Do not use in production!") endif() message(STATUS "Using version string: ${CPPWINRT_BUILD_VERSION}") diff --git a/Directory.Build.Props b/Directory.Build.Props index 5f530da91..a442c29a1 100644 --- a/Directory.Build.Props +++ b/Directory.Build.Props @@ -37,7 +37,7 @@ - 2.3.4.5 + 3.3.4.5 $(Platform) x86 $(SolutionDir)_build\$(CppWinRTPlatform)\$(Configuration)\ diff --git a/prebuild/main.cpp b/prebuild/main.cpp index 3e427d32b..1295f8f69 100644 --- a/prebuild/main.cpp +++ b/prebuild/main.cpp @@ -77,12 +77,19 @@ namespace cppwinrt::strings { writer version_rc; + // Extract major.minor substrings from CPPWINRT_VERSION_STRING (e.g. "3.0.250316.1") + std::string_view const full_version{ CPPWINRT_VERSION_STRING }; + auto const first_dot = full_version.find('.'); + auto const second_dot = full_version.find('.', first_dot + 1); + auto const ver_major = full_version.substr(0, first_dot); + auto const ver_minor = full_version.substr(first_dot + 1, second_dot - first_dot - 1); + version_rc.write(R"( #include "winres.h" VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,0,0,0 - PRODUCTVERSION 2,0,0,0 + FILEVERSION %,%,0,0 + PRODUCTVERSION %,%,0,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -99,7 +106,7 @@ BEGIN BEGIN VALUE "CompanyName", "Microsoft Corporation" VALUE "FileDescription", "C++/WinRT" - VALUE "FileVersion", "2.0.0.0" + VALUE "FileVersion", "%.%.0.0" VALUE "LegalCopyright", "Microsoft Corporation. All rights reserved." VALUE "OriginalFilename", "cppwinrt.exe" VALUE "ProductName", "C++/WinRT" @@ -112,7 +119,10 @@ BEGIN END END )", - CPPWINRT_VERSION_STRING); + ver_major, ver_minor, // FILEVERSION + ver_major, ver_minor, // PRODUCTVERSION + ver_major, ver_minor, // FileVersion string + CPPWINRT_VERSION_STRING); // ProductVersion string std::filesystem::create_directories(argv[2]); auto const output = std::filesystem::canonical(argv[2]);