Merged changes in the trunk up to revision 55357.
[blender.git] / source / blender / render / SConscript
1 #!/usr/bin/env python
2 #
3 # ***** BEGIN GPL LICENSE BLOCK *****
4 #
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.
9 #
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.
14 #
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.
18 #
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
21 #
22 # The Original Code is: all of this file.
23 #
24 # Contributor(s): Nathan Letwory.
25 #
26 # ***** END GPL LICENSE BLOCK *****
27
28 Import ('env')
29
30 sources = env.Glob('intern/source/*.c')
31 raysources = env.Glob('intern/raytrace/*.cpp')
32
33 incs = 'intern/include #/intern/guardedalloc ../blenlib ../makesdna ../makesrna'
34 incs += ' extern/include ../blenkernel ../imbuf ../blenfont'
35 incs += ' ../include ../blenloader ../../../intern/smoke/extern ../../../intern/mikktspace ../bmesh'
36
37 cflags_raytrace = env['CCFLAGS']
38 cxxflags_raytrace = env['CXXFLAGS']
39
40 defs = []
41 defs_raytrace = []
42
43 if env['WITH_BF_SMOKE']:
44     defs.append('WITH_SMOKE')
45
46 if env['WITH_BF_PYTHON']:
47     incs += ' ../python'
48     incs += ' ' + env['BF_PYTHON_INC']
49     defs.append('WITH_PYTHON')
50     if env['BF_DEBUG']:
51         defs.append('DEBUG')
52
53 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
54     if env['WITH_BF_RAYOPTIMIZATION']:
55         cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
56         cxxflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
57
58 if env['OURPLATFORM'] in ('win32-mingw', 'win64-mingw'):
59     if env['WITH_BF_RAYOPTIMIZATION']:
60         cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
61         cxxflags_raytrace = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
62
63 if env['OURPLATFORM'] == 'darwin':
64     if env['MACOSX_ARCHITECTURE'] in ('i386', 'x86_64') and env['WITH_BF_RAYOPTIMIZATION']:
65         cflags_raytrace = env['CFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
66         cxxflags_raytrace = env['CXXFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
67         
68 if env['OURPLATFORM'] == 'linux':
69     if env['WITH_BF_RAYOPTIMIZATION']:
70         cflags_raytrace = env['CCFLAGS'] +  env['BF_RAYOPTIMIZATION_SSE_FLAGS']
71         cxxflags_raytrace = env['CXXFLAGS'] +  env['BF_RAYOPTIMIZATION_SSE_FLAGS']
72     incs += ' ../../../extern/binreloc/include'
73
74 if env['OURPLATFORM'] == 'linuxcross':
75     if env['WITH_BF_RAYOPTIMIZATION']:
76         cflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
77         cxxflags_raytrace = env['CCFLAGS'] + env['BF_RAYOPTIMIZATION_SSE_FLAGS']
78
79 if env['WITH_BF_QUICKTIME']:
80     defs.append('WITH_QUICKTIME')
81     incs += ' ../quicktime ' + env['BF_QUICKTIME_INC']
82
83 if env['WITH_BF_OPENEXR']:
84     defs.append('WITH_OPENEXR')
85
86 if env['WITH_BF_FREESTYLE']:
87     incs += ' ../freestyle'
88     defs.append('WITH_FREESTYLE')
89
90 if env['WITH_BF_GAMEENGINE']:
91     defs.append('WITH_GAMEENGINE')
92
93 if env['WITH_BF_INTERNATIONAL']:
94     defs.append('WITH_INTERNATIONAL')
95
96 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
97     incs += ' ' + env['BF_PTHREADS_INC']
98
99 #
100 # HACK: To fix problem with error 'MMX instruction set not enabled' from mmintrin.h
101 #
102 if env['OURPLATFORM'] == 'linuxcross':
103     defs.append('__SSE__')
104     defs_raytrace.append('__MMX__')
105
106 if env['WITH_BF_RAYOPTIMIZATION']:
107     defs.append('__SSE__')
108     defs_raytrace.append('__SSE__')
109
110 env.BlenderLib ( libname = 'bf_render', sources = sources, includes = Split(incs), defines=defs, libtype='core', priority=145 )
111 env.BlenderLib ( libname = 'bf_render_raytrace', sources = raysources, includes = Split(incs), defines=defs_raytrace, libtype='core', priority=145, compileflags=cflags_raytrace, cxx_compileflags=cxxflags_raytrace )