2008-10-31 23:50:02 +00:00
|
|
|
#!/usr/bin/python
|
|
|
|
|
import sys
|
|
|
|
|
import os
|
|
|
|
|
|
2009-03-30 07:28:37 +00:00
|
|
|
def normpath(path):
|
|
|
|
|
return os.path.abspath(os.path.normpath(path))
|
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
Import ('env')
|
2009-01-01 15:52:51 +00:00
|
|
|
cflags = '-Wall'
|
2008-10-31 23:50:02 +00:00
|
|
|
defines = []
|
2009-03-30 07:28:37 +00:00
|
|
|
root_build_dir=normpath(env['BF_BUILDDIR'])
|
2008-10-31 23:50:02 +00:00
|
|
|
|
|
|
|
|
source_files = env.Glob('*.c')
|
|
|
|
|
source_files.remove('rna_access.c')
|
|
|
|
|
|
2009-01-08 13:57:29 +00:00
|
|
|
generated_files = source_files[:]
|
|
|
|
|
generated_files.remove('rna_define.c')
|
|
|
|
|
generated_files.remove('makesrna.c')
|
|
|
|
|
generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
|
|
|
|
|
|
2009-04-08 16:40:46 +00:00
|
|
|
source_files.extend(env.Glob('../../editors/*/*_api.c'))
|
|
|
|
|
|
2008-11-07 19:21:52 +00:00
|
|
|
makesrna_tool = env.Clone()
|
|
|
|
|
rna = env.Clone()
|
2008-10-31 23:50:02 +00:00
|
|
|
makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
|
|
|
|
|
|
2009-06-09 10:30:16 +00:00
|
|
|
defs = []
|
|
|
|
|
|
|
|
|
|
if env['WITH_BF_OPENEXR']:
|
|
|
|
|
defs.append('WITH_OPENEXR')
|
|
|
|
|
|
|
|
|
|
if env['WITH_BF_OPENJPEG']:
|
|
|
|
|
defs.append('WITH_OPENJPEG')
|
|
|
|
|
|
|
|
|
|
if env['WITH_BF_DDS']:
|
|
|
|
|
defs.append('WITH_DDS')
|
|
|
|
|
|
|
|
|
|
if env['WITH_BF_FFMPEG']:
|
|
|
|
|
defs.append('WITH_FFMPEG')
|
|
|
|
|
|
|
|
|
|
if env['WITH_BF_QUICKTIME']:
|
|
|
|
|
defs.append('WITH_QUICKTIME')
|
|
|
|
|
|
|
|
|
|
makesrna_tool.Append(CPPDEFINES=defs)
|
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
makesrna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
|
2009-04-16 10:45:21 +00:00
|
|
|
'../../blenlib',
|
|
|
|
|
'../../blenkernel',
|
|
|
|
|
'../../makesdna',
|
|
|
|
|
'../../makesrna',
|
2009-04-07 00:49:39 +00:00
|
|
|
'../../windowmanager',
|
2009-04-08 16:40:46 +00:00
|
|
|
'../../editors/include'])
|
2008-10-31 23:50:02 +00:00
|
|
|
|
|
|
|
|
if env['OURPLATFORM'] == 'linuxcross':
|
2009-01-28 09:32:31 +00:00
|
|
|
USE_WINE = True # when cross compiling on linux 64bit this is useful
|
|
|
|
|
else:
|
|
|
|
|
USE_WINE = False
|
|
|
|
|
|
|
|
|
|
if not USE_WINE:
|
|
|
|
|
if env['OURPLATFORM'] == 'linuxcross':
|
|
|
|
|
makesdna_tool.Replace(CC='gcc')
|
|
|
|
|
makesdna_tool.Replace(AR='ar')
|
|
|
|
|
makesdna_tool.Replace(LINK='gcc')
|
2008-10-31 23:50:02 +00:00
|
|
|
|
|
|
|
|
if sys.platform != 'cygwin':
|
2009-04-16 10:45:21 +00:00
|
|
|
makesrna_tool.Append (CCFLAGS = cflags)
|
2008-10-31 23:50:02 +00:00
|
|
|
makesrna_tool.Append (CPPDEFINES = defines)
|
2008-11-30 13:25:59 +00:00
|
|
|
|
|
|
|
|
libdir = root_build_dir+'/lib'
|
|
|
|
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
|
|
|
|
libdir = '#' + libdir
|
|
|
|
|
|
|
|
|
|
makesrna_tool.Append (LIBPATH = libdir)
|
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
if env['BF_PROFILE']:
|
|
|
|
|
makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
|
|
|
|
|
|
2008-12-01 21:13:49 +00:00
|
|
|
if env['BF_DEBUG']:
|
|
|
|
|
makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
|
|
|
|
|
makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
|
|
|
|
|
if env['OURPLATFORM'] == 'win32-vc':
|
|
|
|
|
makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
|
|
|
|
|
|
2008-11-30 13:25:59 +00:00
|
|
|
targetpath = root_build_dir+'/makesrna'
|
|
|
|
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
|
|
|
|
targetpath = '#' + targetpath
|
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
|
2009-04-16 10:45:21 +00:00
|
|
|
makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
|
2008-10-31 23:50:02 +00:00
|
|
|
else:
|
2009-04-16 10:45:21 +00:00
|
|
|
makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
|
2008-10-31 23:50:02 +00:00
|
|
|
|
|
|
|
|
rna_dict = rna.Dictionary()
|
2009-01-08 13:57:29 +00:00
|
|
|
rna.Depends (generated_files, makesrna)
|
|
|
|
|
|
|
|
|
|
# this seems bad, how to retrieve it from scons?
|
2009-04-16 10:45:21 +00:00
|
|
|
build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
|
2009-01-08 13:57:29 +00:00
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
if env['OURPLATFORM'] != 'linuxcross':
|
2009-04-16 10:45:21 +00:00
|
|
|
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
|
|
|
|
|
rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \"" + build_dir )
|
|
|
|
|
else:
|
|
|
|
|
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna " + build_dir)
|
2008-10-31 23:50:02 +00:00
|
|
|
else:
|
2009-04-16 10:45:21 +00:00
|
|
|
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
|
2009-01-28 09:32:31 +00:00
|
|
|
|
2009-04-16 10:45:21 +00:00
|
|
|
if USE_WINE:
|
|
|
|
|
rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe " + build_dir)
|
|
|
|
|
else:
|
|
|
|
|
rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
|
2009-01-28 09:32:31 +00:00
|
|
|
|
2009-01-08 13:57:29 +00:00
|
|
|
|
2009-03-23 13:24:48 +00:00
|
|
|
obj = ['intern/rna_access.c']
|
2009-01-08 13:57:29 +00:00
|
|
|
for generated_file in generated_files:
|
|
|
|
|
obj += ['intern/' + generated_file]
|
|
|
|
|
|
2008-10-31 23:50:02 +00:00
|
|
|
Return ('obj')
|
|
|
|
|
|