Cleanup: fix compiler warnings.
[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         ${OPENSUBDIV_INCLUDE_DIR}
33         ${GLEW_INCLUDE_PATH}
34 )
35
36 set(SRC
37         opensubdiv_capi.cc
38         opensubdiv_converter.cc
39         opensubdiv_device_context_cuda.cc
40         opensubdiv_device_context_opencl.cc
41         opensubdiv_evaluator_capi.cc
42         opensubdiv_gpu_capi.cc
43         opensubdiv_utils_capi.cc
44
45         opensubdiv_capi.h
46         opensubdiv_converter_capi.h
47         opensubdiv_device_context_cuda.h
48         opensubdiv_device_context_opencl.h
49         opensubdiv_intern.h
50         opensubdiv_topology_refiner.h
51 )
52
53 macro(OPENSUBDIV_DEFINE_COMPONENT component)
54         if(${${component}})
55                 add_definitions(-D${component})
56         endif()
57 endmacro()
58
59 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENMP)
60 # TODO(sergey): OpenCL is not tested and totally unstable atm.
61 # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_OPENCL)
62 # TODO(sergey): CUDA stays disabled for util it's ported to drievr API.
63 # OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_CUDA)
64 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_TRANSFORM_FEEDBACK)
65 OPENSUBDIV_DEFINE_COMPONENT(OPENSUBDIV_HAS_GLSL_COMPUTE)
66
67 data_to_c_simple(gpu_shader_opensubdiv_vertex.glsl SRC)
68 data_to_c_simple(gpu_shader_opensubdiv_geometry.glsl SRC)
69 data_to_c_simple(gpu_shader_opensubdiv_fragment.glsl SRC)
70
71 add_definitions(-DGLEW_STATIC)
72
73 if(WIN32)
74         add_definitions(-DNOMINMAX)
75         add_definitions(-D_USE_MATH_DEFINES)
76 endif()
77
78 # TODO(sergey): Put CUEW back when CUDA is officially supported by OSD.
79 #if(OPENSUBDIV_HAS_CUDA)
80 #       list(APPEND INC
81 #               ../../extern/cuew/include
82 #       )
83 #       add_definitions(-DOPENSUBDIV_HAS_CUEW)
84 #endif()
85
86 if(OPENSUBDIV_HAS_OPENCL)
87         list(APPEND INC
88                 ../../extern/clew/include
89         )
90         add_definitions(-DOPENSUBDIV_HAS_CLEW)
91 endif()
92
93 blender_add_lib(bf_intern_opensubdiv "${SRC}" "${INC}" "${INC_SYS}")