- now build without uuid library is possible

This commit is contained in:
Dmytro Bogovych 2019-02-04 11:08:42 +03:00
parent 0a54d7f7db
commit c34bcdc058
3 changed files with 72 additions and 65 deletions

View File

@ -3,6 +3,7 @@ project (helper_lib)
# Rely on C++ 11
set (CMAKE_CXX_STANDARD 11)
set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (USE_NULL_UUID OFF CACHE BOOL "When enabled linking to libuuid is avoided")
file(GLOB HELPER_LIB_SOURCES "*.cpp" "*.h")

View File

@ -73,7 +73,6 @@ struct MediaStreamId
uint32_t mSSRC = 0;
bool mSsrcIsId = true;
Uuid mLinkId;
bool operator < (const MediaStreamId& s2) const;
bool operator == (const MediaStreamId& right) const;

View File

@ -11,25 +11,28 @@ Uuid::Uuid()
Uuid Uuid::generateOne()
{
Uuid result;
#if !defined(USE_NULL_UUID)
#if defined(TARGET_LINUX) || defined(TARGET_OSX)
uuid_generate(result.mUuid);
#endif
#if defined(TARGET_WIN)
UuidCreate(&result.mUuid);
#endif
#endif
return result;
}
Uuid Uuid::parse(const std::string &s)
{
Uuid result;
#if !defined(USE_NULL_UUID)
#if defined(TARGET_LINUX) || defined(TARGET_OSX)
uuid_parse(s.c_str(), result.mUuid);
#endif
#if defined(TARGET_WIN)
UuidFromStringA((RPC_CSTR)s.c_str(), &result.mUuid);
#endif
#endif
return result;
}
@ -37,6 +40,9 @@ Uuid Uuid::parse(const std::string &s)
std::string Uuid::toString() const
{
char buf[64];
#if defined(USE_NULL_UUID)
return "UUID_disabled";
#else
#if defined(TARGET_LINUX) || defined(TARGET_OSX)
uuid_unparse_lower(mUuid, buf);
#endif
@ -53,6 +59,7 @@ std::string Uuid::toString() const
#endif
return buf;
#endif
}
bool Uuid::operator < (const Uuid& right) const