6 return os.path.abspath(os.path.normpath(path))
11 root_build_dir=normpath(env['BF_BUILDDIR'])
13 source_files = env.Glob('*.c')
14 source_files.remove('rna_access.c')
16 generated_files = source_files[:]
17 generated_files.remove('rna_define.c')
18 generated_files.remove('makesrna.c')
20 api_files = env.Glob('*_api.c')
21 for api_file in api_files:
22 generated_files.remove(api_file)
24 generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
26 makesrna_tool = env.Clone()
28 makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
32 incs = '#/intern/guardedalloc ../../blenlib ../../blenkernel'
33 incs += ' ../../imbuf ../../makesdna ../../makesrna'
34 incs += ' ../../windowmanager ../../editors/include'
35 incs += ' ../../render/extern/include'
37 if env['WITH_BF_OPENEXR']:
38 defs.append('WITH_OPENEXR')
40 if env['WITH_BF_OPENJPEG']:
41 defs.append('WITH_OPENJPEG')
43 if env['WITH_BF_DDS']:
44 defs.append('WITH_DDS')
46 if env['WITH_BF_FFMPEG']:
47 defs.append('WITH_FFMPEG')
48 incs += ' ' + env['BF_FFMPEG_INC']
50 if env['WITH_BF_OGG']:
51 defs.append('WITH_OGG')
53 if env['WITH_BF_QUICKTIME']:
54 defs.append('WITH_QUICKTIME')
56 if env['WITH_BF_LCMS']:
57 defs.append('WITH_LCMS')
59 if env['WITH_BF_GAMEENGINE']:
60 defs.append('GAMEBLENDER=1')
62 if env['WITH_BF_FFTW3']:
63 defs.append('FFTW3=1')
65 makesrna_tool.Append(CPPDEFINES=defs)
67 makesrna_tool.Append (CPPPATH = Split(incs))
69 if env['OURPLATFORM'] == 'linuxcross':
70 USE_WINE = True # when cross compiling on linux 64bit this is useful
75 if env['OURPLATFORM'] == 'linuxcross':
76 makesdna_tool.Replace(CC='gcc')
77 makesdna_tool.Replace(AR='ar')
78 makesdna_tool.Replace(LINK='gcc')
80 if sys.platform != 'cygwin':
81 makesrna_tool.Append (CCFLAGS = cflags)
82 makesrna_tool.Append (CPPDEFINES = defines)
84 libdir = root_build_dir+'/lib'
85 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
88 makesrna_tool.Append (LIBPATH = libdir)
91 makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
94 makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
95 makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
96 if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
97 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
99 targetpath = root_build_dir+'/makesrna'
100 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
101 targetpath = '#' + targetpath
103 if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
104 makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
106 makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
108 rna_dict = rna.Dictionary()
109 rna.Depends (generated_files, makesrna)
111 # this seems bad, how to retrieve it from scons?
112 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
114 if env['OURPLATFORM'] != 'linuxcross':
115 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
116 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \"" + build_dir )
118 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna " + build_dir)
120 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
123 rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe " + build_dir)
125 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
128 obj = ['intern/rna_access.c']
129 for generated_file in generated_files:
130 obj += ['intern/' + generated_file]