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>2013-10-10 00:02:02 +0400
committerSergey Sharybin <sergey.vfx@gmail.com>2013-10-10 00:02:02 +0400
commitb5491291e4a04e08b970592aa64252ea60a31382 (patch)
tree70ce8d681ac9793425614b038625ea6d6cdcf55c /extern
parentccd2e4375a3a8d1338d15d00193ff56da63809c3 (diff)
Libmv: move platform-specific defines into own file
Diffstat (limited to 'extern')
-rw-r--r--extern/libmv/CMakeLists.txt1
-rwxr-xr-xextern/libmv/bundle.sh1
-rw-r--r--extern/libmv/libmv-capi.cc34
-rw-r--r--extern/libmv/libmv-capi_intern.h59
4 files changed, 62 insertions, 33 deletions
diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index ae5cfd0cb1d..80a212b64f8 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -32,6 +32,7 @@ set(INC
set(SRC
libmv-capi.h
+ libmv-capi_intern.h
)
if(WITH_LIBMV)
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index f51af8ee32e..33abc30c0fd 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -128,6 +128,7 @@ set(INC
set(SRC
libmv-capi.h
+ libmv-capi_intern.h
)
if(WITH_LIBMV)
diff --git a/extern/libmv/libmv-capi.cc b/extern/libmv/libmv-capi.cc
index 717c54acd85..11608318a40 100644
--- a/extern/libmv/libmv-capi.cc
+++ b/extern/libmv/libmv-capi.cc
@@ -43,35 +43,7 @@
# include <png.h>
#endif
-#if defined(_MSC_VER)
-# define __func__ __FUNCTION__
-#endif
-
-#ifdef WITH_LIBMV_GUARDED_ALLOC
-# include "MEM_guardedalloc.h"
-# define LIBMV_OBJECT_NEW OBJECT_GUARDED_NEW
-# define LIBMV_OBJECT_DELETE OBJECT_GUARDED_DELETE
-# define LIBMV_OBJECT_DELETE OBJECT_GUARDED_DELETE
-# define LIBMV_STRUCT_NEW(type, count) (type*)MEM_mallocN(sizeof(type) * count, __func__)
-# define LIBMV_STRUCT_DELETE(what) MEM_freeN(what)
-#else
-// Need this to keep libmv-capi potentially standalone.
-# if defined __GNUC__ || defined __sun
-# define LIBMV_OBJECT_NEW(type, args ...) \
- new(malloc(sizeof(type))) type(args)
-# else
-# define LIBMV_OBJECT_NEW(type, ...) \
- new(malloc(sizeof(type))) type(__VA_ARGS__)
-#endif
-# define LIBMV_OBJECT_DELETE(what, type) \
- { if(what) { \
- ((type*)(what))->~type(); \
- free(what); \
- } } (void)0
-# define LIBMV_STRUCT_NEW(type, count) (type*)malloc(sizeof(type) * count)
-# define LIBMV_STRUCT_DELETE(what) { if (what) free(what); } (void)0
-#endif
-
+#include "libmv-capi_intern.h"
#include "libmv/logging/logging.h"
#include "libmv/multiview/homography.h"
#include "libmv/tracking/track_region.h"
@@ -86,10 +58,6 @@
#include "libmv/simple_pipeline/reconstruction_scale.h"
#include "libmv/simple_pipeline/keyframe_selection.h"
-#ifdef _MSC_VER
-# define snprintf _snprintf
-#endif
-
struct libmv_Reconstruction {
libmv::EuclideanReconstruction reconstruction;
diff --git a/extern/libmv/libmv-capi_intern.h b/extern/libmv/libmv-capi_intern.h
new file mode 100644
index 00000000000..90087c52a6c
--- /dev/null
+++ b/extern/libmv/libmv-capi_intern.h
@@ -0,0 +1,59 @@
+/*
+ * ***** BEGIN GPL LICENSE BLOCK *****
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * The Original Code is Copyright (C) 2013 Blender Foundation.
+ * All rights reserved.
+ *
+ * Contributor(s): Sergey Sharybin
+ *
+ * ***** END GPL LICENSE BLOCK *****
+ */
+
+#ifndef LIBMV_C_API_INTERN_H
+#define LIBMV_C_API_INTERN_H
+
+#if defined(_MSC_VER)
+# define __func__ __FUNCTION__
+# define snprintf _snprintf
+#endif
+
+#ifdef WITH_LIBMV_GUARDED_ALLOC
+# include "MEM_guardedalloc.h"
+# define LIBMV_OBJECT_NEW OBJECT_GUARDED_NEW
+# define LIBMV_OBJECT_DELETE OBJECT_GUARDED_DELETE
+# define LIBMV_OBJECT_DELETE OBJECT_GUARDED_DELETE
+# define LIBMV_STRUCT_NEW(type, count) (type*)MEM_mallocN(sizeof(type) * count, __func__)
+# define LIBMV_STRUCT_DELETE(what) MEM_freeN(what)
+#else
+// Need this to keep libmv-capi potentially standalone.
+# if defined __GNUC__ || defined __sun
+# define LIBMV_OBJECT_NEW(type, args ...) \
+ new(malloc(sizeof(type))) type(args)
+# else
+# define LIBMV_OBJECT_NEW(type, ...) \
+ new(malloc(sizeof(type))) type(__VA_ARGS__)
+#endif
+# define LIBMV_OBJECT_DELETE(what, type) \
+ { if(what) { \
+ ((type*)(what))->~type(); \
+ free(what); \
+ } } (void)0
+# define LIBMV_STRUCT_NEW(type, count) (type*)malloc(sizeof(type) * count)
+# define LIBMV_STRUCT_DELETE(what) { if (what) free(what); } (void)0
+#endif
+
+#endif // LIBMV_C_API_INTERN_H