CMakeLists.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # ***** BEGIN GPL LICENSE BLOCK *****
  2. #
  3. # This program is free software; you can redistribute it and/or
  4. # modify it under the terms of the GNU General Public License
  5. # as published by the Free Software Foundation; either version 2
  6. # of the License, or (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program; if not, write to the Free Software Foundation,
  15. # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  16. #
  17. # The Original Code is Copyright (C) 2013, Blender Foundation
  18. # All rights reserved.
  19. # ***** END GPL LICENSE BLOCK *****
  20. set(INC
  21. .
  22. ../guardedalloc
  23. )
  24. set(INC_SYS
  25. )
  26. set(SRC
  27. opensubdiv_capi.h
  28. opensubdiv_capi_type.h
  29. opensubdiv_converter_capi.h
  30. opensubdiv_evaluator_capi.h
  31. opensubdiv_gl_mesh_capi.h
  32. opensubdiv_topology_refiner_capi.h
  33. )
  34. set(LIB
  35. )
  36. if(WITH_OPENSUBDIV)
  37. macro(OPENSUBDIV_DEFINE_COMPONENT component)
  38. if(${${component}})
  39. add_definitions(-D${component})
  40. endif()
  41. endmacro()
  42. list(APPEND INC_SYS
  43. ${OPENSUBDIV_INCLUDE_DIR}
  44. ${GLEW_INCLUDE_PATH}
  45. )
  46. list(APPEND SRC
  47. internal/opensubdiv.cc
  48. internal/opensubdiv_converter_factory.cc
  49. internal/opensubdiv_converter_internal.cc
  50. internal/opensubdiv_converter_orient.cc
  51. internal/opensubdiv_device_context_cuda.cc
  52. internal/opensubdiv_device_context_opencl.cc
  53. internal/opensubdiv_evaluator.cc
  54. internal/opensubdiv_evaluator_internal.cc
  55. internal/opensubdiv_gl_mesh.cc
  56. internal/opensubdiv_gl_mesh_draw.cc
  57. internal/opensubdiv_gl_mesh_fvar.cc
  58. internal/opensubdiv_gl_mesh_internal.cc
  59. internal/opensubdiv_topology_refiner.cc
  60. internal/opensubdiv_topology_refiner_internal.cc
  61. internal/opensubdiv_util.cc
  62. internal/opensubdiv_converter_factory.h
  63. internal/opensubdiv_converter_internal.h
  64. internal/opensubdiv_converter_orient.h
  65. internal/opensubdiv_converter_orient_impl.h
  66. internal/opensubdiv_device_context_cuda.h
  67. internal/opensubdiv_device_context_opencl.h
  68. internal/opensubdiv_edge_map.h
  69. internal/opensubdiv_evaluator_internal.h
  70. internal/opensubdiv_gl_mesh_draw.h
  71. internal/opensubdiv_gl_mesh_fvar.h
  72. internal/opensubdiv_gl_mesh_internal.h
  73. internal/opensubdiv_internal.h
  74. internal/opensubdiv_topology_refiner_internal.h
  75. internal/opensubdiv_util.h
  76. )
  77. OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
  78. # TODO(sergey): OpenCL is not tested and totally unstable atm.
  79. # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
  80. # TODO(sergey): CUDA stays disabled for util it's ported to drievr API.
  81. # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
  82. OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
  83. OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
  84. data_to_c_simple(shader/gpu_shader_opensubdiv_vertex.glsl SRC)
  85. data_to_c_simple(shader/gpu_shader_opensubdiv_geometry.glsl SRC)
  86. data_to_c_simple(shader/gpu_shader_opensubdiv_fragment.glsl SRC)
  87. add_definitions(-DGLEW_STATIC)
  88. if(WIN32)
  89. add_definitions(-DNOMINMAX)
  90. add_definitions(-D_USE_MATH_DEFINES)
  91. endif()
  92. # TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.
  93. #if(OPENSUBDIV_HAS_CUDA)
  94. # list(APPEND INC
  95. # ../../extern/cuew/include
  96. # )
  97. # add_definitions(-DOPENSUBDIV_HAS_CUEW)
  98. #endif()
  99. if(OPENSUBDIV_HAS_OPENCL)
  100. list(APPEND INC
  101. ../../extern/clew/include
  102. )
  103. add_definitions(-DOPENSUBDIV_HAS_CLEW)
  104. endif()
  105. else()
  106. list(APPEND SRC
  107. stub/opensubdiv_stub.cc
  108. stub/opensubdiv_evaluator_stub.cc
  109. stub/opensubdiv_gl_mesh_stub.cc
  110. stub/opensubdiv_topology_refiner_stub.cc
  111. )
  112. endif()
  113. blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")