Skip to content

Commit 3f41e4d

Browse files
authored
Enable parallel compilation with MinGW and fix gmtime_s detection (#1185)
* Enable parallel compilation with MinGW * Fix gmtime_s detection in kms_request.c * Default to C++11 for testing to address MinGW compilation errors
1 parent e401a5b commit 3f41e4d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

.evergreen/compile-windows-mingw.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ set CC=C:\mingw-w64\x86_64-4.9.1-posix-seh-rt_v3-rev1\mingw64\bin\gcc.exe
88

99
%CMAKE% -G "MinGW Makefiles" -DCMAKE_MAKE_PROGRAM=%CMAKE_MAKE_PROGRAM% -DCMAKE_PREFIX_PATH=%INSTALL_DIR%\lib\cmake %CONFIGURE_FLAGS%
1010

11-
%CMAKE_MAKE_PROGRAM%
11+
%CMAKE_MAKE_PROGRAM% -j
1212

1313
set MONGOC_TEST_SKIP_LIVE=on
1414
.\src\libmongoc\test-libmongoc.exe --no-fork -d -F test-results.json --skip-tests .evergreen\skip-tests.txt

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@ include (CheckLanguage)
5959
check_language (CXX)
6060
if (CMAKE_CXX_COMPILER)
6161
enable_language (CXX)
62+
if (NOT CMAKE_CXX_STANDARD)
63+
# Default to C++11 for purposes of testing.
64+
set (CMAKE_CXX_STANDARD 11)
65+
endif ()
6266
else ()
6367
message (STATUS "No CXX support")
6468
endif ()

src/kms-message/src/kms_request.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,10 +153,12 @@ kms_request_set_date (kms_request_t *request, const struct tm *tm)
153153
/* use current time */
154154
time_t t;
155155
time (&t);
156-
#ifdef _WIN32
156+
#if defined(BSON_HAVE_GMTIME_R)
157+
gmtime_r (&t, &tmp_tm);
158+
#elif defined(_MSC_VER)
157159
gmtime_s (&tmp_tm, &t);
158160
#else
159-
gmtime_r (&t, &tmp_tm);
161+
tmp_tm = *gmtime (&t);
160162
#endif
161163
tm = &tmp_tm;
162164
}

0 commit comments

Comments
 (0)