diff options
author | Tomi Korpipaa <tomi.korpipaa@qt.io> | 2019-06-06 08:39:28 +0300 |
---|---|---|
committer | Tomi Korpipää <tomi.korpipaa@qt.io> | 2019-06-06 09:50:54 +0000 |
commit | f2f5bee89459331ce8593e6d15342d00bab03af7 (patch) | |
tree | a6b8cc766327efaf708a15cf424a0bbb8eacd621 | |
parent | 7c7d1bab302c9101695026936a946adf6ecf2824 (diff) |
Fix ColladaDOM compilation for mingw
Change-Id: I7c58700203c36e5f93f2a405eefaf13475d71bbc
Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
-rw-r--r-- | 2.4.0/CMakeLists.txt | 10 | ||||
-rw-r--r-- | 2.4.0/dom/include/dae/daeUtils.h | 198 | ||||
-rw-r--r-- | 2.4.0/dom/include/dae/daeWin32Platform.h | 96 | ||||
-rw-r--r-- | 2.4.0/dom/src/dae/daeUtils.cpp | 6 |
4 files changed, 158 insertions, 152 deletions
diff --git a/2.4.0/CMakeLists.txt b/2.4.0/CMakeLists.txt index 25263d1..d82fa4f 100644 --- a/2.4.0/CMakeLists.txt +++ b/2.4.0/CMakeLists.txt @@ -175,8 +175,8 @@ foreach(ldir ${Boost_LIBRARY_DIRS}) set(COLLADA_DOM_BOOST_LIB_DIRS "${COLLADA_DOM_BOOST_LIB_DIRS} -L${ldir}") endforeach() -if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) - set(EXTRA_COMPILE_FLAGS "${COLLADA_DOM_EXTERNAL_FLAGS} -DCOLLADA_DOM_NAMESPACE -fPIC") +if((CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) AND NOT MINGW) + set(EXTRA_COMPILE_FLAGS "${COLLADA_DOM_EXTERNAL_FLAGS} -DCOLLADA_DOM_NAMESPACE -fPIC") else() set(EXTRA_COMPILE_FLAGS "${COLLADA_DOM_EXTERNAL_FLAGS} -DCOLLADA_DOM_NAMESPACE") endif() @@ -251,20 +251,20 @@ link_directories(${COLLADA_DOM_LINK_DIRS}) add_subdirectory(dom) -if(UNIX) +if(UNIX OR MINGW) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/collada-dom.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/collada-dom.pc" @ONLY IMMEDIATE) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/collada-dom.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT ${COMPONENT_PREFIX}-dev) endif() if( OPT_COLLADA15 ) - if(UNIX) + if(UNIX OR MINGW) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/collada-dom-150.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/collada-dom-150.pc" @ONLY IMMEDIATE) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/collada-dom-150.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT ${COMPONENT_PREFIX}-dev) endif() endif() if( OPT_COLLADA14 ) - if(UNIX) + if(UNIX OR MINGW) configure_file("${CMAKE_CURRENT_SOURCE_DIR}/collada-dom-141.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/collada-dom-141.pc" @ONLY IMMEDIATE) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/collada-dom-141.pc DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT ${COMPONENT_PREFIX}-dev) endif() diff --git a/2.4.0/dom/include/dae/daeUtils.h b/2.4.0/dom/include/dae/daeUtils.h index def2147..c523e75 100644 --- a/2.4.0/dom/include/dae/daeUtils.h +++ b/2.4.0/dom/include/dae/daeUtils.h @@ -4,101 +4,103 @@ * Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
-*/ -// A home for commonly used utility functions. These are mostly for internal DOM -// use, but the automated tests use some of these functions, so we'll export -// them. -#ifndef daeUtils_h -#define daeUtils_h - -#include <string> -#include <sstream> -#include <list> -#include <vector> -#include <dae/daePlatform.h> - -namespace cdom { - // System type info. We only need to distinguish between Posix and Winodws for now. - enum systemType { - Posix, - Windows - }; - - // Get the system type at runtime. - DLLSPEC systemType getSystemType(); - - // String replace function. Usage: replace("abcdef", "cd", "12") --> "ab12ef". - DLLSPEC std::string replace(const std::string& s, - const std::string& replace, - const std::string& replaceWith); - - // Removes whitespaces (" \t\f\v\n\r") at the beginning and the end of str. - // If str consists of whitespaces only it will be erased. - // Usage: - // trimWhitespaces(" a b") --> "a b" - // trimWhitespaces("a b ") --> "a b" - // trimWhitespaces(" a b ") --> "a b" - // trimWhitespaces(" ") --> "" - DLLSPEC void trimWhitespaces(std::string& str); - - // Usage: - // tokenize("this/is some#text", "/#", true) --> ("this" "/" "is some" "#" "text") - // tokenize("this is some text", " ", false) --> ("this" "is" "some" "text") - DLLSPEC std::list<std::string> tokenize(const std::string& s, - const std::string& separators, - bool separatorsInResult = false); - // Same as the previous function, but returns the result via a parameter to avoid an object copy. - DLLSPEC void tokenize(const std::string& s, - const std::string& separators, - /* out */ std::list<std::string>& tokens, - bool separatorsInResult = false); - - typedef std::list<std::string>::iterator tokenIter; - - DLLSPEC std::vector<std::string> makeStringArray(const char* s, ...); - DLLSPEC std::list<std::string> makeStringList(const char* s, ...); - - DLLSPEC std::string getCurrentDir(); - DLLSPEC std::string getCurrentDirAsUri(); - - // Returns platform specific file separator. - // \ on windows - // / on other platforms - DLLSPEC char getFileSeparator(); - -#ifndef NO_BOOST - // Returns system wide temporary directory. - // Reads environment variable TMP. - DLLSPEC const std::string& getSystemTmpDir(); - - // Returns a filename obtained via tmpnam(). - // On systems where tmpnam()'s result is preceded - // with a directory, that directory is cutoff. - DLLSPEC std::string getRandomFileName(); - - // Returns getSystemTmpDir() appended with a randomly - // generated directory name. - // This directory will be deleted when DAE gets destroyed. - DLLSPEC const std::string& getSafeTmpDir(); -#endif //NO_BOOST - - DLLSPEC int strcasecmp(const char* str1, const char* str2); - DLLSPEC std::string tolower(const std::string& s); - - // Disable VS warning -#ifdef _MSC_VER -#pragma warning(push) -#pragma warning(disable : 4267) -#endif - template<typename T> - std::string toString(const T& val) { - std::ostringstream stream; - stream << val; - return stream.str(); - } -#ifdef _MSC_VER -#pragma warning(pop) -#endif -} - -#endif +*/
+// A home for commonly used utility functions. These are mostly for internal DOM
+// use, but the automated tests use some of these functions, so we'll export
+// them.
+#ifndef daeUtils_h
+#define daeUtils_h
+
+#include <string>
+#include <sstream>
+#include <list>
+#include <vector>
+#include <dae/daePlatform.h>
+
+namespace cdom {
+ // System type info. We only need to distinguish between Posix and Winodws for now.
+ enum systemType {
+ Posix,
+ Windows
+ };
+
+ // Get the system type at runtime.
+ DLLSPEC systemType getSystemType();
+
+ // String replace function. Usage: replace("abcdef", "cd", "12") --> "ab12ef".
+ DLLSPEC std::string replace(const std::string& s,
+ const std::string& replace,
+ const std::string& replaceWith);
+
+ // Removes whitespaces (" \t\f\v\n\r") at the beginning and the end of str.
+ // If str consists of whitespaces only it will be erased.
+ // Usage:
+ // trimWhitespaces(" a b") --> "a b"
+ // trimWhitespaces("a b ") --> "a b"
+ // trimWhitespaces(" a b ") --> "a b"
+ // trimWhitespaces(" ") --> ""
+ DLLSPEC void trimWhitespaces(std::string& str);
+
+ // Usage:
+ // tokenize("this/is some#text", "/#", true) --> ("this" "/" "is some" "#" "text")
+ // tokenize("this is some text", " ", false) --> ("this" "is" "some" "text")
+ DLLSPEC std::list<std::string> tokenize(const std::string& s,
+ const std::string& separators,
+ bool separatorsInResult = false);
+ // Same as the previous function, but returns the result via a parameter to avoid an object copy.
+ DLLSPEC void tokenize(const std::string& s,
+ const std::string& separators,
+ /* out */ std::list<std::string>& tokens,
+ bool separatorsInResult = false);
+
+ typedef std::list<std::string>::iterator tokenIter;
+
+ DLLSPEC std::vector<std::string> makeStringArray(const char* s, ...);
+ DLLSPEC std::list<std::string> makeStringList(const char* s, ...);
+
+ DLLSPEC std::string getCurrentDir();
+ DLLSPEC std::string getCurrentDirAsUri();
+
+ // Returns platform specific file separator.
+ // \ on windows
+ // / on other platforms
+ DLLSPEC char getFileSeparator();
+
+#ifndef NO_BOOST
+ // Returns system wide temporary directory.
+ // Reads environment variable TMP.
+ DLLSPEC const std::string& getSystemTmpDir();
+
+ // Returns a filename obtained via tmpnam().
+ // On systems where tmpnam()'s result is preceded
+ // with a directory, that directory is cutoff.
+ DLLSPEC std::string getRandomFileName();
+
+ // Returns getSystemTmpDir() appended with a randomly
+ // generated directory name.
+ // This directory will be deleted when DAE gets destroyed.
+ DLLSPEC const std::string& getSafeTmpDir();
+#endif //NO_BOOST
+
+#ifndef __MINGW64_VERSION_MAJOR
+ DLLSPEC int strcasecmp(const char* str1, const char* str2);
+#endif
+ DLLSPEC std::string tolower(const std::string& s);
+
+ // Disable VS warning
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4267)
+#endif
+ template<typename T>
+ std::string toString(const T& val) {
+ std::ostringstream stream;
+ stream << val;
+ return stream.str();
+ }
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+}
+
+#endif
diff --git a/2.4.0/dom/include/dae/daeWin32Platform.h b/2.4.0/dom/include/dae/daeWin32Platform.h index 7589f16..bd6087d 100644 --- a/2.4.0/dom/include/dae/daeWin32Platform.h +++ b/2.4.0/dom/include/dae/daeWin32Platform.h @@ -4,50 +4,52 @@ * Licensed under the MIT Open Source License, for details please see license.txt or the website
* http://www.opensource.org/licenses/mit-license.php
*
-*/ - -#ifndef __DAE_WIN32_PLATFORM_H__ -#define __DAE_WIN32_PLATFORM_H__ - -#define PLATFORM_INT8 __int8 -#define PLATFORM_INT16 __int16 -#define PLATFORM_INT32 __int32 -#define PLATFORM_INT64 __int64 -#define PLATFORM_UINT8 unsigned __int8 -#define PLATFORM_UINT16 unsigned __int16 -#define PLATFORM_UINT32 unsigned __int32 -#define PLATFORM_UINT64 unsigned __int64 -#define PLATFORM_FLOAT32 float -#define PLATFORM_FLOAT64 double - -#if _MSC_VER <= 1200 -typedef int intptr_t; -#endif - -#ifdef DOM_DYNAMIC - -#ifdef DOM_EXPORT -#define DLLSPEC __declspec( dllexport ) -#else -#define DLLSPEC __declspec( dllimport ) -#endif - -#else -#define DLLSPEC -#endif - -// GCC doesn't understand "#pragma warning" -#ifdef _MSC_VER -// class 'std::auto_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'daeErrorHandler' -#pragma warning(disable: 4251) -// warning C4100: 'profile' : unreferenced formal parameter -#pragma warning(disable: 4100) -// warning C4355: 'this' : used in base member initializer list -#pragma warning(disable: 4355) -// warning C4512: 'daeDatabase' : assignment operator could not be generated -#pragma warning(disable: 4512) -// warning LNK4099: Missing pdb file for PCRE -#pragma warning(disable: 4099) -#endif - -#endif +*/
+
+#ifndef __DAE_WIN32_PLATFORM_H__
+#define __DAE_WIN32_PLATFORM_H__
+
+#define PLATFORM_INT8 __int8
+#define PLATFORM_INT16 __int16
+#define PLATFORM_INT32 __int32
+#define PLATFORM_INT64 __int64
+#define PLATFORM_UINT8 unsigned __int8
+#define PLATFORM_UINT16 unsigned __int16
+#define PLATFORM_UINT32 unsigned __int32
+#define PLATFORM_UINT64 unsigned __int64
+#define PLATFORM_FLOAT32 float
+#define PLATFORM_FLOAT64 double
+
+#ifndef __MINGW32__
+#if _MSC_VER <= 1200
+typedef int intptr_t;
+#endif
+#endif
+
+#ifdef DOM_DYNAMIC
+
+#ifdef DOM_EXPORT
+#define DLLSPEC __declspec( dllexport )
+#else
+#define DLLSPEC __declspec( dllimport )
+#endif
+
+#else
+#define DLLSPEC
+#endif
+
+// GCC doesn't understand "#pragma warning"
+#ifdef _MSC_VER
+// class 'std::auto_ptr<_Ty>' needs to have dll-interface to be used by clients of class 'daeErrorHandler'
+#pragma warning(disable: 4251)
+// warning C4100: 'profile' : unreferenced formal parameter
+#pragma warning(disable: 4100)
+// warning C4355: 'this' : used in base member initializer list
+#pragma warning(disable: 4355)
+// warning C4512: 'daeDatabase' : assignment operator could not be generated
+#pragma warning(disable: 4512)
+// warning LNK4099: Missing pdb file for PCRE
+#pragma warning(disable: 4099)
+#endif
+
+#endif
diff --git a/2.4.0/dom/src/dae/daeUtils.cpp b/2.4.0/dom/src/dae/daeUtils.cpp index 7e3dc9a..b6e4e17 100644 --- a/2.4.0/dom/src/dae/daeUtils.cpp +++ b/2.4.0/dom/src/dae/daeUtils.cpp @@ -195,13 +195,15 @@ const string& cdom::getSafeTmpDir() { } #endif //NO_BOOST +#ifndef __MINGW64_VERSION_MAJOR int cdom::strcasecmp(const char* str1, const char* str2) { #ifdef _MSC_VER - return _stricmp(str1, str2); + return _stricmp(str1, str2); #else - return ::strcasecmp(str1, str2); + return ::strcasecmp(str1, str2); #endif } +#endif string cdom::tolower(const string& s) { string result; |