[mongo-c-driver] Fix UWP builds. Deploy THIRD_PARTY_NOTICES.

This commit is contained in:
Robert Schumacher 2017-04-06 16:42:22 -07:00
Родитель 3839b44d18
Коммит 0163b19e32
3 изменённых файлов: 59 добавлений и 3 удалений

Просмотреть файл

@ -1,4 +1,4 @@
Source: mongo-c-driver
Version: 1.5.1
Build-Depends: libbson
Version: 1.5.1-1
Build-Depends: libbson, openssl [uwp]
Description: Client library written in C for MongoDB.

Просмотреть файл

@ -0,0 +1,44 @@
diff --git a/src/mongoc/mongoc-gridfs-file.c b/src/mongoc/mongoc-gridfs-file.c
index 5beb610..7e74ff7 100644
--- a/src/mongoc/mongoc-gridfs-file.c
+++ b/src/mongoc/mongoc-gridfs-file.c
@@ -734,7 +734,7 @@ _mongoc_gridfs_file_refresh_page (mongoc_gridfs_file_t *file)
bson_t query;
bson_t child;
bson_t opts;
- const bson_t *chunk;
+ const bson_t *chunk = 0;
const char *key;
bson_iter_t iter;
int64_t existing_chunks;
diff --git a/src/mongoc/mongoc-handshake.c b/src/mongoc/mongoc-handshake.c
index 4e181bd..b274fc1 100644
--- a/src/mongoc/mongoc-handshake.c
+++ b/src/mongoc/mongoc-handshake.c
@@ -195,7 +195,8 @@ _get_os_version (void)
char *ret = bson_malloc (HANDSHAKE_OS_VERSION_MAX);
bool found = false;
-#ifdef _WIN32
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+#elif defined (_WIN32)
OSVERSIONINFO osvi;
ZeroMemory (&osvi, sizeof (OSVERSIONINFO));
osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO);
diff --git a/src/mongoc/mongoc-util.c b/src/mongoc/mongoc-util.c
index 6dbb26d..7f33780 100644
--- a/src/mongoc/mongoc-util.c
+++ b/src/mongoc/mongoc-util.c
@@ -46,7 +46,11 @@ _mongoc_hex_md5 (const char *input)
void
_mongoc_usleep (int64_t usec)
{
-#ifdef _WIN32
+#if defined (WINAPI_FAMILY_PARTITION) && !WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP | WINAPI_PARTITION_SYSTEM)
+ if (usec / 1000 > MAXDWORD || usec < 0)
+ __fastfail(-1);
+ Sleep((DWORD)(usec / 1000));
+#elif defined(_WIN32)
LARGE_INTEGER ft;
HANDLE timer;

Просмотреть файл

@ -12,18 +12,27 @@ vcpkg_apply_patches(
SOURCE_PATH ${SOURCE_PATH}
PATCHES
${CMAKE_CURRENT_LIST_DIR}/bson.patch
${CMAKE_CURRENT_LIST_DIR}/fix-uwp.patch
)
set(ENABLE_SSL "WINDOWS")
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
set(ENABLE_SSL "OPENSSL")
endif()
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
-DBSON_ROOT_DIR=${CURRENT_INSTALLED_DIR}
-DENABLE_TESTS=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_SSL=${ENABLE_SSL}
)
vcpkg_install_cmake()
# This rename is needed because the official examples expect to use #include <mongoc.h>
# See Microsoft/vcpkg#904
file(RENAME
${CURRENT_PACKAGES_DIR}/include/libmongoc-1.0
${CURRENT_PACKAGES_DIR}/temp)
@ -49,4 +58,7 @@ else()
file(REMOVE ${CURRENT_PACKAGES_DIR}/debug/lib/mongoc-static-1.0.lib)
endif()
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver RENAME copyright)
file(INSTALL ${SOURCE_PATH}/COPYING DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver RENAME copyright)
file(COPY ${SOURCE_PATH}/THIRD_PARTY_NOTICES DESTINATION ${CURRENT_PACKAGES_DIR}/share/mongo-c-driver)
vcpkg_copy_pdbs()