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.
This commit is contained in:
@@ -154,6 +154,7 @@ add_definitions(
|
|||||||
if(WITH_CYCLES_LOGGING)
|
if(WITH_CYCLES_LOGGING)
|
||||||
add_definitions(-DWITH_CYCLES_LOGGING)
|
add_definitions(-DWITH_CYCLES_LOGGING)
|
||||||
add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
|
add_definitions(-DGOOGLE_GLOG_DLL_DECL=)
|
||||||
|
add_definitions(-DCYCLES_GFLAGS_NAMESPACE=${GFLAGS_NAMESPACE})
|
||||||
include_directories(
|
include_directories(
|
||||||
SYSTEM
|
SYSTEM
|
||||||
${GLOG_INCLUDE_DIRS}
|
${GLOG_INCLUDE_DIRS}
|
||||||
|
@@ -65,6 +65,7 @@ if env['WITH_BF_CYCLES_DEBUG']:
|
|||||||
if env['WITH_BF_CYCLES_LOGGING']:
|
if env['WITH_BF_CYCLES_LOGGING']:
|
||||||
defs.append('WITH_CYCLES_LOGGING')
|
defs.append('WITH_CYCLES_LOGGING')
|
||||||
defs.append('GOOGLE_GLOG_DLL_DECL=')
|
defs.append('GOOGLE_GLOG_DLL_DECL=')
|
||||||
|
defs.append('GFLAGS_NAMESPACE=gflags')
|
||||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
|
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/glog/src/windows')
|
||||||
incs.append('#extern/libmv/third_party/gflags')
|
incs.append('#extern/libmv/third_party/gflags')
|
||||||
|
@@ -136,4 +136,5 @@ else()
|
|||||||
set(GLOG_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/glog/src)
|
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)
|
set(GFLAGS_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/extern/libmv/third_party/gflags)
|
||||||
endif()
|
endif()
|
||||||
|
set(GFLAGS_NAMESPACE gflags)
|
||||||
endif()
|
endif()
|
||||||
|
@@ -50,6 +50,7 @@ if env['WITH_BF_CYCLES_DEBUG']:
|
|||||||
if env['WITH_BF_CYCLES_LOGGING']:
|
if env['WITH_BF_CYCLES_LOGGING']:
|
||||||
defs.append('WITH_CYCLES_LOGGING')
|
defs.append('WITH_CYCLES_LOGGING')
|
||||||
defs.append('GOOGLE_GLOG_DLL_DECL=')
|
defs.append('GOOGLE_GLOG_DLL_DECL=')
|
||||||
|
defs.append('GFLAGS_NAMESPACE=gflags')
|
||||||
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
|
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/glog/src/windows')
|
||||||
incs.append('#extern/libmv/third_party/gflags')
|
incs.append('#extern/libmv/third_party/gflags')
|
||||||
|
@@ -28,16 +28,18 @@ CCL_NAMESPACE_BEGIN
|
|||||||
void util_logging_init(const char *argv0)
|
void util_logging_init(const char *argv0)
|
||||||
{
|
{
|
||||||
#ifdef WITH_CYCLES_LOGGING
|
#ifdef WITH_CYCLES_LOGGING
|
||||||
|
using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption;
|
||||||
|
|
||||||
/* Make it so FATAL messages are always print into console. */
|
/* Make it so FATAL messages are always print into console. */
|
||||||
char severity_fatal[32];
|
char severity_fatal[32];
|
||||||
snprintf(severity_fatal, sizeof(severity_fatal), "%d",
|
snprintf(severity_fatal, sizeof(severity_fatal), "%d",
|
||||||
google::GLOG_FATAL);
|
google::GLOG_FATAL);
|
||||||
|
|
||||||
google::InitGoogleLogging(argv0);
|
google::InitGoogleLogging(argv0);
|
||||||
gflags::SetCommandLineOption("logtostderr", "1");
|
SetCommandLineOption("logtostderr", "1");
|
||||||
gflags::SetCommandLineOption("v", "0");
|
SetCommandLineOption("v", "0");
|
||||||
gflags::SetCommandLineOption("stderrthreshold", severity_fatal);
|
SetCommandLineOption("stderrthreshold", severity_fatal);
|
||||||
gflags::SetCommandLineOption("minloglevel", severity_fatal);
|
SetCommandLineOption("minloglevel", severity_fatal);
|
||||||
#else
|
#else
|
||||||
(void) argv0;
|
(void) argv0;
|
||||||
#endif
|
#endif
|
||||||
@@ -46,19 +48,21 @@ void util_logging_init(const char *argv0)
|
|||||||
void util_logging_start(void)
|
void util_logging_start(void)
|
||||||
{
|
{
|
||||||
#ifdef WITH_CYCLES_LOGGING
|
#ifdef WITH_CYCLES_LOGGING
|
||||||
gflags::SetCommandLineOption("logtostderr", "1");
|
using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption;
|
||||||
gflags::SetCommandLineOption("v", "2");
|
SetCommandLineOption("logtostderr", "1");
|
||||||
gflags::SetCommandLineOption("stderrthreshold", "1");
|
SetCommandLineOption("v", "2");
|
||||||
gflags::SetCommandLineOption("minloglevel", "0");
|
SetCommandLineOption("stderrthreshold", "1");
|
||||||
|
SetCommandLineOption("minloglevel", "0");
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void util_logging_verbosity_set(int verbosity)
|
void util_logging_verbosity_set(int verbosity)
|
||||||
{
|
{
|
||||||
#ifdef WITH_CYCLES_LOGGING
|
#ifdef WITH_CYCLES_LOGGING
|
||||||
|
using CYCLES_GFLAGS_NAMESPACE::SetCommandLineOption;
|
||||||
char val[10];
|
char val[10];
|
||||||
snprintf(val, sizeof(val), "%d", verbosity);
|
snprintf(val, sizeof(val), "%d", verbosity);
|
||||||
gflags::SetCommandLineOption("v", val);
|
SetCommandLineOption("v", val);
|
||||||
#else
|
#else
|
||||||
(void) verbosity;
|
(void) verbosity;
|
||||||
#endif
|
#endif
|
||||||
|
Reference in New Issue
Block a user