3 # ***** BEGIN GPL LICENSE BLOCK *****
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # The Original Code is Copyright (C) 2011, Blender Foundation
20 # All rights reserved.
22 # The Original Code is: all of this file.
24 # Contributor(s): Nathan Letwory.
26 # ***** END GPL LICENSE BLOCK *****
33 cycles.Depends('../../source/blender/makesrna/intern/RNA_blender_cpp.h', 'makesrna')
35 sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob('kernel/*.cpp') + cycles.Glob('render/*.cpp') + cycles.Glob('subd/*.cpp') + cycles.Glob('util/*.cpp') + cycles.Glob('blender/*.cpp')
37 sources.remove(path.join('util', 'util_view.cpp'))
38 sources.remove(path.join('render', 'film_response.cpp'))
39 sources.remove(path.join('kernel', 'kernel_sse2.cpp'))
40 sources.remove(path.join('kernel', 'kernel_sse3.cpp'))
44 cxxflags = Split(env['CXXFLAGS'])
46 defs.append('GLEW_STATIC')
48 defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {')
49 defs.append('CCL_NAMESPACE_END=}')
51 defs.append('WITH_OPENCL')
52 defs.append('WITH_MULTI')
53 defs.append('WITH_CUDA')
55 if env['WITH_BF_CYCLES_OSL']:
56 defs.append('WITH_OSL')
57 defs.append('OSL_STATIC_LIBRARY')
58 incs.append(cycles['BF_OSL_INC'])
60 incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split())
61 incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split())
62 incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split())
63 incs.extend('#extern/glew/include #intern/mikktspace'.split())
64 incs.append(cycles['BF_OIIO_INC'])
65 incs.append(cycles['BF_BOOST_INC'])
66 incs.append(cycles['BF_OPENEXR_INC'].split())
67 incs.extend(cycles['BF_PYTHON_INC'].split())
69 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
70 cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
72 cxxflags.append('-ffast-math'.split())
74 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
75 incs.append(env['BF_PTHREADS_INC'])
78 if env['WITH_BF_RAYOPTIMIZATION']:
79 sse2_cxxflags = Split(env['CXXFLAGS'])
80 sse3_cxxflags = Split(env['CXXFLAGS'])
82 if env['OURPLATFORM'] == 'win32-vc':
83 sse2_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
84 sse3_cxxflags.append('/arch:SSE2 -D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
85 elif env['OURPLATFORM'] == 'win64-vc':
86 sse2_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
87 sse3_cxxflags.append('-D_CRT_SECURE_NO_WARNINGS /fp:fast /EHsc'.split())
89 sse2_cxxflags.append('-ffast-math -msse -msse2 -mfpmath=sse'.split())
90 sse3_cxxflags.append('-ffast-math -msse -msse2 -msse3 -mfpmath=sse'.split())
92 defs.append('WITH_OPTIMIZED_KERNEL')
95 cycles_sse3 = cycles.Clone()
96 sse3_sources = [path.join('kernel', 'kernel_sse3.cpp')]
97 cycles_sse3.BlenderLib('bf_intern_cycles_sse3', sse3_sources, incs, optim_defs, libtype=['intern'], priority=[10], cxx_compileflags=sse3_cxxflags)
99 cycles_sse2 = cycles.Clone()
100 sse2_sources = [path.join('kernel', 'kernel_sse2.cpp')]
101 cycles_sse2.BlenderLib('bf_intern_cycles_sse2', sse2_sources, incs, optim_defs, libtype=['intern'], priority=[10], cxx_compileflags=sse2_cxxflags)
103 cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0], cxx_compileflags=cxxflags)
105 if env['WITH_BF_CYCLES_OSL']:
106 oso_files = SConscript(['kernel/shaders/SConscript'])
107 cycles.Depends("kernel/osl/osl_shader.o", oso_files)
109 SConscript(['kernel/osl/SConscript'])
111 # cuda kernel binaries
112 if env['WITH_BF_CYCLES_CUDA_BINARIES']:
113 kernel_binaries = SConscript(['kernel/SConscript'])
114 cycles.Depends("device/device_cuda.o", kernel_binaries)