forked from bartvdbraak/blender
Hopefully compilation with MinGW will work again.
Tested with official MinGW and SCons, not sure how ti check it when using CMake.
This commit is contained in:
parent
f3407e7d60
commit
ae06ebcd95
7
extern/libmv/CMakeLists.txt
vendored
7
extern/libmv/CMakeLists.txt
vendored
@ -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 )
|
||||
|
4
extern/libmv/SConscript
vendored
4
extern/libmv/SConscript
vendored
@ -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']
|
||||
|
15
extern/libmv/bundle.sh
vendored
15
extern/libmv/bundle.sh
vendored
@ -166,6 +166,16 @@ IF(WIN32)
|
||||
third_party/glog/src/windows/config.h
|
||||
)
|
||||
|
||||
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']
|
||||
|
@ -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,
|
||||
|
158
extern/libmv/patches/mingw.patch
vendored
158
extern/libmv/patches/mingw.patch
vendored
@ -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
|
||||
|
2
extern/libmv/third_party/glog/src/config.h
vendored
2
extern/libmv/third_party/glog/src/config.h
vendored
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
37
extern/libmv/third_party/glog/src/windows/port.h
vendored
37
extern/libmv/third_party/glog/src/windows/port.h
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user