Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/extern
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 22:14:50 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2011-11-07 22:14:50 +0400
commitae06ebcd95a63f44501b4ee30e120162f53e940a (patch)
tree0d03b38dd2d248fa848fe2ad491598a155f26da6 /extern
parentf3407e7d60d8000d71c66192d760bd5700345b21 (diff)
Hopefully compilation with MinGW will work again.
Tested with official MinGW and SCons, not sure how ti check it when using CMake.
Diffstat (limited to 'extern')
-rw-r--r--extern/libmv/CMakeLists.txt7
-rw-r--r--extern/libmv/SConscript4
-rwxr-xr-xextern/libmv/bundle.sh15
-rw-r--r--extern/libmv/libmv/multiview/euclidean_resection.cc2
-rw-r--r--extern/libmv/patches/mingw.patch158
-rw-r--r--extern/libmv/third_party/glog/src/config.h2
-rw-r--r--extern/libmv/third_party/glog/src/utilities.h4
-rw-r--r--extern/libmv/third_party/glog/src/windows/glog/logging.h18
-rw-r--r--extern/libmv/third_party/glog/src/windows/port.h37
9 files changed, 233 insertions, 14 deletions
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 41fc39c97ac..7ab01598cef 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -159,9 +159,14 @@ IF(WIN32)
list(APPEND INC
./third_party/glog/src/windows
- ./third_party/msinttypes
)
+ IF(NOT MINGW)
+ list(APPEND INC
+ ./third_party/msinttypes
+ )
+ ENDIF(NOT MINGW)
+
IF(MSVC)
set(MSVC_OFLAGS O1 O2 Ox)
foreach(FLAG )
diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript
index 1ffc6233c1d..60705e913f7 100644
--- a/extern/libmv/SConscript
+++ b/extern/libmv/SConscript
@@ -30,7 +30,9 @@ incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
- incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog ./third_party/msinttypes'
+ incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ incs += ' ./third_party/msinttypes'
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc']
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index c8df8ae7341..690f78df387 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -168,6 +168,16 @@ IF(WIN32)
list(APPEND INC
./third_party/glog/src/windows
+ )
+
+ IF(NOT MINGW)
+ list(APPEND INC
+ ./third_party/msinttypes
+ )
+ ENDIF(MINGW)
+
+ list(APPEND INC
+ ./third_party/glog/src/windows
./third_party/msinttypes
)
@@ -219,7 +229,10 @@ incs += ' ' + env['BF_PNG_INC']
incs += ' ' + env['BF_ZLIB_INC']
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
- incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog ./third_party/msinttypes'
+ incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+ incs += ' ./third_party/glog/src/windows ./third_party/glog/src/windows/glog'
+ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+ incs += ' ./third_party/msinttypes'
${win_src}
src += ['./third_party/glog/src/logging.cc', './third_party/glog/src/raw_logging.cc', './third_party/glog/src/utilities.cc', './third_party/glog/src/vlog_is_on.cc']
src += ['./third_party/glog/src/windows/port.cc']
diff --git a/extern/libmv/libmv/multiview/euclidean_resection.cc b/extern/libmv/libmv/multiview/euclidean_resection.cc
index 6d918a1a8bc..92862515d7e 100644
--- a/extern/libmv/libmv/multiview/euclidean_resection.cc
+++ b/extern/libmv/libmv/multiview/euclidean_resection.cc
@@ -32,6 +32,8 @@
namespace libmv {
namespace euclidean_resection {
+typedef unsigned int uint;
+
bool EuclideanResection(const Mat2X &x_camera,
const Mat3X &X_world,
Mat3 *R, Vec3 *t,
diff --git a/extern/libmv/patches/mingw.patch b/extern/libmv/patches/mingw.patch
index 0b08a483bea..029e7d7f979 100644
--- a/extern/libmv/patches/mingw.patch
+++ b/extern/libmv/patches/mingw.patch
@@ -1,3 +1,16 @@
+diff --git a/src/libmv/multiview/euclidean_resection.cc b/src/libmv/multiview/euclidean_resection.cc
+index 6d918a1..9286251 100644
+--- a/src/libmv/multiview/euclidean_resection.cc
++++ b/src/libmv/multiview/euclidean_resection.cc
+@@ -32,6 +32,8 @@
+ namespace libmv {
+ namespace euclidean_resection {
+
++typedef unsigned int uint;
++
+ bool EuclideanResection(const Mat2X &x_camera,
+ const Mat3X &X_world,
+ Mat3 *R, Vec3 *t,
diff --git a/src/libmv/numeric/numeric.h b/src/libmv/numeric/numeric.h
index f39d126..21e0f06 100644
--- a/src/libmv/numeric/numeric.h
@@ -11,3 +24,148 @@ index f39d126..21e0f06 100644
inline long lround(double d) {
return (long)(d>0 ? d+0.5 : ceil(d-0.5));
}
+diff --git a/src/third_party/glog/src/config.h b/src/third_party/glog/src/config.h
+index ed8d56e..06ed686 100644
+--- a/src/third_party/glog/src/config.h
++++ b/src/third_party/glog/src/config.h
+@@ -4,6 +4,8 @@
+ /* Namespace for Google classes */
+ #ifdef __APPLE__
+ #include "config_mac.h"
++#elif __MINGW32__
++ #include "windows/config.h"
+ #elif __GNUC__
+ #include "config_linux.h"
+ #elif _MSC_VER
+diff --git a/src/third_party/glog/src/utilities.h b/src/third_party/glog/src/utilities.h
+index ee54f94..c4ae256 100644
+--- a/src/third_party/glog/src/utilities.h
++++ b/src/third_party/glog/src/utilities.h
+@@ -101,7 +101,9 @@
+ // correctly when GetStackTrace() is called with max_depth == 0.
+ // Some code may do that.
+
+-#if defined(HAVE_LIB_UNWIND)
++#if __MINGW32__
++# undef STACKTRACE_H
++#elif defined(HAVE_LIB_UNWIND)
+ # define STACKTRACE_H "stacktrace_libunwind-inl.h"
+ #elif !defined(NO_FRAME_POINTER)
+ # if defined(__i386__) && __GNUC__ >= 2
+diff --git a/src/third_party/glog/src/windows/glog/logging.h b/src/third_party/glog/src/windows/glog/logging.h
+index 7a6df74..4257375 100755
+--- a/src/third_party/glog/src/windows/glog/logging.h
++++ b/src/third_party/glog/src/windows/glog/logging.h
+@@ -59,7 +59,7 @@
+
+ // Annoying stuff for windows -- makes sure clients can import these functions
+ #ifndef GOOGLE_GLOG_DLL_DECL
+-# if defined(_WIN32) && !defined(__CYGWIN__)
++# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
+ # define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
+ # else
+ # define GOOGLE_GLOG_DLL_DECL
+@@ -86,6 +86,15 @@
+ #include <gflags/gflags.h>
+ #endif
+
++#ifdef __MINGW32__
++# include <stdlib.h>
++# include <unistd.h>
++# include <stdint.h> // the normal place uint16_t is defined
++# include <sys/types.h> // the normal place u_int16_t is defined
++# include <inttypes.h> // a third place for uint16_t or u_int16_t
++# define _exit(x) exit(x)
++#endif
++
+ namespace google {
+
+ #if 0 // the C99 format
+@@ -98,11 +107,16 @@ typedef int32_t int32;
+ typedef u_int32_t uint32;
+ typedef int64_t int64;
+ typedef u_int64_t uint64;
+-#elif 1 // the windows (vc7) format
++#elif defined(_MSC_VER)
+ typedef __int32 int32;
+ typedef unsigned __int32 uint32;
+ typedef __int64 int64;
+ typedef unsigned __int64 uint64;
++#elif defined(__MINGW32__)
++typedef int32_t int32;
++typedef uint32_t uint32;
++typedef int64_t int64;
++typedef uint64_t uint64;
+ #else
+ #error Do not know how to define a 32-bit integer quantity on your system
+ #endif
+diff --git a/src/third_party/glog/src/windows/port.h b/src/third_party/glog/src/windows/port.h
+index d093bf5..d507812 100755
+--- a/src/third_party/glog/src/windows/port.h
++++ b/src/third_party/glog/src/windows/port.h
+@@ -59,14 +59,16 @@
+ * used by both C and C++ code, so we put all the C++ together.
+ */
+
+-/* 4244: otherwise we get problems when substracting two size_t's to an int
+- * 4251: it's complaining about a private struct I've chosen not to dllexport
+- * 4355: we use this in a constructor, but we do it safely
+- * 4715: for some reason VC++ stopped realizing you can't return after abort()
+- * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
+- * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
+- */
+-#pragma warning(disable:4244 4251 4355 4715 4800 4996)
++#if _MSC_VER
++ /* 4244: otherwise we get problems when substracting two size_t's to an int
++ * 4251: it's complaining about a private struct I've chosen not to dllexport
++ * 4355: we use this in a constructor, but we do it safely
++ * 4715: for some reason VC++ stopped realizing you can't return after abort()
++ * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
++ * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
++ */
++# pragma warning(disable:4244 4251 4355 4715 4800 4996)
++#endif
+
+ /* file I/O */
+ #define PATH_MAX 1024
+@@ -108,7 +110,9 @@ extern int snprintf(char *str, size_t size,
+ extern int safe_vsnprintf(char *str, size_t size,
+ const char *format, va_list ap);
+ #define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
++#if !defined(__MINGW32__)
+ #define va_copy(dst, src) (dst) = (src)
++#endif
+
+ /* Windows doesn't support specifying the number of buckets as a
+ * hash_map constructor arg, so we leave this blank.
+@@ -130,13 +134,30 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
+ #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
+
+ inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
++#if __MINGW32__
++ struct tm *local_result;
++ local_result = localtime (timep);
++
++ if (local_result == NULL || result == NULL)
++ return NULL;
++
++ memcpy (result, local_result, sizeof (result));
++
++ return result;
++#else
+ localtime_s(result, timep);
+ return result;
++#endif
+ }
+
+ inline char* strerror_r(int errnum, char* buf, size_t buflen) {
++#if __MINGW32__
++ strncpy(buf, "Not implemented yet", buflen);
++ return buf;
++#else
+ strerror_s(buf, buflen, errnum);
+ return buf;
++#endif
+ }
+
+ #ifndef __cplusplus
diff --git a/extern/libmv/third_party/glog/src/config.h b/extern/libmv/third_party/glog/src/config.h
index ed8d56e7799..06ed686f87c 100644
--- a/extern/libmv/third_party/glog/src/config.h
+++ b/extern/libmv/third_party/glog/src/config.h
@@ -4,6 +4,8 @@
/* Namespace for Google classes */
#ifdef __APPLE__
#include "config_mac.h"
+#elif __MINGW32__
+ #include "windows/config.h"
#elif __GNUC__
#include "config_linux.h"
#elif _MSC_VER
diff --git a/extern/libmv/third_party/glog/src/utilities.h b/extern/libmv/third_party/glog/src/utilities.h
index 2d4e99e595e..5c841a0b90b 100644
--- a/extern/libmv/third_party/glog/src/utilities.h
+++ b/extern/libmv/third_party/glog/src/utilities.h
@@ -101,7 +101,9 @@
// correctly when GetStackTrace() is called with max_depth == 0.
// Some code may do that.
-#if defined(HAVE_LIB_UNWIND)
+#if __MINGW32__
+# undef STACKTRACE_H
+#elif defined(HAVE_LIB_UNWIND)
# define STACKTRACE_H "stacktrace_libunwind-inl.h"
#elif !defined(NO_FRAME_POINTER)
# if defined(__i386__) && __GNUC__ >= 2
diff --git a/extern/libmv/third_party/glog/src/windows/glog/logging.h b/extern/libmv/third_party/glog/src/windows/glog/logging.h
index de51586f8e3..2f41681edbe 100644
--- a/extern/libmv/third_party/glog/src/windows/glog/logging.h
+++ b/extern/libmv/third_party/glog/src/windows/glog/logging.h
@@ -59,7 +59,7 @@
// Annoying stuff for windows -- makes sure clients can import these functions
#ifndef GOOGLE_GLOG_DLL_DECL
-# if defined(_WIN32) && !defined(__CYGWIN__)
+# if defined(_WIN32) && !defined(__CYGWIN__) && !defined(__MINGW32__)
# define GOOGLE_GLOG_DLL_DECL __declspec(dllimport)
# else
# define GOOGLE_GLOG_DLL_DECL
@@ -86,6 +86,15 @@
#include "third_party/gflags/gflags.h"
#endif
+#ifdef __MINGW32__
+# include <stdlib.h>
+# include <unistd.h>
+# include <stdint.h> // the normal place uint16_t is defined
+# include <sys/types.h> // the normal place u_int16_t is defined
+# include <inttypes.h> // a third place for uint16_t or u_int16_t
+# define _exit(x) exit(x)
+#endif
+
namespace google {
#if 0 // the C99 format
@@ -98,11 +107,16 @@ typedef int32_t int32;
typedef u_int32_t uint32;
typedef int64_t int64;
typedef u_int64_t uint64;
-#elif 1 // the windows (vc7) format
+#elif defined(_MSC_VER)
typedef __int32 int32;
typedef unsigned __int32 uint32;
typedef __int64 int64;
typedef unsigned __int64 uint64;
+#elif defined(__MINGW32__)
+typedef int32_t int32;
+typedef uint32_t uint32;
+typedef int64_t int64;
+typedef uint64_t uint64;
#else
#error Do not know how to define a 32-bit integer quantity on your system
#endif
diff --git a/extern/libmv/third_party/glog/src/windows/port.h b/extern/libmv/third_party/glog/src/windows/port.h
index d093bf5d34c..d5078120009 100644
--- a/extern/libmv/third_party/glog/src/windows/port.h
+++ b/extern/libmv/third_party/glog/src/windows/port.h
@@ -59,14 +59,16 @@
* used by both C and C++ code, so we put all the C++ together.
*/
-/* 4244: otherwise we get problems when substracting two size_t's to an int
- * 4251: it's complaining about a private struct I've chosen not to dllexport
- * 4355: we use this in a constructor, but we do it safely
- * 4715: for some reason VC++ stopped realizing you can't return after abort()
- * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
- * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
- */
-#pragma warning(disable:4244 4251 4355 4715 4800 4996)
+#if _MSC_VER
+ /* 4244: otherwise we get problems when substracting two size_t's to an int
+ * 4251: it's complaining about a private struct I've chosen not to dllexport
+ * 4355: we use this in a constructor, but we do it safely
+ * 4715: for some reason VC++ stopped realizing you can't return after abort()
+ * 4800: we know we're casting ints/char*'s to bools, and we're ok with that
+ * 4996: Yes, we're ok using "unsafe" functions like fopen() and strerror()
+ */
+# pragma warning(disable:4244 4251 4355 4715 4800 4996)
+#endif
/* file I/O */
#define PATH_MAX 1024
@@ -108,7 +110,9 @@ extern int snprintf(char *str, size_t size,
extern int safe_vsnprintf(char *str, size_t size,
const char *format, va_list ap);
#define vsnprintf(str, size, format, ap) safe_vsnprintf(str, size, format, ap)
+#if !defined(__MINGW32__)
#define va_copy(dst, src) (dst) = (src)
+#endif
/* Windows doesn't support specifying the number of buckets as a
* hash_map constructor arg, so we leave this blank.
@@ -130,13 +134,30 @@ enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock
#define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2))
inline struct tm* localtime_r(const time_t* timep, struct tm* result) {
+#if __MINGW32__
+ struct tm *local_result;
+ local_result = localtime (timep);
+
+ if (local_result == NULL || result == NULL)
+ return NULL;
+
+ memcpy (result, local_result, sizeof (result));
+
+ return result;
+#else
localtime_s(result, timep);
return result;
+#endif
}
inline char* strerror_r(int errnum, char* buf, size_t buflen) {
+#if __MINGW32__
+ strncpy(buf, "Not implemented yet", buflen);
+ return buf;
+#else
strerror_s(buf, buflen, errnum);
return buf;
+#endif
}
#ifndef __cplusplus