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 build
/test/CMakeFiles/3.10.0/CompilerIdC/Debug/CompilerIdC.tlog /test/CMakeFiles/3.10.0/CompilerIdC/Debug/CompilerIdC.tlog
/.vs

View File

@ -11,17 +11,21 @@ if(BUILD_TESTS)
include(CTest) include(CTest)
endif() endif()
if(UUID_SYSTEM_GENERATOR)
add_definitions(-DUUID_SYSTEM_GENERATOR)
endif()
if(WIN32) if(WIN32)
message(status "Setting MSVC flags") 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) add_definitions(-D_SCL_SECURE_NO_WARNINGS)
elseif(APPLE) elseif(APPLE)
message(status "Setting Clang flags") 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() else()
#include_directories(${LIBUUID_INCLUDE_DIR}) #include_directories(${LIBUUID_INCLUDE_DIR})
message(status "Setting GCC flags") 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() endif()
add_executable(test_uuid ${SOURCES} ${headers}) add_executable(test_uuid ${SOURCES} ${headers})

View File

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