Merge pull request #551 from google/gcc_4_8_hax

Add workaround for rvalue reference overload issues in gcc 4.8.
This commit is contained in:
igorvytyaz 2019-09-06 11:59:15 -07:00 committed by GitHub
commit 967e8390f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View File

@ -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")

View File

@ -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>

View File

@ -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,