(macOS) Some fixes to make the legacy build work again.

This commit is contained in:
Leon Styhre 2021-12-01 17:57:23 +01:00
parent e285749871
commit a2253113f7
2 changed files with 20 additions and 0 deletions

View file

@ -276,6 +276,10 @@ if(VLC_PLAYER)
add_definitions(-DBUILD_VLC_PLAYER) add_definitions(-DBUILD_VLC_PLAYER)
endif() endif()
if(APPLE AND CMAKE_OSX_DEPLOYMENT_TARGET VERSION_LESS 10.14)
add_definitions(-DLEGACY_MACOS)
endif()
# GLM library options. # GLM library options.
add_definitions(-DGLM_FORCE_CXX17) add_definitions(-DGLM_FORCE_CXX17)
add_definitions(-DGLM_FORCE_XYZW_ONLY) add_definitions(-DGLM_FORCE_XYZW_ONLY)

View file

@ -127,6 +127,21 @@ public:
template <typename T> const T get(const std::string& prop) const template <typename T> const T get(const std::string& prop) const
{ {
#if defined(LEGACY_MACOS)
if (std::is_same<T, glm::vec2>::value)
return *(const T*)&properties.at(prop).v;
else if (std::is_same<T, std::string>::value)
return *(const T*)&properties.at(prop).s;
else if (std::is_same<T, unsigned int>::value)
return *(const T*)&properties.at(prop).i;
else if (std::is_same<T, float>::value)
return *(const T*)&properties.at(prop).f;
else if (std::is_same<T, bool>::value)
return *(const T*)&properties.at(prop).b;
else if (std::is_same<T, glm::vec4>::value)
return *(const T*)&properties.at(prop).r;
return T();
#else
if (std::is_same<T, glm::vec2>::value) if (std::is_same<T, glm::vec2>::value)
return std::any_cast<const T>(properties.at(prop).v); return std::any_cast<const T>(properties.at(prop).v);
else if (std::is_same<T, std::string>::value) else if (std::is_same<T, std::string>::value)
@ -140,6 +155,7 @@ public:
else if (std::is_same<T, glm::vec4>::value) else if (std::is_same<T, glm::vec4>::value)
return std::any_cast<const T>(properties.at(prop).r); return std::any_cast<const T>(properties.at(prop).r);
return T(); return T();
#endif
} }
bool has(const std::string& prop) const bool has(const std::string& prop) const