diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-21 11:58:01 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2017-04-21 13:01:27 +0300 |
commit | c7a5c48cbad0062c55bf9fa6df2926646b2c3091 (patch) | |
tree | d53c082e2c1d58bea374017f435269ccc2892e7d /intern/libmv | |
parent | 55a3d48046377444a3c36ffe7a6164030d447f6f (diff) |
CMake: Add option to link against system-wide Gflags library
It is disabled by default, so should not affect existing configurations.
Main benefits of this goes as:
- Linux distros can use that to avoid libraries duplication and link
blender package against gflags package from the system.
- It it easier to test whether Blender works with updated version of
Gflags prior to re-bundling the library.
Diffstat (limited to 'intern/libmv')
-rw-r--r-- | intern/libmv/CMakeLists.txt | 3 | ||||
-rwxr-xr-x | intern/libmv/bundle.sh | 2 | ||||
-rw-r--r-- | intern/libmv/intern/logging.cc | 22 |
3 files changed, 15 insertions, 12 deletions
diff --git a/intern/libmv/CMakeLists.txt b/intern/libmv/CMakeLists.txt index cd89f1d84b5..b67a23b4159 100644 --- a/intern/libmv/CMakeLists.txt +++ b/intern/libmv/CMakeLists.txt @@ -41,9 +41,10 @@ if(WITH_LIBMV) add_definitions(${GFLAGS_DEFINES}) add_definitions(${GLOG_DEFINES}) add_definitions(${CERES_DEFINES}) + add_definitions(-DLIBMV_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE}) list(APPEND INC - ../../extern/gflags/src + ${GFLAGS_INCLUDE_DIRS} ../../extern/glog/src ../../extern/ceres/include ../../extern/ceres/config diff --git a/intern/libmv/bundle.sh b/intern/libmv/bundle.sh index b1a4be84e53..27e012f665f 100755 --- a/intern/libmv/bundle.sh +++ b/intern/libmv/bundle.sh @@ -122,7 +122,7 @@ if(WITH_LIBMV) add_definitions(\${CERES_DEFINES}) list(APPEND INC - ../../extern/gflags/src + \${GFLAGS_INCLUDE_DIRS} ../../extern/glog/src ../../extern/ceres/include ../../extern/ceres/config diff --git a/intern/libmv/intern/logging.cc b/intern/libmv/intern/logging.cc index 77b56ef4df3..9b8adf09a97 100644 --- a/intern/libmv/intern/logging.cc +++ b/intern/libmv/intern/logging.cc @@ -29,27 +29,29 @@ #include "libmv/logging/logging.h" void libmv_initLogging(const char* argv0) { + using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption; // Make it so FATAL messages are always print into console. char severity_fatal[32]; snprintf(severity_fatal, sizeof(severity_fatal), "%d", google::GLOG_FATAL); - google::InitGoogleLogging(argv0); - gflags::SetCommandLineOption("logtostderr", "1"); - gflags::SetCommandLineOption("v", "0"); - gflags::SetCommandLineOption("stderrthreshold", severity_fatal); - gflags::SetCommandLineOption("minloglevel", severity_fatal); + SetCommandLineOption("logtostderr", "1"); + SetCommandLineOption("v", "0"); + SetCommandLineOption("stderrthreshold", severity_fatal); + SetCommandLineOption("minloglevel", severity_fatal); } void libmv_startDebugLogging(void) { - gflags::SetCommandLineOption("logtostderr", "1"); - gflags::SetCommandLineOption("v", "2"); - gflags::SetCommandLineOption("stderrthreshold", "1"); - gflags::SetCommandLineOption("minloglevel", "0"); + using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption; + SetCommandLineOption("logtostderr", "1"); + SetCommandLineOption("v", "2"); + SetCommandLineOption("stderrthreshold", "1"); + SetCommandLineOption("minloglevel", "0"); } void libmv_setLoggingVerbosity(int verbosity) { + using LIBMV_GFLAGS_NAMESPACE::SetCommandLineOption; char val[10]; snprintf(val, sizeof(val), "%d", verbosity); - gflags::SetCommandLineOption("v", val); + SetCommandLineOption("v", val); } |