Code refactor: add generic Cycles node infrastructure.
[blender-staging.git] / intern / cycles / app / CMakeLists.txt
1
2 set(INC
3         .
4         ../bvh
5         ../device
6         ../graph
7         ../kernel
8         ../kernel/svm
9         ../render
10         ../subd
11         ../util
12 )
13 set(INC_SYS
14 )
15
16 # NOTE: LIBRARIES contains all the libraries which are common
17 # across release and debug build types, stored in a linking order.
18 set(LIBRARIES
19         cycles_device
20         cycles_kernel
21         cycles_render
22         cycles_bvh
23         cycles_subd
24         cycles_graph
25         cycles_util
26         ${BLENDER_GL_LIBRARIES}
27         ${CYCLES_APP_GLEW_LIBRARY}
28         ${PNG_LIBRARIES}
29         ${JPEG_LIBRARIES}
30         ${ZLIB_LIBRARIES}
31         ${TIFF_LIBRARY}
32         ${PTHREADS_LIBRARIES}
33         extern_clew
34 )
35
36 if(WITH_CUDA_DYNLOAD)
37         list(APPEND LIBRARIES extern_cuew)
38 else()
39         list(APPEND LIBRARIES ${CUDA_CUDA_LIBRARY})
40 endif()
41
42 if(WITH_CYCLES_OSL)
43         list(APPEND LIBRARIES cycles_kernel_osl)
44 endif()
45
46 if(CYCLES_STANDALONE_REPOSITORY)
47         if(WITH_CYCLES_LOGGING)
48                 list(APPEND LIBRARIES
49                         ${GLOG_LIBRARIES}
50                         ${GFLAGS_LIBRARIES}
51                 )
52         endif()
53 else()
54         list(APPEND LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc)
55         if(WITH_CYCLES_LOGGING)
56                 list(APPEND LIBRARIES extern_glog extern_gflags)
57         endif()
58 endif()
59
60 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
61         list(APPEND LIBRARIES ${GLUT_LIBRARIES})
62 endif()
63
64 # Common configuration.
65
66 link_directories(${OPENIMAGEIO_LIBPATH}
67                  ${BOOST_LIBPATH}
68                  ${PNG_LIBPATH}
69                  ${JPEG_LIBPATH}
70                  ${ZLIB_LIBPATH}
71                  ${TIFF_LIBPATH}
72                  ${OPENEXR_LIBPATH})
73
74 add_definitions(${GL_DEFINITIONS})
75
76 include_directories(${INC})
77 include_directories(SYSTEM ${INC_SYS})
78
79 # Make sure given target is linked against proper libraries
80 # which varies across debug and release build types.
81 #
82 # This will also make sure dependencies of that libraries
83 # are sent to the linker after them.
84 #
85 # TODO(sergey): Think of a better place for this?
86 macro(cycles_target_link_libraries target)
87         target_link_libraries(${target} ${LIBRARIES})
88         if(WITH_CYCLES_OSL)
89                 target_link_libraries(${target} ${OSL_LIBRARIES} ${LLVM_LIBRARIES})
90         endif()
91         target_link_libraries(
92                 ${target}
93                 ${OPENIMAGEIO_LIBRARIES}
94                 ${OPENEXR_LIBRARIES}
95                 ${PUGIXML_LIBRARIES}
96                 ${BOOST_LIBRARIES}
97                 ${CMAKE_DL_LIBS}
98                 ${PLATFORM_LINKLIBS}
99         )
100 endmacro()
101
102 # Application build targets
103
104 if(WITH_CYCLES_STANDALONE)
105         set(SRC
106                 cycles_standalone.cpp
107                 cycles_xml.cpp
108                 cycles_xml.h
109         )
110         add_executable(cycles ${SRC})
111         cycles_target_link_libraries(cycles)
112
113         if(UNIX AND NOT APPLE)
114                 set_target_properties(cycles PROPERTIES INSTALL_RPATH $ORIGIN/lib)
115         endif()
116         unset(SRC)
117 endif()
118
119 if(WITH_CYCLES_NETWORK)
120         set(SRC
121                 cycles_server.cpp
122         )
123         add_executable(cycles_server ${SRC})
124         cycles_target_link_libraries(cycles_server)
125
126         if(UNIX AND NOT APPLE)
127                 set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
128         endif()
129         unset(SRC)
130 endif()