Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/Basic/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(UUID_INCLUDE "")
set(UUID_LIBRARIES "")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
set(UUID_INCLUDE "")
set(UUID_LIBRARIES "ole32.lib")
else()
find_package(UUID REQUIRED)
set(UUID_INCLUDE "-I${UUID_INCLUDE_DIRS}")
Expand Down
7 changes: 4 additions & 3 deletions lib/Basic/UUID.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
// WIN32 doesn't natively support <uuid/uuid.h>. Instead, we use Win32 APIs.
#if defined(_WIN32)
#define WIN32_LEAN_AND_MEAN
#include <rpc.h>
#define NOMINMAX
#include <objbase.h>
#include <string>
#else
#include <uuid/uuid.h>
Expand All @@ -31,7 +32,7 @@ using namespace swift;
swift::UUID::UUID(FromRandom_t) {
#if defined(_WIN32)
::UUID uuid;
UuidCreate(&uuid);
::CoCreateGuid(&uuid);

memcpy(Value, &uuid, Size);
#else
Expand All @@ -42,7 +43,7 @@ swift::UUID::UUID(FromRandom_t) {
swift::UUID::UUID(FromTime_t) {
#if defined(_WIN32)
::UUID uuid;
UuidCreate(&uuid);
::CoCreateGuid(&uuid);

memcpy(Value, &uuid, Size);
#else
Expand Down