diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-12 14:01:30 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2014-12-31 23:31:08 +0300 |
commit | 93ca68b50c9112748366de4573f6554b7368d7cc (patch) | |
tree | a36a68066cfe5c8b94ea71be2d475bb4bd1d5337 /intern | |
parent | 405c0fddb47b766a1a16af3cd3dab9387f17d43d (diff) |
Cycles: Be ready for gflags namespace auto-detect
This way it is now possible to use gflags >= 2.1, where all the
functions were moved from google to gflags namespace.
This isn't currently used in blender, but for standalone repository
this change is essential.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/cycles/CMakeLists.txt | 1 | ||||
-rw-r--r-- | intern/cycles/SConscript | 1 | ||||
-rw-r--r-- | intern/cycles/cmake/external_libs.cmake | 1 | ||||
-rw-r--r-- | intern/cycles/kernel/osl/SConscript | 1 | ||||
-rw-r--r-- | intern/cycles/util/util_logging.cpp | 22 |
5 files changed, 17 insertions, 9 deletions
diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt index fc80a6ef126..a7767488a73 100644 --- a/intern/cycles/CMakeLists.txt +++ b/intern/cycles/CMakeLists.txt @@ -154,6 +154,7 @@ add_definitions( if(WITH_CYCLES_LOGGING) add_definitions(-DWITH_CYCLES_LOGGING) add_definitions(-DGOOGLE_GLOG_DLL_DECL=) + add_definitions(-DCYCLES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE}) include_directories( SYSTEM ${GLOG_INCLUDE_DIRS} diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript index 15a02881ec2..fd7ac974ab0 100644 --- a/intern/cycles/SConscript +++ b/intern/cycles/SConscript @@ -65,6 +65,7 @@ if env['WITH_BF_CYCLES_DEBUG']: if env['WITH_BF_CYCLES_LOGGING']: defs.append('WITH_CYCLES_LOGGING') defs.append('GOOGLE_GLOG_DLL_DECL=') + defs.append('GFLAGS_NAMESPACE=gflags') if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs.append('#extern/libmv/third_party/glog/src/windows') incs.append('#extern/libmv/third_party/gflags') diff --git a/intern/cycles/cmake/external_libs.cmake b/intern/cycles/cmake/external_libs.cmake index 00c9b5179d6..d036f3e7ab9 100644 --- a/intern/cycles/cmake/external_libs.cmake +++ b/intern/cycles/cmake/external_libs.cmake @@ -136,4 +136,5 @@ else() set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/glog/src) set(GFLAGS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/gflags) endif() + set(GFLAGS_NAMESPACE gflags) endif() diff --git a/intern/cycles/kernel/osl/SConscript b/intern/cycles/kernel/osl/SConscript index 0a21d3e6819..1cb6b6a7b47 100644 --- a/intern/cycles/kernel/osl/SConscript +++ b/intern/cycles/kernel/osl/SConscript @@ -50,6 +50,7 @@ if env['WITH_BF_CYCLES_DEBUG']: if env['WITH_BF_CYCLES_LOGGING']: defs.append('WITH_CYCLES_LOGGING') defs.append('GOOGLE_GLOG_DLL_DECL=') + defs.append('GFLAGS_NAMESPACE=gflags') if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): incs.append('#extern/libmv/third_party/glog/src/windows') incs.append('#extern/libmv/third_party/gflags') diff --git a/intern/cycles/util/util_logging.cpp b/intern/cycles/util/util_logging.cpp index 1aff647a6bb..03041723e15 100644 --- a/intern/cycles/util/util_logging.cpp +++ b/intern/cycles/util/util_logging.cpp @@ -28,16 +28,18 @@ CCL_NAMESPACE_BEGIN void util_logging_init(const char *argv0) { #ifdef WITH_CYCLES_LOGGING + using CYCLES_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); #else (void) argv0; #endif @@ -46,19 +48,21 @@ void util_logging_init(const char *argv0) void util_logging_start(void) { #ifdef WITH_CYCLES_LOGGING - gflags::SetCommandLineOption("logtostderr", "1"); - gflags::SetCommandLineOption("v", "2"); - gflags::SetCommandLineOption("stderrthreshold", "1"); - gflags::SetCommandLineOption("minloglevel", "0"); + using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption; + SetCommandLineOption("logtostderr", "1"); + SetCommandLineOption("v", "2"); + SetCommandLineOption("stderrthreshold", "1"); + SetCommandLineOption("minloglevel", "0"); #endif } void util_logging_verbosity_set(int verbosity) { #ifdef WITH_CYCLES_LOGGING + using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption; char val[10]; snprintf(val, sizeof(val), "%d", verbosity); - gflags::SetCommandLineOption("v", val); + SetCommandLineOption("v", val); #else (void) verbosity; #endif |