Cleanup: remove contributors for CMake files
[blender.git] / intern / opensubdiv / CMakeLists.txt
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
21 set(INC
22         .
23         ../guardedalloc
24 )
25
26 set(INC_SYS
27 )
28
29 set(SRC
30         opensubdiv_capi.h
31         opensubdiv_capi_type.h
32         opensubdiv_converter_capi.h
33         opensubdiv_evaluator_capi.h
34         opensubdiv_gl_mesh_capi.h
35         opensubdiv_topology_refiner_capi.h
36 )
37
38 if(WITH_OPENSUBDIV)
39         macro(OPENSUBDIV_DEFINE_COMPONENT component)
40                 if(${${component}})
41                         add_definitions(-D${component})
42                 endif()
43         endmacro()
44
45         list(APPEND INC_SYS
46                 ${OPENSUBDIV_INCLUDE_DIR}
47                 ${GLEW_INCLUDE_PATH}
48         )
49
50         list(APPEND SRC
51                 internal/opensubdiv.cc
52                 internal/opensubdiv_converter_factory.cc
53                 internal/opensubdiv_converter_internal.cc
54                 internal/opensubdiv_converter_orient.cc
55                 internal/opensubdiv_device_context_cuda.cc
56                 internal/opensubdiv_device_context_opencl.cc
57                 internal/opensubdiv_evaluator.cc
58                 internal/opensubdiv_evaluator_internal.cc
59                 internal/opensubdiv_gl_mesh.cc
60                 internal/opensubdiv_gl_mesh_draw.cc
61                 internal/opensubdiv_gl_mesh_fvar.cc
62                 internal/opensubdiv_gl_mesh_internal.cc
63                 internal/opensubdiv_topology_refiner.cc
64                 internal/opensubdiv_topology_refiner_internal.cc
65                 internal/opensubdiv_util.cc
66
67                 internal/opensubdiv_converter_factory.h
68                 internal/opensubdiv_converter_internal.h
69                 internal/opensubdiv_converter_orient.h
70                 internal/opensubdiv_converter_orient_impl.h
71                 internal/opensubdiv_device_context_cuda.h
72                 internal/opensubdiv_device_context_opencl.h
73                 internal/opensubdiv_edge_map.h
74                 internal/opensubdiv_evaluator_internal.h
75                 internal/opensubdiv_gl_mesh_draw.h
76                 internal/opensubdiv_gl_mesh_fvar.h
77                 internal/opensubdiv_gl_mesh_internal.h
78                 internal/opensubdiv_internal.h
79                 internal/opensubdiv_topology_refiner_internal.h
80                 internal/opensubdiv_util.h
81         )
82
83         OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
84         # TODO(sergey): OpenCL is not tested and totally unstable atm.
85         # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
86         # TODO(sergey): CUDA stays disabled for util it's ported to drievr API.
87         # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
88         OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
89         OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
90
91         data_to_c_simple(shader/gpu_shader_opensubdiv_vertex.glsl SRC)
92         data_to_c_simple(shader/gpu_shader_opensubdiv_geometry.glsl SRC)
93         data_to_c_simple(shader/gpu_shader_opensubdiv_fragment.glsl SRC)
94
95         add_definitions(-DGLEW_STATIC)
96
97         if(WIN32)
98                 add_definitions(-DNOMINMAX)
99                 add_definitions(-D_USE_MATH_DEFINES)
100         endif()
101
102         # TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.
103         #if(OPENSUBDIV_HAS_CUDA)
104         #       list(APPEND INC
105         #               ../../extern/cuew/include
106         #       )
107         #       add_definitions(-DOPENSUBDIV_HAS_CUEW)
108         #endif()
109
110         if(OPENSUBDIV_HAS_OPENCL)
111                 list(APPEND INC
112                         ../../extern/clew/include
113                 )
114                 add_definitions(-DOPENSUBDIV_HAS_CLEW)
115         endif()
116 else()
117         list(APPEND SRC
118                 stub/opensubdiv_stub.cc
119                 stub/opensubdiv_evaluator_stub.cc
120                 stub/opensubdiv_gl_mesh_stub.cc
121                 stub/opensubdiv_topology_refiner_stub.cc
122         )
123 endif()
124
125 blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}")