Fix for missing updates of build scripts in the commit rB05cb63ecf750.
[blender.git] / source / blender / makesrna / intern / 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 sys
29 import os
30
31 def normpath(path):
32     return os.path.abspath(os.path.normpath(path))
33
34 Import ('env')
35 cflags = [] #['-Wall']
36 defines = []
37 root_build_dir=normpath(env['BF_BUILDDIR'])
38
39 source_files = env.Glob('*.c')
40 source_files.remove('rna_access.c')
41
42 generated_files = source_files[:]
43 generated_files.remove('rna_define.c')
44 generated_files.remove('makesrna.c')
45
46 api_files = env.Glob('*_api.c')
47 for api_file in api_files:
48     generated_files.remove(api_file)
49
50 generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
51
52 makesrna_tool = env.Clone()
53 rna = env.Clone()
54 makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
55
56 defs = []
57
58 incs = [
59     '#/intern/guardedalloc',
60     '#/extern/glew/include',
61     '#/intern/audaspace/intern',
62     '#/intern/cycles/blender',
63     '#/intern/smoke/extern',
64     '../../blenfont',
65     '../../blenkernel',
66     '../../blenlib',
67     '../../bmesh',
68     '../../editors/include',
69     '../../ikplugin',
70     '../../imbuf',
71     '../../makesdna',
72     '../../makesrna',
73     '../../render/extern/include',
74     '../../windowmanager',
75     ]
76 incs = ' '.join(incs)
77
78 if env['WITH_BF_SMOKE']:
79     defs.append('WITH_SMOKE')
80
81 if env['WITH_BF_BULLET']:
82     defs.append('WITH_BULLET')
83     incs += ' #/intern/rigidbody'
84
85 if env['WITH_BF_OIIO']:
86     defs.append('WITH_OPENIMAGEIO')
87
88 if env['WITH_BF_OPENEXR']:
89     defs.append('WITH_OPENEXR')
90
91 if env['WITH_BF_TIFF']:
92     defs.append('WITH_TIFF')
93
94 if env['WITH_BF_OPENJPEG']:
95     defs.append('WITH_OPENJPEG')
96
97 if env['WITH_BF_DDS']:
98     defs.append('WITH_DDS')
99
100 if env['WITH_BF_CINEON']:
101     defs.append('WITH_CINEON')
102
103 if env['WITH_BF_HDR']:
104     defs.append('WITH_HDR')
105
106 if env['WITH_BF_FRAMESERVER']:
107     defs.append('WITH_FRAMESERVER')
108
109 if env['WITH_BF_FFMPEG']:
110     defs.append('WITH_FFMPEG')
111     incs += ' ' + env['BF_FFMPEG_INC'] + ' #/intern/ffmpeg'
112
113 if env['WITH_BF_QUICKTIME']:
114     defs.append('WITH_QUICKTIME')
115     incs += ' ../../quicktime'
116
117 if env['WITH_BF_GAMEENGINE']:
118     defs.append('WITH_GAMEENGINE')
119     
120 if env['WITH_BF_FFTW3']:
121     defs.append('WITH_FFTW3')
122
123 if env['WITH_BF_SDL']:
124     defs.append('WITH_SDL')
125
126 if env['WITH_BF_OPENAL']:
127     defs.append('WITH_OPENAL')
128
129 if env['WITH_BF_JACK']:
130     defs.append('WITH_JACK')
131
132 if env['BF_UNIT_TEST']:
133     defs.append('UNIT_TEST')
134
135 if env['WITH_BF_PYTHON']:
136     defs.append('WITH_PYTHON')
137
138 if env['WITH_BF_COLLADA']:
139     defs.append('WITH_COLLADA')
140
141 if env['WITH_BF_CYCLES']:
142     defs.append('WITH_CYCLES')
143
144 if env['WITH_BF_FREESTYLE']:
145     defs.append('WITH_FREESTYLE')
146
147 if env['OURPLATFORM'] == 'linux':
148     cflags='-pthread'
149
150 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
151     incs += ' ' + env['BF_PTHREADS_INC']
152
153 if env['WITH_BF_INTERNATIONAL']:
154     defs.append('WITH_INTERNATIONAL')
155
156 if not env['BF_DEBUG']:
157     defs.append('NDEBUG')
158
159 makesrna_tool.Append(CPPDEFINES=defs)
160
161 makesrna_tool.Append (CPPPATH = Split(incs))
162
163 if env['OURPLATFORM'] == 'linuxcross':
164     USE_WINE = True # when cross compiling on linux 64bit this is useful
165 else:
166     USE_WINE = False
167
168 if not USE_WINE:
169     if env['OURPLATFORM'] == 'linuxcross':
170         makesdna_tool.Replace(CC='gcc')
171         makesdna_tool.Replace(AR='ar')
172         makesdna_tool.Replace(LINK='gcc')
173
174 if sys.platform != 'cygwin':
175     makesrna_tool.Append (CCFLAGS = cflags)
176 makesrna_tool.Append (CPPDEFINES = defines)
177
178 libdir = root_build_dir+'/lib'
179 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
180     libdir = '#' + libdir
181
182 makesrna_tool.Append (LIBPATH = libdir)
183
184 makesrna_tool.Append( CFLAGS = env['CFLAGS'])
185 makesrna_tool.Append( CCFLAGS = env['CCFLAGS'])
186 makesrna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
187
188 if env['BF_PROFILE']:
189     makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
190
191 if env['BF_DEBUG']:
192     makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
193     makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
194     if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
195         makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
196
197 targetpath = root_build_dir+'/makesrna'
198 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
199     targetpath = '#' + targetpath
200
201 if env['OURPLATFORM'] == 'linux' and root_build_dir[0]==os.sep:
202     makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
203 else:
204     makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
205
206 rna_dict = rna.Dictionary()
207 rna.Depends (generated_files, makesrna)
208
209 build_dir = Dir(".").abspath + os.sep
210     
211 if env['OURPLATFORM'] != 'linuxcross':
212     if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
213         rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \""  + build_dir )
214     else:
215         rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna\" \""  + build_dir + '"' )
216 else:
217     rna.Command (generated_files, '', ('', 'wine ')[USE_WINE] + root_build_dir+os.sep+"makesrna.exe "  + build_dir)
218
219
220 obj = ['intern/rna_access.c']
221 for generated_file in generated_files:
222     obj += ['intern/' + generated_file]
223
224 Return ('obj')
225