Skip to content

Commit 0c7efad

Browse files
vector-of-boolbaileympearsontadjik1
authored
ci(NODE-7409): Use CMake's builtin control for the MSVCRT link mode on libmongocrypt (#122)
Co-authored-by: bailey <[email protected]> Co-authored-by: Sergey Zelenov <[email protected]>
1 parent cf8f9f6 commit 0c7efad

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

.github/scripts/libmongocrypt.mjs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,16 @@ export async function buildLibMongoCrypt(libmongocryptRoot, nodeDepsRoot, option
9999
});
100100

101101
const WINDOWS_CMAKE_FLAGS =
102-
process.platform === 'win32' // Windows is still called "win32" when it is 64-bit
103-
? toCLIFlags({ Thost: 'x64', A: 'x64', DENABLE_WINDOWS_STATIC_RUNTIME: 'ON' })
102+
process.platform === 'win32'
103+
? toCLIFlags({
104+
// Tell CMake that binaries should link with the static MSVC runtime instead of
105+
// the default dynamic one.
106+
DCMAKE_MSVC_RUNTIME_LIBRARY: 'MultiThreaded',
107+
// Tell CMake to use the MSVC 64-bit compiler toolchain
108+
T: 'host=x64',
109+
// Tell CMake to generate a 64-bit binaries
110+
A: 'x64',
111+
})
104112
: [];
105113

106114
const DARWIN_CMAKE_FLAGS =

.github/scripts/utils.mjs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ export function buildLibmongocryptDownloadUrl(ref, platform) {
3838
const [major, minor, _patch] = ref.split('.');
3939

4040
// Just a note: it may appear that this logic _doesn't_ support patch releases but it actually does.
41-
// libmongocrypt's creates release branches for minor releases in the form `r<major>.<minor>`.
41+
// libmongocrypt's creates release branches for minor releases in the form `r<major>.<minor>`.
4242
// Any patches made to this branch are committed as tags in the form <major>.<minor>.<patch>.
4343
// So, the branch that is used for the AWS s3 upload is `r<major>.<minor>` and the commit hash
4444
// is the commit hash we parse from the `getCommitFromRef()` (which handles switching to git tags and
@@ -49,7 +49,7 @@ export function buildLibmongocryptDownloadUrl(ref, platform) {
4949
}
5050

5151
// just a note here - `master` refers to the branch, the hash is the commit on that branch.
52-
// if we ever need to download binaries from a non-master branch (or non-release branch),
52+
// if we ever need to download binaries from a non-master branch (or non-release branch),
5353
// this will need to be modified somehow.
5454
return `https://mciuploads.s3.amazonaws.com/libmongocrypt/${platform}/master/${hash}/libmongocrypt.tar.gz`;
5555
}
@@ -98,9 +98,9 @@ function getLibc() {
9898
if (process.platform !== 'linux') return null;
9999

100100
/**
101-
* executes `ldd --version`. on Alpine linux, `ldd` and `ldd --version` return exit code 1 and print the version
101+
* Executes `ldd --version`. on Alpine linux, `ldd` and `ldd --version` return exit code 1 and print the version
102102
* info to stderr, but on other platforms, `ldd --version` prints to stdout and returns exit code 0.
103-
*
103+
*
104104
* So, this script works on both by return stderr if the command returns a non-zero exit code, otherwise stdout.
105105
*/
106106
function lddVersion() {

0 commit comments

Comments
 (0)