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) 2006, 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 *****
32 return os.path.abspath(os.path.normpath(path))
35 cflags = [] #['-Wall']
37 root_build_dir=normpath(env['BF_BUILDDIR'])
39 source_files = env.Glob('*.c')
40 source_files.remove('rna_access.c')
42 generated_files = source_files[:]
43 generated_files.remove('rna_define.c')
44 generated_files.remove('makesrna.c')
46 api_files = env.Glob('*_api.c')
47 for api_file in api_files:
48 generated_files.remove(api_file)
50 generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
52 makesrna_tool = env.Clone()
54 makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
59 '#/intern/guardedalloc',
60 '#/extern/glew/include',
61 '#/intern/audaspace/intern',
62 '#/intern/cycles/blender',
63 '#/intern/smoke/extern',
68 '../../editors/include',
73 '../../render/extern/include',
74 '../../windowmanager',
78 if env['WITH_BF_SMOKE']:
79 defs.append('WITH_SMOKE')
81 if env['WITH_BF_BULLET']:
82 defs.append('WITH_BULLET')
83 incs += ' #/intern/rigidbody'
85 if env['WITH_BF_OPENEXR']:
86 defs.append('WITH_OPENEXR')
88 if env['WITH_BF_TIFF']:
89 defs.append('WITH_TIFF')
91 if env['WITH_BF_OPENJPEG']:
92 defs.append('WITH_OPENJPEG')
94 if env['WITH_BF_DDS']:
95 defs.append('WITH_DDS')
97 if env['WITH_BF_CINEON']:
98 defs.append('WITH_CINEON')
100 if env['WITH_BF_HDR']:
101 defs.append('WITH_HDR')
103 if env['WITH_BF_FRAMESERVER']:
104 defs.append('WITH_FRAMESERVER')
106 if env['WITH_BF_FFMPEG']:
107 defs.append('WITH_FFMPEG')
108 incs += ' ' + env['BF_FFMPEG_INC']
110 if env['WITH_BF_QUICKTIME']:
111 defs.append('WITH_QUICKTIME')
112 incs += ' ../../quicktime'
114 if env['WITH_BF_GAMEENGINE']:
115 defs.append('WITH_GAMEENGINE')
117 if env['WITH_BF_FFTW3']:
118 defs.append('WITH_FFTW3')
120 if env['WITH_BF_SDL']:
121 defs.append('WITH_SDL')
123 if env['WITH_BF_OPENAL']:
124 defs.append('WITH_OPENAL')
126 if env['WITH_BF_JACK']:
127 defs.append('WITH_JACK')
129 if env['BF_UNIT_TEST']:
130 defs.append('UNIT_TEST')
132 if env['WITH_BF_PYTHON']:
133 defs.append('WITH_PYTHON')
135 if env['WITH_BF_COLLADA']:
136 defs.append('WITH_COLLADA')
138 if env['WITH_BF_CYCLES']:
139 defs.append('WITH_CYCLES')
141 if env['OURPLATFORM'] == 'linux':
144 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'):
145 incs += ' ' + env['BF_PTHREADS_INC']
147 if env['WITH_BF_INTERNATIONAL']:
148 defs.append('WITH_INTERNATIONAL')
150 if not env['BF_DEBUG']:
151 defs.append('NDEBUG')
153 makesrna_tool.Append(CPPDEFINES=defs)
155 makesrna_tool.Append (CPPPATH = Split(incs))
157 if env['OURPLATFORM'] == 'linuxcross':
158 USE_WINE = True # when cross compiling on linux 64bit this is useful
163 if env['OURPLATFORM'] == 'linuxcross':
164 makesdna_tool.Replace(CC='gcc')
165 makesdna_tool.Replace(AR='ar')
166 makesdna_tool.Replace(LINK='gcc')
168 if sys.platform != 'cygwin':
169 makesrna_tool.Append (CCFLAGS = cflags)
170 makesrna_tool.Append (CPPDEFINES = defines)
172 libdir = root_build_dir+'/lib'
173 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
174 libdir = '#' + libdir
176 makesrna_tool.Append (LIBPATH = libdir)
178 makesrna_tool.Append( CFLAGS = env['CFLAGS'])
179 makesrna_tool.Append( CCFLAGS = env['CCFLAGS'])
180 makesrna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
182 if env['BF_PROFILE']:
183 makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
186 makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
187 makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
188 if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
189 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
191 targetpath = root_build_dir+'/makesrna'
192 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
193 targetpath = '#' + targetpath
195 if env['OURPLATFORM'] == 'linux' and root_build_dir[0]==os.sep:
196 makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
198 makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
200 rna_dict = rna.Dictionary()
201 rna.Depends (generated_files, makesrna)
203 # this seems bad, how to retrieve it from scons?
204 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
206 if env['OURPLATFORM'] != 'linuxcross':
207 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
208 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \"" + build_dir )
210 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna\" \"" + build_dir + '"' )
212 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
215 rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe " + build_dir)
217 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
220 obj = ['intern/rna_access.c']
221 for generated_file in generated_files:
222 obj += ['intern/' + generated_file]