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