[Bf-blender-cvs] [bca434d] master: Hopefully fix compilation error after recent update

Sergey Sharybin noreply at git.blender.org
Wed Dec 31 12:49:17 CET 2014


Commit: bca434de78b4069c0597697a0893bbde7702c40b
Author: Sergey Sharybin
Date:   Wed Dec 31 16:34:22 2014 +0500
Branches: master
https://developer.blender.org/rBbca434de78b4069c0597697a0893bbde7702c40b

Hopefully fix compilation error after recent update

===================================================================

M	extern/libmv/CMakeLists.txt
M	extern/libmv/SConscript
M	extern/libmv/bundle.sh
M	extern/libmv/files.txt
A	extern/libmv/third_party/gflags/windows_port.cc
A	extern/libmv/third_party/gflags/windows_port.h

===================================================================

diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 4528c0b..80e6404 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -307,6 +307,9 @@ if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
 			third_party/glog/src/windows/glog/log_severity.h
 			third_party/glog/src/windows/port.h
 			third_party/glog/src/windows/config.h
+
+			third_party/gflags/windows_port.cc
+			third_party/gflags/windows_port.h
 		)
 	else()
 		list(APPEND GLOG_SRC
diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript
index 6211bf6..251e583 100644
--- a/extern/libmv/SConscript
+++ b/extern/libmv/SConscript
@@ -47,7 +47,6 @@ if env['WITH_BF_LIBMV']:
     src += env.Glob('libmv/numeric/*.cc')
     src += env.Glob('libmv/simple_pipeline/*.cc')
     src += env.Glob('libmv/tracking/*.cc')
-    src += env.Glob('third_party/gflags/*.cc')
 else:
     src = env.Glob("intern/stub.cc")
 
@@ -57,10 +56,12 @@ env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defi
 
 if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
     glog_src = []
+    glog_src += env.Glob("third_party/gflags/*.cc")
     if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         glog_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']
         glog_src += ['./third_party/glog/src/windows/port.cc']
     else:
+        glog_src.remove('third_party/gflags/windows_port.cc')
         glog_src += env.Glob("third_party/glog/src/*.cc")
 
     env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index f8aaaa9..c10a5fb 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -75,7 +75,7 @@ for x in $src_dir $src_third_dir; do
     fi
   fi
 
-  if test `echo $x | grep -c windows ` -eq 0; then
+  if test `echo $x | grep -c "windows\|gflags" ` -eq 0; then
     if [ -z "$src" ]; then
       src=$t
     else
@@ -262,6 +262,9 @@ ${third_gflags_headers}
 			third_party/glog/src/windows/glog/log_severity.h
 			third_party/glog/src/windows/port.h
 			third_party/glog/src/windows/config.h
+
+			third_party/gflags/windows_port.cc
+			third_party/gflags/windows_port.h
 		)
 	else()
 		list(APPEND GLOG_SRC
@@ -328,10 +331,12 @@ env.BlenderLib(libname = 'extern_libmv', sources=src, includes=Split(incs), defi
 
 if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']):
     glog_src = []
+    glog_src += env.Glob("third_party/gflags/*.cc")
     if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
         glog_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']
         glog_src += ['./third_party/glog/src/windows/port.cc']
     else:
+        glog_src.remove('third_party/gflags/windows_port.cc')
         glog_src += env.Glob("third_party/glog/src/*.cc")
 
     env.BlenderLib(libname = 'extern_glog', sources=glog_src, includes=Split(incs), defines=defs, libtype=['extern', 'player'], priority=[20,137])
diff --git a/extern/libmv/files.txt b/extern/libmv/files.txt
index 91a529b..11f8ef2 100644
--- a/extern/libmv/files.txt
+++ b/extern/libmv/files.txt
@@ -147,6 +147,8 @@ third_party/gflags/mutex.h
 third_party/gflags/NEWS.txt
 third_party/gflags/README.libmv
 third_party/gflags/util.h
+third_party/gflags/windows_port.cc
+third_party/gflags/windows_port.h
 third_party/glog/AUTHORS
 third_party/glog/ChangeLog
 third_party/glog/COPYING
diff --git a/extern/libmv/third_party/gflags/windows_port.cc b/extern/libmv/third_party/gflags/windows_port.cc
new file mode 100644
index 0000000..1f40458
--- /dev/null
+++ b/extern/libmv/third_party/gflags/windows_port.cc
@@ -0,0 +1,71 @@
+/* Copyright (c) 2009, Google Inc.
+ * All rights reserved.
+ * 
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * 
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ * 
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ---
+ * Author: Craig Silverstein
+ */
+
+#ifndef _WIN32
+#  error You should only be including windows/port.cc in a windows environment!
+#endif
+
+#include <string.h>    // for strlen(), memset(), memcmp()
+#include <assert.h>
+#include <stdarg.h>    // for va_list, va_start, va_end
+#include <windows.h>
+
+#include "windows_port.h"
+
+// These call the windows _vsnprintf, but always NUL-terminate.
+#if !defined(__MINGW32__) && !defined(__MINGW64__)  /* mingw already defines */
+
+#ifdef _MSC_VER
+#  pragma warning(push)
+#  pragma warning(disable: 4996) // ignore _vsnprintf security warning
+#endif
+int safe_vsnprintf(char *str, size_t size, const char *format, va_list ap) {
+  if (size == 0)        // not even room for a \0?
+    return -1;          // not what C99 says to do, but what windows does
+  str[size-1] = '\0'; 
+  return _vsnprintf(str, size-1, format, ap);
+}
+#ifdef _MSC_VER
+#  pragma warning(pop)
+#endif
+
+int snprintf(char *str, size_t size, const char *format, ...) {
+  int r;
+  va_list ap;
+  va_start(ap, format);
+  r = vsnprintf(str, size, format, ap);
+  va_end(ap);
+  return r;
+}
+
+#endif  /* #if !defined(__MINGW32__) && !defined(__MINGW64__) */
diff --git a/extern/libmv/third_party/gflags/windows_port.h b/extern/libmv/third_party/gflags/windows_port.h
new file mode 100644
index 0000000..c8ff24f
--- /dev/null
+++ b/extern/libmv/third_party/gflags/windows_port.h
@@ -0,0 +1,127 @@
+/* Copyright (c) 2009, Google Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * ---
+ * Author: Craig Silverstein
+ *
+ * These are some portability typedefs and defines to make it a bit
+ * easier to compile this code under VC++.
+ *
+ * Several of these are taken from glib:
+ *    http://developer.gnome.org/doc/API/glib/glib-windows-compatability-functions.html
+ */
+
+#ifndef GFLAGS_WINDOWS_PORT_H_
+#define GFLAGS_WINDOWS_PORT_H_
+
+#include "config.h"
+
+// This must be defined before the windows.h is included.
+// It's needed for mutex.h, to give access to the TryLock method.
+#  if !defined(_WIN32_WINNT) && !(defined( __MINGW32__) || defined(__MINGW64__))
+#    define _WIN32_WINNT 0x0400
+#  endif
+// We always want minimal includes
+#ifndef WIN32_LEAN_AND_MEAN
+#  define WIN32_LEAN_AND_MEAN
+#endif
+#include <windows.h>
+#include <direct.h>          /* for mkdir */
+#include <stdlib.h>          /* for _putenv, getenv */
+#include <stdio.h>           /* need this to override stdio's snprintf, also defines _unlink used by unit tests */
+#include <stdarg.h>          /* util.h uses va_copy */
+#include <string.h>          /* for _stricmp and _strdup */
+
+/* We can't just use _vsnprintf and _snprintf as drop-in-replacements,
+ * because they don't always NUL-terminate. :-(  We also can't use the
+ * name vsnprintf, since windows defines that (but not snprintf (!)).
+ */
+#if !defined(__MINGW32__) && !defined(__MINGW64__)  /* mingw already defines */
+extern GFLAGS_DLL_DECL int snprintf(char *str, size_t size,
+                                       const char *format, ...);
+extern int 

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list