Skip to content

Conversation

kevinAlbs
Copy link
Collaborator

@kevinAlbs kevinAlbs commented Oct 20, 2023

Summary

Add VERSIONINFO resource to bson-1.0.dll and mongoc-1.0.dll.

Background & Motivation

The VERSIONINFO resource enables checking version information by inspecting the .dll file.

The version info can be viewed from Explorer:

Before After
before after

Powershell can be used to inspect. This notably includes the Debug flag for debug builds:

> Get-ItemProperty .\cmake-build\src\libbson\Debug\bson-1.0.dll VersionInfo

VersionInfo  : File:             C:\cygwin\home\Administrator\code\tasks\mongo-c-driver-C3091\cmake-build\src\libbson\Debug\bson-1.0.dll
               InternalName:     bson-1.0
               OriginalFilename: bson-1.0.dll
               FileVersion:      1.25.0-pre
               FileDescription:  A BSON Library for C
               Product:          MongoDB C Driver
               ProductVersion:   1.25.0-pre
               Debug:            True
               Patched:          False
               PreRelease:       False
               PrivateBuild:     False
               SpecialBuild:     False
               Language:         English (United States)

Applying to static libraries

The resource file is only applied to the shared libraries (.dll) and not the static libraries (.lib). This PR assumes the resource file is not applicable to the static libraries.

Applying the .rc file to the static target did not change the output of Get-ItemProperty .\cmake-build\src\libbson\Debug\bson-static-1.0.lib VersionInfo.

libcurl similarly only applies libcurl.rc to the shared library.

@kevinAlbs kevinAlbs marked this pull request as ready for review October 20, 2023 16:22
Copy link
Contributor

@rcsanchez97 rcsanchez97 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with two minor whitespace suggestions

kevinAlbs and others added 2 commits October 20, 2023 13:29
Co-authored-by: Roberto C. Sánchez <roberto@connexer.com>
It results in equivalent output when comparing before/after using:
`dumpbin /RAWDATA /SECTION:.rsrc`
Copy link
Contributor

@vector-of-bool vector-of-bool left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One minor comment

Comment on lines 231 to 235
add_library(bson_shared SHARED)
target_link_libraries(bson_shared PRIVATE $<BUILD_INTERFACE:bson_obj_pic>)
if(WIN32)
set_property(TARGET bson_shared APPEND PROPERTY SOURCES libbson.rc)
endif()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
add_library(bson_shared SHARED)
target_link_libraries(bson_shared PRIVATE $<BUILD_INTERFACE:bson_obj_pic>)
if(WIN32)
set_property(TARGET bson_shared APPEND PROPERTY SOURCES libbson.rc)
endif()
add_library(bson_shared SHARED $<$<PLATFORM_ID:Windows>:libbson.rc>)
target_link_libraries(bson_shared PRIVATE $<BUILD_INTERFACE:bson_obj_pic>)

Same in libmongoc

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants