system: embed a version resource in the windows runtime library

This commit is contained in:
mchughalex 2026-07-24 19:40:35 +01:00
parent 593f8774f6
commit 5aa8c4c727
2 changed files with 58 additions and 0 deletions

View file

@ -84,6 +84,36 @@ endif()
if(WIN32) if(WIN32)
target_link_libraries(rexruntime PRIVATE ws2_32) target_link_libraries(rexruntime PRIVATE ws2_32)
# Version metadata for the runtime DLL. Unsigned binaries without any
# version resource are prone to antivirus false positives; embedding
# identity here also lets crash dumps and support logs name the build.
# The embedding application may override these before including the SDK.
enable_language(RC)
if(NOT REXGLUE_RUNTIME_RC_VERSION)
set(REXGLUE_RUNTIME_RC_VERSION "0,0,0,0")
endif()
if(NOT REXGLUE_RUNTIME_RC_VERSION_STRING)
set(REXGLUE_RUNTIME_RC_VERSION_STRING "0.0.0")
endif()
if(NOT REXGLUE_RUNTIME_RC_PRODUCT_NAME)
set(REXGLUE_RUNTIME_RC_PRODUCT_NAME "rexglue")
endif()
if(NOT REXGLUE_RUNTIME_RC_COMPANY)
set(REXGLUE_RUNTIME_RC_COMPANY "rexglue project")
endif()
if(NOT REXGLUE_RUNTIME_RC_DESCRIPTION)
set(REXGLUE_RUNTIME_RC_DESCRIPTION "rexglue guest runtime library")
endif()
if(NOT REXGLUE_RUNTIME_RC_COPYRIGHT)
set(REXGLUE_RUNTIME_RC_COPYRIGHT "(c) rexglue contributors")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/rexruntime_version.rc.in
${CMAKE_CURRENT_BINARY_DIR}/rexruntime_version.rc
@ONLY)
target_sources(rexruntime PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/rexruntime_version.rc)
endif() endif()
if(REXGLUE_USE_D3D12) if(REXGLUE_USE_D3D12)

View file

@ -0,0 +1,28 @@
1 VERSIONINFO
FILEVERSION @REXGLUE_RUNTIME_RC_VERSION@
PRODUCTVERSION @REXGLUE_RUNTIME_RC_VERSION@
FILEFLAGSMASK 0x3fL
FILEFLAGS 0x0L
FILEOS 0x40004L
FILETYPE 0x2L
FILESUBTYPE 0x0L
BEGIN
BLOCK "StringFileInfo"
BEGIN
BLOCK "040904b0"
BEGIN
VALUE "CompanyName", "@REXGLUE_RUNTIME_RC_COMPANY@"
VALUE "FileDescription", "@REXGLUE_RUNTIME_RC_DESCRIPTION@"
VALUE "FileVersion", "@REXGLUE_RUNTIME_RC_VERSION_STRING@"
VALUE "InternalName", "rexruntime"
VALUE "LegalCopyright", "@REXGLUE_RUNTIME_RC_COPYRIGHT@"
VALUE "OriginalFilename", "rexruntime.dll"
VALUE "ProductName", "@REXGLUE_RUNTIME_RC_PRODUCT_NAME@"
VALUE "ProductVersion", "@REXGLUE_RUNTIME_RC_VERSION_STRING@"
END
END
BLOCK "VarFileInfo"
BEGIN
VALUE "Translation", 0x409, 1200
END
END