Fix MinGW builds (issues related to pragmas and format strings)
parent
67a710efad
commit
700d8e6614
|
@ -60,10 +60,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
|
||||
#include <time.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4706)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
namespace Assimp {
|
||||
|
||||
|
@ -825,8 +825,8 @@ void DumpSceneToAssbin(
|
|||
AssbinFileWriter fileWriter(shortened, compressed);
|
||||
fileWriter.WriteBinaryDump(pFile, cmd, pIOSystem, pScene);
|
||||
}
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
} // end of namespace Assimp
|
||||
|
|
|
@ -8,9 +8,9 @@ For details, see http://sourceforge.net/projects/libb64
|
|||
#ifndef BASE64_CENCODE_H
|
||||
#define BASE64_CENCODE_H
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4127 )
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
typedef enum
|
||||
{
|
||||
|
|
|
@ -57,10 +57,10 @@ namespace glTF {
|
|||
|
||||
namespace {
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4706)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
//
|
||||
// JSON Value reading helpers
|
||||
|
@ -372,7 +372,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
|
|||
|
||||
char val[val_size];
|
||||
|
||||
ai_snprintf(val, val_size, "%llu", (long long)pOffset);
|
||||
ai_snprintf(val, val_size, AI_SIZEFMT, pOffset);
|
||||
throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region.");
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
|
|||
|
||||
char val[val_size];
|
||||
|
||||
ai_snprintf(val, val_size, "%llu, %llu", (long long)pOffset, (long long)pEncodedData_Length);
|
||||
ai_snprintf(val, val_size, AI_SIZEFMT, AI_SIZEFMT, pOffset, pEncodedData_Length);
|
||||
throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range.");
|
||||
}
|
||||
|
||||
|
@ -1412,8 +1412,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi
|
|||
return id;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif // WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
} // namespace glTF
|
||||
|
|
|
@ -43,10 +43,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <rapidjson/writer.h>
|
||||
#include <rapidjson/prettywriter.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning( disable : 4706)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
namespace glTF {
|
||||
|
||||
|
@ -707,7 +707,7 @@ namespace glTF {
|
|||
w.WriteObjects(d);
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif // _WIN32
|
||||
|
||||
|
|
|
@ -190,10 +190,10 @@ inline void CopyValue(const glTFCommon::mat4 &v, aiMatrix4x4 &o) {
|
|||
o.d4 = v[15];
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable : 4310)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
inline std::string getCurrentAssetDir(const std::string &pFile) {
|
||||
std::string path = pFile;
|
||||
|
@ -204,9 +204,9 @@ inline std::string getCurrentAssetDir(const std::string &pFile) {
|
|||
|
||||
return path;
|
||||
}
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
namespace Util {
|
||||
|
||||
|
|
|
@ -525,6 +525,10 @@ void ExportSkin(Asset& mAsset, const aiMesh* aimesh, Ref<Mesh>& meshRef, Ref<Buf
|
|||
delete[] vertexJointData;
|
||||
}
|
||||
|
||||
#if __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
|
||||
#endif // __GNUC__
|
||||
|
||||
void glTFExporter::ExportMeshes()
|
||||
{
|
||||
// Not for
|
||||
|
@ -677,7 +681,7 @@ void glTFExporter::ExportMeshes()
|
|||
{
|
||||
#ifdef ASSIMP_IMPORTER_GLTF_USE_OPEN3DGC
|
||||
// Only one type of compression supported at now - Open3DGC.
|
||||
//
|
||||
//
|
||||
o3dgc::BinaryStream bs;
|
||||
o3dgc::SC3DMCEncoder<IndicesType> encoder;
|
||||
o3dgc::IndexedFaceSet<IndicesType> comp_o3dgc_ifs;
|
||||
|
@ -793,6 +797,10 @@ void glTFExporter::ExportMeshes()
|
|||
}
|
||||
}
|
||||
|
||||
#if __GNUC__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif // __GNUC__
|
||||
|
||||
/*
|
||||
* Export the root node of the node hierarchy.
|
||||
* Calls ExportNode for all children.
|
||||
|
|
|
@ -436,7 +436,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
|
|||
|
||||
char val[val_size];
|
||||
|
||||
ai_snprintf(val, val_size, "%llu", (long long)pOffset);
|
||||
ai_snprintf(val, val_size, AI_SIZEFMT, pOffset);
|
||||
throw DeadlyImportError(std::string("GLTF: incorrect offset value (") + val + ") for marking encoded region.");
|
||||
}
|
||||
|
||||
|
@ -446,7 +446,7 @@ inline void Buffer::EncodedRegion_Mark(const size_t pOffset, const size_t pEncod
|
|||
|
||||
char val[val_size];
|
||||
|
||||
ai_snprintf(val, val_size, "%llu, %llu", (long long)pOffset, (long long)pEncodedData_Length);
|
||||
ai_snprintf(val, val_size, AI_SIZEFMT, AI_SIZEFMT, pOffset, pEncodedData_Length);
|
||||
throw DeadlyImportError(std::string("GLTF: encoded region with offset/length (") + val + ") is out of range.");
|
||||
}
|
||||
|
||||
|
@ -1042,10 +1042,10 @@ inline int Compare(const char *attr, const char (&str)[N]) {
|
|||
return (strncmp(attr, str, N - 1) == 0) ? N - 1 : 0;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#if _MSC_VER
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4706)
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
inline bool GetAttribVector(Mesh::Primitive &p, const char *attr, Mesh::AccessorList *&v, int &pos) {
|
||||
if ((pos = Compare(attr, "POSITION"))) {
|
||||
|
@ -1723,8 +1723,8 @@ inline std::string Asset::FindUniqueID(const std::string &str, const char *suffi
|
|||
return id;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(pop)
|
||||
#endif // _WIN32
|
||||
#if _MSC_VER
|
||||
# pragma warning(pop)
|
||||
#endif // _MSC_VER
|
||||
|
||||
} // namespace glTF2
|
||||
|
|
|
@ -36,10 +36,10 @@
|
|||
|
||||
namespace p2t {
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning(push)
|
||||
# pragma warning( disable : 4702 )
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
// Triangulate simple polygon with holes
|
||||
void Sweep::Triangulate(SweepContext& tcx)
|
||||
|
@ -800,8 +800,8 @@ Sweep::~Sweep() {
|
|||
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
# pragma warning( pop )
|
||||
#endif // _WIN32
|
||||
#endif // _MSC_VER
|
||||
|
||||
}
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable : 4127 )
|
||||
#endif //_WIN32
|
||||
#endif //_MSC_VER
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
@ -319,6 +319,10 @@ extern int zip_extract(const char *zipname, const char *dir,
|
|||
|
||||
/** @} */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif //_MSC_VER
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -53,6 +53,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <stdarg.h>
|
||||
#include <cstdlib>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
# define AI_SIZEFMT "%Iu"
|
||||
#else
|
||||
# define AI_SIZEFMT "%zu"
|
||||
#endif
|
||||
|
||||
/// @fn ai_snprintf
|
||||
/// @brief The portable version of the function snprintf ( C99 standard ), which works on visual studio compilers 2013 and earlier.
|
||||
/// @param outBuf The buffer to write in
|
||||
|
@ -87,6 +93,8 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|||
return count;
|
||||
}
|
||||
|
||||
#elif defined(__MINGW32__)
|
||||
# define ai_snprintf __mingw_snprintf
|
||||
#else
|
||||
# define ai_snprintf snprintf
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue