Cycles / Standalone:

* Standalone can now be compiled without the GUI, making the glut dependency optional. 

Added WITH_CYCLES_STANDALONE_GUI cmake flag.
This commit is contained in:
Thomas Dinges
2013-08-30 17:34:27 +00:00
parent b1c36529aa
commit a51f8e4353
5 changed files with 24 additions and 7 deletions

View File

@@ -262,6 +262,7 @@ mark_as_advanced(PYTHON_NUMPY_PATH)
# Cycles
option(WITH_CYCLES "Enable cycles Render Engine" ON)
option(WITH_CYCLES_STANDALONE "Build cycles standalone application" OFF)
option(WITH_CYCLES_STANDALONE_GUI "Build cycles standalone with GUI" OFF)
option(WITH_CYCLES_OSL "Build Cycles with OSL support" OFF)
option(WITH_CYCLES_CUDA_BINARIES "Build cycles CUDA binaries" OFF)
set(CYCLES_CUDA_BINARIES_ARCH sm_20 sm_21 sm_30 sm_35 CACHE STRING "CUDA architectures to build binaries for")

View File

@@ -27,7 +27,7 @@ set(LIBRARIES
link_directories(${OPENIMAGEIO_LIBPATH} ${BOOST_LIBPATH})
if(WITH_CYCLES_STANDALONE)
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
list(APPEND LIBRARIES ${GLUT_LIBRARIES})
endif()

View File

@@ -29,7 +29,10 @@
#include "util_progress.h"
#include "util_string.h"
#include "util_time.h"
#ifdef WITH_CYCLES_STANDALONE_GUI
#include "util_view.h"
#endif
#include "cycles_xml.h"
@@ -100,8 +103,10 @@ static void session_init()
if(options.session_params.background && !options.quiet)
options.session->progress.set_update_callback(function_bind(&session_print_status));
#ifdef WITH_CYCLES_STANDALONE_GUI
else
options.session->progress.set_update_callback(function_bind(&view_redraw));
#endif
options.session->start();
@@ -136,6 +141,7 @@ static void session_exit()
}
}
#ifdef WITH_CYCLES_STANDALONE_GUI
static void display_info(Progress& progress)
{
static double latency = 0.0;
@@ -186,6 +192,7 @@ static void keyboard(unsigned char key)
else if(key == 27) // escape
options.session->progress.set_cancel("Cancelled");
}
#endif
static int files_parse(int argc, const char *argv[])
{
@@ -271,8 +278,14 @@ static void options_parse(int argc, const char **argv)
else if(ssname == "svm")
options.scene_params.shadingsystem = SceneParams::SVM;
/* Progressive rendering */
options.session_params.progressive = true;
#ifdef WITH_CYCLES_STANDALONE_GUI
/* Progressive rendering for GUI */
if(!options.session_params.background)
options.session_params.progressive = true;
#else
/* When building without GUI, set background */
options.session_params.background = true;
#endif
/* find matching device */
DeviceType device_type = Device::type_from_string(devicename.c_str());
@@ -325,13 +338,15 @@ using namespace ccl;
int main(int argc, const char **argv)
{
path_init();
options_parse(argc, argv);
#ifdef WITH_CYCLES_STANDALONE_GUI
if(options.session_params.background) {
#endif
session_init();
options.session->wait();
session_exit();
#ifdef WITH_CYCLES_STANDALONE_GUI
}
else {
string title = "Cycles: " + path_filename(options.filepath);
@@ -340,6 +355,7 @@ int main(int argc, const char **argv)
view_main_loop(title.c_str(), options.width, options.height,
session_init, session_exit, resize, display, keyboard);
}
#endif
return 0;
}

View File

@@ -2,7 +2,7 @@
###########################################################################
# GLUT
if(WITH_CYCLES_STANDALONE)
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
set(GLUT_ROOT_PATH ${CYCLES_GLUT})
find_package(GLUT)

View File

@@ -22,7 +22,7 @@ set(SRC
util_transform.cpp
)
if(WITH_CYCLES_STANDALONE)
if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
list(APPEND SRC
util_view.cpp
)