Commit: 2617d370341257af577ba35924878416b3736804
Author: Sergey Sharybin
Date:   Thu Dec 11 11:50:04 2014 +0500
Branches: master
https://developer.blender.org/rB2617d370341257af577ba35924878416b3736804

Libmv: Reshuffle CMake and SCons configuration files

The main idea is to share as much code between cases when feature-full built
is done and only logging is needed, so all the defines and include directories
are guaranteed to be the same.

This would hopefully make it so MinGW compilation is all happy about Cycles
logging for both CMake and SCons.

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

M       extern/libmv/CMakeLists.txt
M       extern/libmv/SConscript
M       extern/libmv/bundle.sh

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

diff --git a/extern/libmv/CMakeLists.txt b/extern/libmv/CMakeLists.txt
index 10d99a2..49f7761 100644
--- a/extern/libmv/CMakeLists.txt
+++ b/extern/libmv/CMakeLists.txt
@@ -37,13 +37,42 @@ set(SRC
        libmv-capi.h
 )
 
-if(WITH_LIBMV)
+if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
+       list(APPEND INC
+               third_party/gflags
+               third_party/glog/src
+               third_party/ceres/include
+               third_party/ceres/config
+               ../../intern/guardedalloc
+       )
+
+       list(APPEND
+               INC_SYS
+               ../Eigen3
+               ${PNG_INCLUDE_DIRS}
+               ${ZLIB_INCLUDE_DIRS}
+       )
+
+       if(WIN32)
+               list(APPEND INC
+                       third_party/glog/src/windows
+               )
+
+               if(NOT MINGW)
+                       list(APPEND INC
+                               third_party/msinttypes
+                       )
+               endif()
+       endif()
+
        add_definitions(
                -DWITH_LIBMV_GUARDED_ALLOC
                -DGOOGLE_GLOG_DLL_DECL=
                -DLIBMV_NO_FAST_DETECTOR=
        )
+endif()
 
+if(WITH_LIBMV)
        TEST_SHARED_PTR_SUPPORT()
        if(SHARED_PTR_FOUND)
                if(SHARED_PTR_TR1_MEMORY_HEADER)
@@ -56,20 +85,6 @@ if(WITH_LIBMV)
                message(FATAL_ERROR "Unable to find shared_ptr.")
        endif()
 
-       list(APPEND INC
-               third_party/gflags
-               third_party/glog/src
-               third_party/ceres/include
-               third_party/ceres/config
-               ../../intern/guardedalloc
-       )
-
-       list(APPEND INC_SYS
-               ../Eigen3
-               ${PNG_INCLUDE_DIRS}
-               ${ZLIB_INCLUDE_DIRS}
-       )
-
        list(APPEND SRC
                intern/autotrack.cc
                intern/camera_intrinsics.cc
@@ -202,17 +217,6 @@ if(WITH_LIBMV)
                third_party/msinttypes/stdint.h
        )
 
-       if(WIN32)
-               list(APPEND INC
-                       third_party/glog/src/windows
-               )
-
-               if(NOT MINGW)
-                       list(APPEND INC
-                               third_party/msinttypes
-                       )
-               endif()
-       endif()
 
        if(WITH_GTESTS)
                blender_add_lib(libmv_test_dataset 
"./libmv/multiview/test_data_sets.cc" "" "")
@@ -262,7 +266,7 @@ if(WITH_LIBMV)
 endif()
 
 # make GLog a separate target, so it can be used for gtest as well.
-if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
+if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
        # We compile GLog together with GFlag so we don't worry about
        # adding extra lib to linker.
        set(GLOG_SRC
@@ -338,13 +342,5 @@ if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
                )
        endif()
 
-       set(GLOG_INC
-               third_party/gflags
-               third_party/glog/src
-       )
-
-       set(GLOG_INC_SYS
-       )
-
-       blender_add_lib(extern_glog "${GLOG_SRC}" "${GLOG_INC}" 
"${GLOG_INC_SYS}")
+       blender_add_lib(extern_glog "${GLOG_SRC}" "${INC}" "${INC_SYS}")
 endif()
diff --git a/extern/libmv/SConscript b/extern/libmv/SConscript
index c3e6a4b..6d41727 100644
--- a/extern/libmv/SConscript
+++ b/extern/libmv/SConscript
@@ -12,6 +12,22 @@ Import('env')
 defs = []
 incs = '.'
 
+if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and 
env['WITH_BF_CYCLES_LOGGING']):
+    defs.append('GOOGLE_GLOG_DLL_DECL=')
+    defs.append('WITH_LIBMV_GUARDED_ALLOC')
+    defs.append('LIBMV_NO_FAST_DETECTOR')
+
+    incs += ' ../Eigen3 third_party/gflags third_party/glog/src 
third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
+    incs += ' ' + env['BF_PNG_INC']
+    incs += ' ' + env['BF_ZLIB_INC']
+
+    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 
'win64-vc', 'win64-mingw'):
+        incs += ' ./third_party/glog/src/windows 
./third_party/glog/src/windows/glog'
+        if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
+            incs += ' ./third_party/msinttypes'
+    else:
+        incs += ' ./third_party/glog/src'
+
 if env['WITH_BF_LIBMV']:
     if not env['WITH_SHARED_PTR_SUPPORT']:
         print("-- Unable to find shared_ptr which is required for 
compilation.")
@@ -22,10 +38,6 @@ if env['WITH_BF_LIBMV']:
     if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
         defs.append('CERES_TR1_SHARED_PTR')
 
-    defs.append('GOOGLE_GLOG_DLL_DECL=')
-    defs.append('WITH_LIBMV_GUARDED_ALLOC')
-    defs.append('LIBMV_NO_FAST_DETECTOR')
-
     src = env.Glob('intern/*.cc')
     src.remove('intern' + os.sep + 'stub.cc')
     src += env.Glob('libmv/autotrack/*.cc')
@@ -36,18 +48,6 @@ if env['WITH_BF_LIBMV']:
     src += env.Glob('libmv/simple_pipeline/*.cc')
     src += env.Glob('libmv/tracking/*.cc')
     src += env.Glob('third_party/gflags/*.cc')
-
-    incs += ' ../Eigen3 third_party/gflags third_party/glog/src 
third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
-    incs += ' ' + env['BF_PNG_INC']
-    incs += ' ' + env['BF_ZLIB_INC']
-
-    if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 
'win64-vc', 'win64-mingw'):
-        incs += ' ./third_party/glog/src/windows 
./third_party/glog/src/windows/glog'
-        if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
-            incs += ' ./third_party/msinttypes'
-
-    else:
-        incs += ' ./third_party/glog/src'
 else:
     src = env.Glob("intern/stub.cc")
 
diff --git a/extern/libmv/bundle.sh b/extern/libmv/bundle.sh
index e467cc9..002e381 100755
--- a/extern/libmv/bundle.sh
+++ b/extern/libmv/bundle.sh
@@ -130,13 +130,41 @@ set(SRC
        libmv-capi.h
 )
 
-if(WITH_LIBMV)
+if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
+       list(APPEND INC
+               third_party/gflags
+               third_party/glog/src
+               third_party/ceres/include
+               third_party/ceres/config
+               ../../intern/guardedalloc
+       )
+
+       list(APPEND INC_SYS
+               ../Eigen3
+               \${PNG_INCLUDE_DIRS}
+               \${ZLIB_INCLUDE_DIRS}
+       )
+
+       if(WIN32)
+               list(APPEND INC
+                       third_party/glog/src/windows
+               )
+
+               if(NOT MINGW)
+                       list(APPEND INC
+                               third_party/msinttypes
+                       )
+               endif()
+       endif()
+
        add_definitions(
                -DWITH_LIBMV_GUARDED_ALLOC
                -DGOOGLE_GLOG_DLL_DECL=
                -DLIBMV_NO_FAST_DETECTOR=
        )
+endif()
 
+if(WITH_LIBMV)
        TEST_SHARED_PTR_SUPPORT()
        if(SHARED_PTR_FOUND)
                if(SHARED_PTR_TR1_MEMORY_HEADER)
@@ -149,20 +177,6 @@ if(WITH_LIBMV)
                message(FATAL_ERROR "Unable to find shared_ptr.")
        endif()
 
-       list(APPEND INC
-               third_party/gflags
-               third_party/glog/src
-               third_party/ceres/include
-               third_party/ceres/config
-               ../../intern/guardedalloc
-       )
-
-       list(APPEND INC_SYS
-               ../Eigen3
-               \${PNG_INCLUDE_DIRS}
-               \${ZLIB_INCLUDE_DIRS}
-       )
-
        list(APPEND SRC
                intern/autotrack.cc
                intern/camera_intrinsics.cc
@@ -194,17 +208,6 @@ ${headers}
 ${third_headers}
        )
 
-       if(WIN32)
-               list(APPEND INC
-                       third_party/glog/src/windows
-               )
-
-               if(NOT MINGW)
-                       list(APPEND INC
-                               third_party/msinttypes
-                       )
-               endif()
-       endif()
 
        if(WITH_GTESTS)
                blender_add_lib(libmv_test_dataset 
"./libmv/multiview/test_data_sets.cc" "${INC}" "${INC_SYS}")
@@ -224,7 +227,7 @@ if(WITH_LIBMV)
 endif()
 
 # make GLog a separate target, so it can be used for gtest as well.
-if(WITH_LIBMV OR WITH_GTESTS OR WITH_CYCLES_LOGGING)
+if(WITH_LIBMV OR WITH_GTESTS OR (WITH_CYCLES AND WITH_CYCLES_LOGGING))
        # We compile GLog together with GFlag so we don't worry about
        # adding extra lib to linker.
        set(GLOG_SRC
@@ -267,15 +270,7 @@ ${third_glog_headers}
                )
        endif()
 
-       set(GLOG_INC
-               third_party/gflags
-               third_party/glog/src
-       )
-
-       set(GLOG_INC_SYS
-       )
-
-       blender_add_lib(extern_glog "\${GLOG_SRC}" "\${GLOG_INC}" 
"\${GLOG_INC_SYS}")
+       blender_add_lib(extern_glog "\${GLOG_SRC}" "\${INC}" "\${INC_SYS}")
 endif()
 EOF
 
@@ -294,24 +289,11 @@ Import('env')
 defs = []
 incs = '.'
 
-if env['WITH_BF_LIBMV']:
-    if not env['WITH_SHARED_PTR_SUPPORT']:
-        print("-- Unable to find shared_ptr which is required for 
compilation.")
-        exit(1)
-
-    if env['SHARED_PTR_HEADER'] == 'tr1/memory':
-        defs.append('CERES_TR1_MEMORY_HEADER')
-    if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
-        defs.append('CERES_TR1_SHARED_PTR')
-
+if env['WITH_BF_LIBMV'] or (env['WITH_BF_CYCLES'] and 
env['WITH_BF_CYCLES_LOGGING']):
     defs.append('GOOGLE_GLOG_DLL_DECL=')
     defs.append('WITH_LIBMV_GUARDED_ALLOC')
     defs.append('LIBMV_NO_FAST_DETECTOR')
 
-    src = env.Glob('intern/*.cc')
-    src.remove('intern' + os.sep + 'stub.cc')
-$src
-
     incs += ' ../Eigen3 third_party/gflags third_party/glog/src 
third_party/ceres/include third_party/ceres/config ../../intern/guardedalloc'
     incs += ' ' + env['BF_PNG_INC']
     incs += ' ' + env['BF_ZLIB_INC']
@@ -320,9 +302,22 @@ $src
         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}
     else:
         incs += ' ./third_party/glog/src'
+
+if env['WITH_BF_LIBMV']:
+    if not env['WITH_SHARED_PTR_SUPPORT']:
+        print("-- Unable to find shared_ptr which is required for 
compilation.")
+        exit(1)
+
+    if env['SHARED_PTR_HEADER'] == 'tr1/memory':
+        defs.append('CERES_TR1_MEMORY_HEADER')
+    if env['SHARED_PTR_NAMESPACE'] == 'std::tr1':
+        defs.append('CERES_TR1_SHARED_PTR')
+
+    src = env.Glob('intern/*.cc')
+    src.remove('intern' + os.sep + 'stub.cc')
+$src
 else:
     src = env.Glob("intern/stub.cc")

_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs

Reply via email to