mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-11 17:19:08 +08:00
Add workaround for rvalue reference overload issues in gcc 4.8.
This commit is contained in:
parent
dd5aaf0ae4
commit
823b536243
@ -56,6 +56,12 @@ option(BUILD_FOR_GLTF "" OFF)
|
||||
option(BUILD_MAYA_PLUGIN "Build plugin library for Maya." OFF)
|
||||
option(BUILD_USD_PLUGIN "Build plugin library for USD." OFF)
|
||||
|
||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES GNU
|
||||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5)
|
||||
message(WARNING "GNU/GCC VERSION LESS THAN 5, ENABLING COMPATIBILITY MODE.")
|
||||
draco_enable_feature(FEATURE "DRACO_OLD_GCC")
|
||||
endif()
|
||||
|
||||
if(BUILD_FOR_GLTF)
|
||||
# Override settings when building for GLTF.
|
||||
draco_enable_feature(FEATURE "DRACO_MESH_COMPRESSION_SUPPORTED")
|
||||
|
@ -95,8 +95,11 @@ class DynamicIntegerPointsKdTreeDecoder {
|
||||
// Decodes a integer point cloud from |buffer|.
|
||||
template <class OutputIteratorT>
|
||||
bool DecodePoints(DecoderBuffer *buffer, OutputIteratorT &oit);
|
||||
|
||||
#ifndef DRACO_OLD_GCC
|
||||
template <class OutputIteratorT>
|
||||
bool DecodePoints(DecoderBuffer *buffer, OutputIteratorT &&oit);
|
||||
#endif // DRACO_OLD_GCC
|
||||
|
||||
const uint32_t dimension() const { return dimension_; }
|
||||
|
||||
@ -138,6 +141,7 @@ class DynamicIntegerPointsKdTreeDecoder {
|
||||
};
|
||||
|
||||
// Decodes a point cloud from |buffer|.
|
||||
#ifndef DRACO_OLD_GCC
|
||||
template <int compression_level_t>
|
||||
template <class OutputIteratorT>
|
||||
bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodePoints(
|
||||
@ -145,6 +149,7 @@ bool DynamicIntegerPointsKdTreeDecoder<compression_level_t>::DecodePoints(
|
||||
OutputIteratorT local = std::forward<OutputIteratorT>(oit);
|
||||
return DecodePoints(buffer, local);
|
||||
}
|
||||
#endif // DRACO_OLD_GCC
|
||||
|
||||
template <int compression_level_t>
|
||||
template <class OutputIteratorT>
|
||||
|
@ -33,8 +33,12 @@ class FloatPointsTreeDecoder {
|
||||
// Decodes a point cloud from |buffer|.
|
||||
template <class OutputIteratorT>
|
||||
bool DecodePointCloud(DecoderBuffer *buffer, OutputIteratorT &out);
|
||||
|
||||
#ifndef DRACO_OLD_GCC
|
||||
template <class OutputIteratorT>
|
||||
bool DecodePointCloud(DecoderBuffer *buffer, OutputIteratorT &&out);
|
||||
#endif // BUILD_OLD_GCC
|
||||
|
||||
// Initializes a DecoderBuffer from |data|, and calls function above.
|
||||
template <class OutputIteratorT>
|
||||
bool DecodePointCloud(const char *data, size_t data_size,
|
||||
@ -72,12 +76,16 @@ class FloatPointsTreeDecoder {
|
||||
uint32_t compression_level_;
|
||||
};
|
||||
|
||||
#ifndef DRACO_OLD_GCC
|
||||
// TODO(vytyaz): Reenable once USD migrates from GCC 4.8 to a higher version
|
||||
// that can disambiguate calls to overloaded methods taking rvalue reference.
|
||||
template <class OutputIteratorT>
|
||||
bool FloatPointsTreeDecoder::DecodePointCloud(DecoderBuffer *buffer,
|
||||
OutputIteratorT &&out) {
|
||||
OutputIteratorT local = std::forward<OutputIteratorT>(out);
|
||||
return DecodePointCloud(buffer, local);
|
||||
}
|
||||
#endif // BUILD_OLD_GCC
|
||||
|
||||
template <class OutputIteratorT>
|
||||
bool FloatPointsTreeDecoder::DecodePointCloud(DecoderBuffer *buffer,
|
||||
|
Loading…
x
Reference in New Issue
Block a user