Skip to content

Commit

Permalink
Add windows version info resource file
Browse files Browse the repository at this point in the history
  • Loading branch information
cjhoward committed Dec 3, 2023
1 parent b3db3ed commit fe6b65d
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,22 @@ project(Siafu
HOMEPAGE_URL "https://github.com/cjhoward/siafu"
LANGUAGES CXX
)
string(TOLOWER "${PROJECT_NAME}" PROJECT_SLUG)
set(PROJECT_AUTHOR "C. J. Howard")

# Specify the source files in the "src" directory
file(GLOB_RECURSE SOURCE_FILES CONFIGURE_DEPENDS
${PROJECT_SOURCE_DIR}/src/*.cpp
)

if(CMAKE_SYSTEM_NAME MATCHES "Windows")

# Generate Windows version-information resource file
configure_file(${PROJECT_SOURCE_DIR}/res/windows/version.rc.in ${PROJECT_BINARY_DIR}/res/windows/version.rc)
list(APPEND SOURCE_FILES "${PROJECT_BINARY_DIR}/res/windows/version.rc")

endif()

# Create an executable using the specified source files
add_executable(${PROJECT_NAME} ${SOURCE_FILES})

Expand Down
56 changes: 56 additions & 0 deletions res/windows/version.rc.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// SPDX-FileCopyrightText: 2023 C. J. Howard
// SPDX-License-Identifier: MIT

#include <Winver.h>

#define VER_FILEVERSION @PROJECT_VERSION_MAJOR@,@PROJECT_VERSION_MINOR@,@PROJECT_VERSION_PATCH@,0
#define VER_PRODUCTVERSION VER_FILEVERSION
#if !defined(NDEBUG)
#define VER_FILEFLAGS (VS_FF_DEBUG | VS_FF_PRERELEASE)
#else
#define VER_FILEFLAGS 0
#endif

#define VER_COMMENTS_STR ""
#define VER_COMPANYNAME_STR "@PROJECT_AUTHOR@"
#define VER_FILEDESCRIPTION_STR "@PROJECT_DESCRIPTION@"
#define VER_FILEVERSION_STR "@PROJECT_VERSION@"
#define VER_INTERNALNAME_STR "@PROJECT_SLUG@"
#define VER_LEGALCOPYRIGHT_STR "\251 @PROJECT_AUTHOR@. All rights reserved."
#define VER_LEGALTRADEMARKS1_STR ""
#define VER_LEGALTRADEMARKS2_STR ""
#define VER_ORIGINALFILENAME_STR "@PROJECT_SLUG@.exe"
#define VER_PRODUCTNAME_STR "@PROJECT_NAME@"
#define VER_PRODUCTVERSION_STR VER_FILEVERSION_STR

VS_VERSION_INFO VERSIONINFO
FILEVERSION VER_FILEVERSION
PRODUCTVERSION VER_PRODUCTVERSION
FILEFLAGSMASK VER_FILEFLAGS
FILEOS VOS__WINDOWS32
FILETYPE VFT_APP
FILESUBTYPE VFT2_UNKNOWN
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904E4"
BEGIN
VALUE "Comments", VER_COMMENTS_STR
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 "LegalTrademarks1", VER_LEGALTRADEMARKS1_STR
VALUE "LegalTrademarks2", VER_LEGALTRADEMARKS2_STR
VALUE "OriginalFilename", VER_ORIGINALFILENAME_STR
VALUE "ProductName", VER_PRODUCTNAME_STR
VALUE "ProductVersion", VER_PRODUCTVERSION_STR
END
END

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

0 comments on commit fe6b65d

Please sign in to comment.