CMakeLists.txt 3.9 KB

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