Cycles: Fully support WITH_CYCLES_LOGGING option
This commit generalizes logging module a little bit in making it possible to use Glog logging in standalone Cycles repository.
This commit is contained in:
@@ -37,7 +37,14 @@ if(NOT PUGIXML_LIBRARIES STREQUAL "")
|
||||
list(APPEND LIBRARIES ${PUGIXML_LIBRARIES})
|
||||
endif()
|
||||
|
||||
if(NOT CYCLES_STANDALONE_REPOSITORY)
|
||||
if(CYCLES_STANDALONE_REPOSITORY)
|
||||
if(WITH_CYCLES_LOGGING)
|
||||
list(APPEND LIBRARIES
|
||||
${GLOG_LIBRARIES}
|
||||
${GFLAGS_LIBRARIES}
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND LIBRARIES bf_intern_glew_mx)
|
||||
endif()
|
||||
|
||||
|
@@ -25,6 +25,7 @@
|
||||
#include "util_args.h"
|
||||
#include "util_foreach.h"
|
||||
#include "util_function.h"
|
||||
#include "util_logging.h"
|
||||
#include "util_path.h"
|
||||
#include "util_progress.h"
|
||||
#include "util_string.h"
|
||||
@@ -331,7 +332,8 @@ static void options_parse(int argc, const char **argv)
|
||||
|
||||
/* parse options */
|
||||
ArgParse ap;
|
||||
bool help = false;
|
||||
bool help = false, debug = false;
|
||||
int verbosity = 1;
|
||||
|
||||
ap.options ("Usage: cycles [options] file.xml",
|
||||
"%*", files_parse, "",
|
||||
@@ -347,6 +349,10 @@ static void options_parse(int argc, const char **argv)
|
||||
"--width %d", &options.width, "Window width in pixel",
|
||||
"--height %d", &options.height, "Window height in pixel",
|
||||
"--list-devices", &list, "List information about all available devices",
|
||||
#ifdef WITH_CYCLES_LOGGING
|
||||
"--debug", &debug, "Enable debug logging",
|
||||
"--verbose %d", &verbosity, "Set verbosity of the logger",
|
||||
#endif
|
||||
"--help", &help, "Print help message",
|
||||
NULL);
|
||||
|
||||
@@ -355,7 +361,13 @@ static void options_parse(int argc, const char **argv)
|
||||
ap.usage();
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
else if(list) {
|
||||
|
||||
if (debug) {
|
||||
util_logging_start();
|
||||
util_logging_verbosity_set(verbosity);
|
||||
}
|
||||
|
||||
if(list) {
|
||||
vector<DeviceInfo>& devices = Device::available_devices();
|
||||
printf("Devices:\n");
|
||||
|
||||
@@ -435,6 +447,7 @@ using namespace ccl;
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
util_logging_init(argv[0]);
|
||||
path_init();
|
||||
options_parse(argc, argv);
|
||||
|
||||
|
Reference in New Issue
Block a user