Skip to content

Commit 8085114

Browse files
authored
File Versioning (Windows) (#72)
1 parent ff536cb commit 8085114

File tree

6 files changed

+103
-4
lines changed

6 files changed

+103
-4
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
1616
# outside the build tree to the install RPATH.
1717
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
1818

19+
if (WIN32)
20+
# Statically link the OS included part of the runtime.
21+
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
22+
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
23+
endif()
24+
1925
# Configure and build msquic dependency.
2026
if (WIN32)
2127
set(QUIC_TLS "schannel" CACHE STRING "TLS Library to use")

src/CMakeLists.txt

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

4-
add_executable(quicreach quicreach.cpp)
4+
if (WIN32)
5+
add_executable(quicreach quicreach.cpp quicreach.rc)
6+
else()
7+
add_executable(quicreach quicreach.cpp)
8+
endif()
59
target_link_libraries(quicreach PRIVATE inc warnings msquic)
610
if (NOT BUILD_SHARED_LIBS)
711
target_link_libraries(quicreach PRIVATE base_link)

src/installer.wxs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
Manufacturer="Microsoft"
66
Name="quicreach"
77
UpgradeCode="8395c163-ac9f-4a89-82fc-689fe25f0777"
8-
Version="1.1.1.0">
8+
Version="1.2.0.0">
99
<Package InstallScope="perUser" Compressed="yes" />
1010
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
1111
<MediaTemplate EmbedCab="yes" />

src/quicreach.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88
#define _CRT_SECURE_NO_WARNINGS 1
99
#define QUIC_API_ENABLE_PREVIEW_FEATURES 1
10+
#define QUICREACH_VERSION_ONLY 1
1011

1112
#include <stdio.h>
1213
#include <thread>
1314
#include <vector>
1415
#include <mutex>
1516
#include <condition_variable>
1617
#include <msquic.hpp>
18+
#include "quicreach.ver"
1719
#include "domains.hpp"
1820

19-
#define QUICREACH_VERSION "1.1.0"
20-
2121
#ifdef _WIN32
2222
#define QUIC_CALL __cdecl
2323
#else

src/quicreach.rc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// Licensed under the MIT License.
4+
//
5+
6+
#include <windows.h>
7+
8+
#define VER_FILETYPE VFT_APP
9+
#define VER_FILESUBTYPE VFT2_UNKNOWN
10+
#define VER_ORIGINALFILENAME_STR "quicreach.exe"
11+
12+
#include "quicreach.ver"

src/quicreach.ver

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
//
2+
// Copyright (c) Microsoft Corporation.
3+
// Licensed under the MIT License.
4+
//
5+
6+
#ifndef VER_MAJOR
7+
#define VER_MAJOR 1
8+
#endif
9+
10+
#ifndef VER_MINOR
11+
#define VER_MINOR 2
12+
#endif
13+
14+
#ifndef VER_PATCH
15+
#define VER_PATCH 0
16+
#endif
17+
18+
#ifndef VER_BUILD_ID
19+
#define VER_BUILD_ID 0
20+
#endif
21+
22+
#ifndef VER_GIT_HASH
23+
#define VER_GIT_HASH_STR "Unknown"
24+
#else
25+
#define STR_HELPER_GIT_VER(x) #x
26+
#define STR_GIT_VER(x) STR_HELPER_GIT_VER(x)
27+
#define VER_GIT_HASH_STR STR_GIT_VER(VER_GIT_HASH)
28+
#endif
29+
30+
#define STR_HELPER(x) #x
31+
#define STR(x) STR_HELPER(x)
32+
33+
#define QUICREACH_VERSION STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID)
34+
35+
#ifndef QUICREACH_VERSION_ONLY
36+
37+
#define VER_COMPANYNAME_STR "Microsoft Corporation"
38+
#define VER_FILEDESCRIPTION_STR "Microsoft\256 QUIC Library"
39+
#define VER_INTERNALNAME_STR "quicreach"
40+
#define VER_LEGALCOPYRIGHT_STR "\251 Microsoft Corporation. All rights reserved."
41+
#define VER_PRODUCTNAME_STR "Microsoft\256 QUIC"
42+
43+
#define VER_FILEVERSION VER_MAJOR,VER_MINOR,VER_PATCH,0
44+
#define VER_FILEVERSION_STR QUICREACH_VERSION "\0"
45+
#define VER_PRODUCTVERSION_STR QUICREACH_VERSION "\0"
46+
47+
VS_VERSION_INFO VERSIONINFO
48+
FILEVERSION VER_FILEVERSION
49+
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
50+
FILEFLAGS 0
51+
FILEOS VOS_NT_WINDOWS32
52+
FILETYPE VER_FILETYPE
53+
FILESUBTYPE VER_FILESUBTYPE
54+
55+
BEGIN
56+
BLOCK "StringFileInfo"
57+
BEGIN
58+
BLOCK "040904B0"
59+
BEGIN
60+
VALUE "CompanyName", VER_COMPANYNAME_STR
61+
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
62+
VALUE "FileVersion", VER_FILEVERSION_STR
63+
VALUE "InternalName", VER_INTERNALNAME_STR
64+
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
65+
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
66+
VALUE "ProductName", VER_PRODUCTNAME_STR
67+
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
68+
END
69+
END
70+
71+
BLOCK "VarFileInfo"
72+
BEGIN
73+
VALUE "Translation", 0x0409, 0x04B0
74+
END
75+
END
76+
77+
#endif // QUICREACH_VERSION_ONLY

0 commit comments

Comments
 (0)