- now build without uuid library is possible
This commit is contained in:
parent
0a54d7f7db
commit
c34bcdc058
|
|
@ -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")
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue