mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-12 02:58:59 +08:00
draco: StdioFileReader/Writer gcc 4.9/clang < 4 compatibility fix.
Fixes https://github.com/google/draco/issues/582
This commit is contained in:
parent
eed8cdf588
commit
b7fb7e5fba
@ -58,9 +58,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
|
||||
if((${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU"
|
||||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 5)
|
||||
message(WARNING "GNU/GCC VERSION LESS THAN 5, ENABLING COMPATIBILITY MODE.")
|
||||
OR (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang"
|
||||
AND ${CMAKE_CXX_COMPILER_VERSION} VERSION_LESS 4))
|
||||
message(WARNING
|
||||
"GNU/GCC < v5 or Clang/LLVM < v4, ENABLING COMPATIBILITY MODE.")
|
||||
draco_enable_feature(FEATURE "DRACO_OLD_GCC")
|
||||
endif()
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <io.h>
|
||||
#endif
|
||||
|
||||
#include "draco/draco_features.h"
|
||||
#include "draco/io/file_reader_factory.h"
|
||||
|
||||
namespace draco {
|
||||
@ -46,7 +47,11 @@ std::unique_ptr<FileReaderInterface> StdioFileReader::Open(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef DRACO_OLD_GCC
|
||||
return file;
|
||||
#else
|
||||
return std::move(file);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool StdioFileReader::ReadFileToBuffer(std::vector<char> *buffer) {
|
||||
|
@ -6,6 +6,7 @@
|
||||
#include <memory>
|
||||
#include <string>
|
||||
|
||||
#include "draco/draco_features.h"
|
||||
#include "draco/io/file_writer_factory.h"
|
||||
|
||||
namespace draco {
|
||||
@ -41,7 +42,11 @@ std::unique_ptr<FileWriterInterface> StdioFileWriter::Open(
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#ifndef DRACO_OLD_GCC
|
||||
return file;
|
||||
#else
|
||||
return std::move(file);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool StdioFileWriter::Write(const char *buffer, size_t size) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user