Cycles / Standalone:
authorThomas Dinges <blender@dingto.org>
Fri, 30 Aug 2013 17:34:27 +0000 (17:34 +0000)
committerThomas Dinges <blender@dingto.org>
Fri, 30 Aug 2013 17:34:27 +0000 (17:34 +0000)
* Standalone can now be compiled without the GUI, making the glut dependency optional.

Added WITH_CYCLES_STANDALONE_GUI cmake flag.

CMakeLists.txt
intern/cycles/app/CMakeLists.txt
intern/cycles/app/cycles_standalone.cpp
intern/cycles/cmake/external_libs.cmake
intern/cycles/util/CMakeLists.txt

index a8df83015847236e7fd8ed8846a6ce95aff74726..c956fb2ca8c6626fae2acbe75d8bc687188e02f4 100644 (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")
index 347da075d0553877d3af53d4357f582be689982c..ded00f61b36be366d7731a85f29937eec943a598 100644 (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()
 
index 9a193548d7aff41a95f46c036ba2cc664d1c18be..2a438397ae07dd27ab51ff66f6f916ac11d8c3a5 100644 (file)
 #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;
 }
index 6164572c26432d54b2ed2f3dd994571b97ae0870..8753ff4bf84775ddf70585c0eb8df4945970b4c0 100644 (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)
index 36c89b979e261e546b79b629c9d07d829914d03f..ce5ba44abe96fc786d7ca99f259c7f461ed97d5f 100644 (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
        )