uuid_system_generator conditioned by UUID_SYSTEM_GENERATOR macro

This commit is contained in:
Marius Bancila 2020-09-10 00:44:26 +03:00
parent 6452aadcbe
commit 324ebf37fc
3 changed files with 23 additions and 4 deletions

1
.gitignore vendored
View File

@ -34,3 +34,4 @@
build
/test/CMakeFiles/3.10.0/CompilerIdC/Debug/CompilerIdC.tlog
/.vs

View File

@ -8,20 +8,24 @@ file(GLOB headers ${CMAKE_SOURCE_DIR}/include/*.h)
file(GLOB SOURCES "test/*.cpp" "include/*.cpp")
if(BUILD_TESTS)
include(CTest)
include(CTest)
endif()
if(UUID_SYSTEM_GENERATOR)
add_definitions(-DUUID_SYSTEM_GENERATOR)
endif()
if(WIN32)
message(status "Setting MSVC flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc /std:c++latest")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHc /std:c++17")
add_definitions(-D_SCL_SECURE_NO_WARNINGS)
elseif(APPLE)
message(status "Setting Clang flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -fexceptions -g -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fexceptions -g -Wall")
else()
#include_directories(${LIBUUID_INCLUDE_DIR})
message(status "Setting GCC flags")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1z -fexceptions -g -Wall")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fexceptions -g -Wall")
endif()
add_executable(test_uuid ${SOURCES} ${headers})

View File

@ -24,18 +24,30 @@
#ifndef NOMINMAX
#define NOMINMAX
#endif
#ifdef UUID_SYSTEM_GENERATOR
#include <objbase.h>
#endif
#include <windows.h>
#include <intrin.h>
#include <iphlpapi.h>
#pragma comment(lib, "IPHLPAPI.lib")
#elif defined(__linux__) || defined(__unix__)
#ifdef UUID_SYSTEM_GENERATOR
#include <uuid/uuid.h>
#endif
#elif defined(__APPLE__)
#ifdef UUID_SYSTEM_GENERATOR
#include <CoreFoundation/CFUUID.h>
#endif
#endif
namespace uuids
{
namespace detail
@ -611,6 +623,7 @@ namespace uuids
// uuid generators
// --------------------------------------------------------------------------------------------------------------------------
#ifdef UUID_SYSTEM_GENERATOR
class uuid_system_generator
{
public:
@ -705,6 +718,7 @@ namespace uuids
#endif
}
};
#endif
template <typename UniformRandomNumberGenerator>
class basic_uuid_random_generator