Skip to content

Commit

Permalink
File Versioning (Windows) (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
nibanks authored Nov 4, 2022
1 parent ff536cb commit 8085114
Show file tree
Hide file tree
Showing 6 changed files with 103 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib")
# outside the build tree to the install RPATH.
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

if (WIN32)
# Statically link the OS included part of the runtime.
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib")
endif()

# Configure and build msquic dependency.
if (WIN32)
set(QUIC_TLS "schannel" CACHE STRING "TLS Library to use")
Expand Down
6 changes: 5 additions & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.

add_executable(quicreach quicreach.cpp)
if (WIN32)
add_executable(quicreach quicreach.cpp quicreach.rc)
else()
add_executable(quicreach quicreach.cpp)
endif()
target_link_libraries(quicreach PRIVATE inc warnings msquic)
if (NOT BUILD_SHARED_LIBS)
target_link_libraries(quicreach PRIVATE base_link)
Expand Down
2 changes: 1 addition & 1 deletion src/installer.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Manufacturer="Microsoft"
Name="quicreach"
UpgradeCode="8395c163-ac9f-4a89-82fc-689fe25f0777"
Version="1.1.1.0">
Version="1.2.0.0">
<Package InstallScope="perUser" Compressed="yes" />
<MajorUpgrade DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit." />
<MediaTemplate EmbedCab="yes" />
Expand Down
4 changes: 2 additions & 2 deletions src/quicreach.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@

#define _CRT_SECURE_NO_WARNINGS 1
#define QUIC_API_ENABLE_PREVIEW_FEATURES 1
#define QUICREACH_VERSION_ONLY 1

#include <stdio.h>
#include <thread>
#include <vector>
#include <mutex>
#include <condition_variable>
#include <msquic.hpp>
#include "quicreach.ver"
#include "domains.hpp"

#define QUICREACH_VERSION "1.1.0"

#ifdef _WIN32
#define QUIC_CALL __cdecl
#else
Expand Down
12 changes: 12 additions & 0 deletions src/quicreach.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//

#include <windows.h>

#define VER_FILETYPE VFT_APP
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_ORIGINALFILENAME_STR "quicreach.exe"

#include "quicreach.ver"
77 changes: 77 additions & 0 deletions src/quicreach.ver
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
//
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
//

#ifndef VER_MAJOR
#define VER_MAJOR 1
#endif

#ifndef VER_MINOR
#define VER_MINOR 2
#endif

#ifndef VER_PATCH
#define VER_PATCH 0
#endif

#ifndef VER_BUILD_ID
#define VER_BUILD_ID 0
#endif

#ifndef VER_GIT_HASH
#define VER_GIT_HASH_STR "Unknown"
#else
#define STR_HELPER_GIT_VER(x) #x
#define STR_GIT_VER(x) STR_HELPER_GIT_VER(x)
#define VER_GIT_HASH_STR STR_GIT_VER(VER_GIT_HASH)
#endif

#define STR_HELPER(x) #x
#define STR(x) STR_HELPER(x)

#define QUICREACH_VERSION STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_PATCH) "." STR(VER_BUILD_ID)

#ifndef QUICREACH_VERSION_ONLY

#define VER_COMPANYNAME_STR "Microsoft Corporation"
#define VER_FILEDESCRIPTION_STR "Microsoft\256 QUIC Library"
#define VER_INTERNALNAME_STR "quicreach"
#define VER_LEGALCOPYRIGHT_STR "\251 Microsoft Corporation. All rights reserved."
#define VER_PRODUCTNAME_STR "Microsoft\256 QUIC"

#define VER_FILEVERSION VER_MAJOR,VER_MINOR,VER_PATCH,0
#define VER_FILEVERSION_STR QUICREACH_VERSION "\0"
#define VER_PRODUCTVERSION_STR QUICREACH_VERSION "\0"

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
FILEFLAGSMASK VS_FFI_FILEFLAGSMASK
FILEFLAGS 0
FILEOS VOS_NT_WINDOWS32
FILETYPE VER_FILETYPE
FILESUBTYPE VER_FILESUBTYPE

BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904B0"
BEGIN
VALUE "CompanyName", VER_COMPANYNAME_STR
VALUE "FileDescription", VER_FILEDESCRIPTION_STR
VALUE "FileVersion", VER_FILEVERSION_STR
VALUE "InternalName", VER_INTERNALNAME_STR
VALUE "LegalCopyright", VER_LEGALCOPYRIGHT_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x0409, 0x04B0
END
END

#endif // QUICREACH_VERSION_ONLY

0 comments on commit 8085114

Please sign in to comment.