mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-08-12 21:49:05 +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_MAYA_PLUGIN "Build plugin library for Maya." OFF)
|
||||||
option(BUILD_USD_PLUGIN "Build plugin library for USD." 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)
|
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")
|
draco_enable_feature(FEATURE "DRACO_OLD_GCC")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -11,6 +11,7 @@
|
|||||||
#include <io.h>
|
#include <io.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include "draco/draco_features.h"
|
||||||
#include "draco/io/file_reader_factory.h"
|
#include "draco/io/file_reader_factory.h"
|
||||||
|
|
||||||
namespace draco {
|
namespace draco {
|
||||||
@ -46,7 +47,11 @@ std::unique_ptr<FileReaderInterface> StdioFileReader::Open(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DRACO_OLD_GCC
|
||||||
return file;
|
return file;
|
||||||
|
#else
|
||||||
|
return std::move(file);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StdioFileReader::ReadFileToBuffer(std::vector<char> *buffer) {
|
bool StdioFileReader::ReadFileToBuffer(std::vector<char> *buffer) {
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include "draco/draco_features.h"
|
||||||
#include "draco/io/file_writer_factory.h"
|
#include "draco/io/file_writer_factory.h"
|
||||||
|
|
||||||
namespace draco {
|
namespace draco {
|
||||||
@ -41,7 +42,11 @@ std::unique_ptr<FileWriterInterface> StdioFileWriter::Open(
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef DRACO_OLD_GCC
|
||||||
return file;
|
return file;
|
||||||
|
#else
|
||||||
|
return std::move(file);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
bool StdioFileWriter::Write(const char *buffer, size_t size) {
|
bool StdioFileWriter::Write(const char *buffer, size_t size) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user