USD: on Apple disable USD if library cannot be found
[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 )
26
27 if(WITH_CUDA_DYNLOAD)
28   list(APPEND LIBRARIES extern_cuew)
29 else()
30   list(APPEND LIBRARIES ${CUDA_CUDA_LIBRARY})
31 endif()
32
33 if(WITH_CYCLES_OSL)
34   list(APPEND LIBRARIES cycles_kernel_osl)
35 endif()
36
37 if(NOT CYCLES_STANDALONE_REPOSITORY)
38   list(APPEND LIBRARIES bf_intern_glew_mx bf_intern_guardedalloc bf_intern_numaapi)
39 endif()
40
41 if(WITH_CYCLES_LOGGING)
42   list(APPEND LIBRARIES
43     ${GLOG_LIBRARIES}
44     ${GFLAGS_LIBRARIES}
45   )
46 endif()
47
48 if(WITH_CYCLES_STANDALONE AND WITH_CYCLES_STANDALONE_GUI)
49   list(APPEND LIBRARIES ${GLUT_LIBRARIES})
50 endif()
51
52 # Common configuration.
53
54 link_directories(${OPENIMAGEIO_LIBPATH}
55                  ${BOOST_LIBPATH}
56                  ${PNG_LIBPATH}
57                  ${JPEG_LIBPATH}
58                  ${ZLIB_LIBPATH}
59                  ${TIFF_LIBPATH}
60                  ${OPENEXR_LIBPATH}
61                  ${OPENJPEG_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     ${OPENJPEG_LIBRARIES}
98     ${PUGIXML_LIBRARIES}
99     ${BOOST_LIBRARIES}
100     ${CMAKE_DL_LIBS}
101     ${PLATFORM_LINKLIBS}
102   )
103 endmacro()
104
105 # Application build targets
106
107 if(WITH_CYCLES_STANDALONE)
108   set(SRC
109     cycles_standalone.cpp
110     cycles_xml.cpp
111     cycles_xml.h
112   )
113   add_executable(cycles ${SRC})
114   cycles_target_link_libraries(cycles)
115
116   if(UNIX AND NOT APPLE)
117     set_target_properties(cycles PROPERTIES INSTALL_RPATH $ORIGIN/lib)
118   endif()
119   unset(SRC)
120 endif()
121
122 if(WITH_CYCLES_NETWORK)
123   set(SRC
124     cycles_server.cpp
125   )
126   add_executable(cycles_server ${SRC})
127   cycles_target_link_libraries(cycles_server)
128
129   if(UNIX AND NOT APPLE)
130     set_target_properties(cycles_server PROPERTIES INSTALL_RPATH $ORIGIN/lib)
131   endif()
132   unset(SRC)
133 endif()
134
135 if(WITH_CYCLES_CUBIN_COMPILER)
136   # 32 bit windows is special, nvrtc is not supported on x86, so even
137   # though we are building 32 bit blender a 64 bit cubin_cc will have
138   # to be build to compile the cubins.
139   if(MSVC AND NOT CMAKE_CL_64)
140     message("Building with CUDA not supported on 32 bit, skipped")
141     set(WITH_CYCLES_CUDA_BINARIES OFF CACHE BOOL "" FORCE)
142   else()
143     set(SRC
144       cycles_cubin_cc.cpp
145     )
146     set(INC
147       ../../../extern/cuew/include
148     )
149     add_executable(cycles_cubin_cc ${SRC})
150     include_directories(${INC})
151     target_link_libraries(cycles_cubin_cc
152       extern_cuew
153       ${OPENIMAGEIO_LIBRARIES}
154       ${OPENEXR_LIBRARIES}
155       ${OPENJPEG_LIBRARIES}
156       ${PUGIXML_LIBRARIES}
157       ${BOOST_LIBRARIES}
158       ${PLATFORM_LINKLIBS}
159     )
160     if(NOT CYCLES_STANDALONE_REPOSITORY)
161       target_link_libraries(cycles_cubin_cc bf_intern_guardedalloc)
162     endif()
163     unset(SRC)
164     unset(INC)
165   endif()
166 endif()