Merge branch 'blender2.7'
[blender.git] / intern / cycles / app / CMakeLists.txt
1
2 set(INC
3         ..
4 )
5 set(INC_SYS
6 )
7
8 # NOTE: LIBRARIES contains all the libraries which are common
9 # across release and debug build types, stored in a linking order.
10 set(LIBRARIES
11         cycles_device
12         cycles_kernel
13         cycles_render
14         cycles_bvh
15         cycles_subd
16         cycles_graph
17         cycles_util
18         ${BLENDER_GL_LIBRARIES}
19         ${CYCLES_APP_GLEW_LIBRARY}
20         ${PNG_LIBRARIES}
21         ${JPEG_LIBRARIES}
22         ${ZLIB_LIBRARIES}
23         ${TIFF_LIBRARY}
24         ${PTHREADS_LIBRARIES}
25         extern_clew
26 )
27
28 if(WITH_CUDA_DYNLOAD)
29         list(APPEND LIBRARIES extern_cuew)
30 else()
31         list(APPEND LIBRARIES ${CUDA_CUDA_LIBRARY})
32 endif()
33
34 if(WITH_CYCLES_OSL)
35         list(APPEND LIBRARIES cycles_kernel_osl)
36 endif()
37
38 if(NOT CYCLES_STANDALONE_REPOSITORY)
39         list(APPEND LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc bf_intern_numaapi)
40 endif()
41
42 if(WITH_CYCLES_LOGGING)
43         list(APPEND LIBRARIES
44                 ${GLOG_LIBRARIES}
45                 ${GFLAGS_LIBRARIES}
46         )
47 endif()
48
49 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
50         list(APPEND LIBRARIES ${GLUT_LIBRARIES})
51 endif()
52
53 # Common configuration.
54
55 link_directories(${OPENIMAGEIO_LIBPATH}
56                  ${BOOST_LIBPATH}
57                  ${PNG_LIBPATH}
58                  ${JPEG_LIBPATH}
59                  ${ZLIB_LIBPATH}
60                  ${TIFF_LIBPATH}
61                  ${OPENEXR_LIBPATH})
62
63 if(WITH_OPENCOLORIO)
64         link_directories(${OPENCOLORIO_LIBPATH})
65 endif()
66
67 add_definitions(${GL_DEFINITIONS})
68
69 include_directories(${INC})
70 include_directories(SYSTEM ${INC_SYS})
71
72 # Make sure given target is linked against proper libraries
73 # which varies across debug and release build types.
74 #
75 # This will also make sure dependencies of that libraries
76 # are sent to the linker after them.
77 #
78 # TODO(sergey): Think of a better place for this?
79 macro(cycles_target_link_libraries target)
80         target_link_libraries(${target} ${LIBRARIES})
81         if(WITH_CYCLES_OSL)
82                 target_link_libraries(${target} ${OSL_LIBRARIES} ${LLVM_LIBRARIES})
83         endif()
84         if(WITH_CYCLES_EMBREE)
85                 target_link_libraries(${target} ${EMBREE_LIBRARIES})
86         endif()
87         if(WITH_OPENSUBDIV)
88                 target_link_libraries(${target} ${OPENSUBDIV_LIBRARIES})
89         endif()
90         if(WITH_OPENCOLORIO)
91                 target_link_libraries(${target} ${OPENCOLORIO_LIBRARIES})
92         endif()
93         target_link_libraries(
94                 ${target}
95                 ${OPENIMAGEIO_LIBRARIES}
96                 ${OPENEXR_LIBRARIES}
97                 ${PUGIXML_LIBRARIES}
98                 ${BOOST_LIBRARIES}
99                 ${CMAKE_DL_LIBS}
100                 ${PLATFORM_LINKLIBS}
101         )
102 endmacro()
103
104 # Application build targets
105
106 if(WITH_CYCLES_STANDALONE)
107         set(SRC
108                 cycles_standalone.cpp
109                 cycles_xml.cpp
110                 cycles_xml.h
111         )
112         add_executable(cycles ${SRC})
113         cycles_target_link_libraries(cycles)
114
115         if(UNIX AND NOT APPLE)
116                 set_target_properties(cycles PROPERTIES INSTALL_RPATH $ORIGIN/lib)
117         endif()
118         unset(SRC)
119 endif()
120
121 if(WITH_CYCLES_NETWORK)
122         set(SRC
123                 cycles_server.cpp
124         )
125         add_executable(cycles_server ${SRC})
126         cycles_target_link_libraries(cycles_server)
127
128         if(UNIX AND NOT APPLE)
129                 set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
130         endif()
131         unset(SRC)
132 endif()
133
134 if(WITH_CYCLES_CUBIN_COMPILER)
135         # 32 bit windows is special, nvrtc is not supported on x86, so even
136         # though we are building 32 bit blender a 64 bit cubin_cc will have
137         # to be build to compile the cubins.
138         if(MSVC AND NOT CMAKE_CL_64)
139                 message("Building with CUDA not supported on 32 bit, skipped")
140                 set(WITH_CYCLES_CUDA_BINARIES OFF CACHE BOOL "" FORCE)
141         else()
142                 set(SRC
143                         cycles_cubin_cc.cpp
144                 )
145                 set(INC
146                         ../../../extern/cuew/include
147                 )
148                 add_executable(cycles_cubin_cc ${SRC})
149                 include_directories(${INC})
150                 target_link_libraries(cycles_cubin_cc
151                         extern_cuew
152                         ${OPENIMAGEIO_LIBRARIES}
153                         ${OPENEXR_LIBRARIES}
154                         ${PUGIXML_LIBRARIES}
155                         ${BOOST_LIBRARIES}
156                         ${PLATFORM_LINKLIBS}
157                 )
158                 if(NOT CYCLES_STANDALONE_REPOSITORY)
159                         target_link_libraries(cycles_cubin_cc bf_intern_guardedalloc)
160                 endif()
161                 unset(SRC)
162                 unset(INC)
163         endif()
164 endif()