Page MenuHome

Cycles: CMake option to only build standalone renderer.
ClosedPublic

Authored by Thomas Dinges (dingto) on Jan 18 2014, 3:16 PM.

Details

Summary

Hi,
this adds a cmake config to only compile Cycles standalone without Blender.
Just run "make cycles".

Tested on Mac OS X.

ToDo: Add a proper install target for Cycles, the removal of "install" in GNUmakefile is only a hack for now. Some help here would be appreciated.

Diff Detail

Event Timeline

GNUmakefile
125

Only a hack, see description.

@Brecht Van Lommel (brecht): On second thought, we don't really need a install target for now, the cycles executable in build/bin is fine for now. So maybe the solution is, to just define an empty install target?

You could do something like this to make the install target work. For the standalone you do need to install the opencl kernel files and OSL shaders.

diff --git a/intern/cycles/CMakeLists.txt b/intern/cycles/CMakeLists.txt
index 6268ff7..cbe2182 100644
--- a/intern/cycles/CMakeLists.txt
+++ b/intern/cycles/CMakeLists.txt
@@ -1,5 +1,9 @@

-set(CYCLES_INSTALL_PATH "scripts/addons/cycles")
+if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND WITH_CYCLES_STANDALONE)
+       set(CYCLES_INSTALL_PATH "")
+else()
+       set(CYCLES_INSTALL_PATH "scripts/addons/cycles")
+endif()

 # External Libraries

@@ -100,3 +104,7 @@ add_subdirectory(render)
 add_subdirectory(subd)
 add_subdirectory(util)

+if(NOT WITH_BLENDER AND NOT WITH_PLAYER AND WITH_CYCLES_STANDALONE)
+       delayed_do_install(${CMAKE_BINARY_DIR})
+endif()
+
CMakeLists.txt
273

Typo: integration

Thomas Dinges (dingto) updated this revision to Unknown Object (????).Jan 20 2014, 3:41 PM

This works well Brecht, but I added "/bin" to the path.
This way we get the cycles executable and next to that 3 folders (shader, kernel, license). If these paths actually work for the standalone remains to be seen, but I'd consider this a separate task.

Also I don't check for "WITH_PLAYER" as you suggested, this should not have an influence for Cycles, it's only important to check if we build Blender or not I think. :)

Thomas Dinges (dingto) updated this revision to Unknown Object (????).Jan 20 2014, 3:45 PM

Forgot the actual config in last diff.

CMakeFiles/cmake.check_cache
1 ↗(On Diff #689)

Ignore this, sorry. :/

Brecht Van Lommel (brecht) requested changes to this revision.Jan 20 2014, 3:47 PM
Brecht Van Lommel (brecht) added inline comments.
CMakeLists.txt
273

Thinking about it, this can be left out entirely. If both WITH_BLENDER and WITH_CYCLES are true it can just do this automatically, no need for an option that is exposed to the user.

2259–2271

To avoid adding the same subdirectory twice, this should be:

if(WITH_BLENDER OR WITH_PLAYER)
  ...
elseif(WITH_CYCLES_STANDALONE)
  ...
endif()
Thomas Dinges (dingto) updated this revision to Unknown Object (????).Jan 20 2014, 4:03 PM

Changed it.

Not sure I understood correctly, what you meant with "not including the same subdirectory twice", changed this to "elseif" now, but I excplicitly only include cycles and glew for the standalone, so we don't compile any unnecessary overhead.

It's fine now.

I think running both add_subdirectory(intern) and add_subdirectory(intern/cycles) would add the cycles directory twice, with the elseif that's avoided.

Thanks for the review and help Brecht, commited now. :)