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 ../../blenloader'
33 incs += ' ../../imbuf ../../makesdna ../../makesrna ../../ikplugin'
34 incs += ' ../../windowmanager ../../editors/include ../../blenfont'
35 incs += ' ../../render/extern/include'
36 incs += ' #/intern/audaspace/intern '
37 incs += ' #/extern/glew/include '
39 if env['WITH_BF_OPENEXR']:
40 defs.append('WITH_OPENEXR')
42 if env['WITH_BF_TIFF']:
43 defs.append('WITH_TIFF')
45 if env['WITH_BF_OPENJPEG']:
46 defs.append('WITH_OPENJPEG')
48 if env['WITH_BF_DDS']:
49 defs.append('WITH_DDS')
51 if env['WITH_BF_CINEON']:
52 defs.append('WITH_CINEON')
54 if env['WITH_BF_HDR']:
55 defs.append('WITH_HDR')
57 defs.append('WITH_FRAMESERVER') # TODO, make optional
59 if env['WITH_BF_FFMPEG']:
60 defs.append('WITH_FFMPEG')
61 incs += ' ' + env['BF_FFMPEG_INC']
63 if env['WITH_BF_OGG']:
64 defs.append('WITH_OGG')
66 if env['WITH_BF_QUICKTIME']:
67 defs.append('WITH_QUICKTIME')
68 incs += ' ../../quicktime'
70 if env['WITH_BF_GAMEENGINE']:
71 defs.append('WITH_GAMEENGINE')
73 if env['WITH_BF_FFTW3']:
74 defs.append('WITH_FFTW3')
76 if env['WITH_BF_SDL']:
77 defs.append('WITH_SDL')
79 if env['WITH_BF_OPENAL']:
80 defs.append('WITH_OPENAL')
82 if env['WITH_BF_JACK']:
83 defs.append('WITH_JACK')
85 if env['BF_UNIT_TEST']:
86 defs.append('UNIT_TEST')
88 if env['WITH_BF_PYTHON']:
89 defs.append('WITH_PYTHON')
91 if env['WITH_BF_COLLADA']:
92 defs.append('WITH_COLLADA')
94 if env['OURPLATFORM'] == 'linux':
96 incs += ' ../../../extern/binreloc/include'
98 if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
99 incs += ' ' + env['BF_PTHREADS_INC']
101 makesrna_tool.Append(CPPDEFINES=defs)
103 makesrna_tool.Append (CPPPATH = Split(incs))
105 if env['OURPLATFORM'] == 'linuxcross':
106 USE_WINE = True # when cross compiling on linux 64bit this is useful
111 if env['OURPLATFORM'] == 'linuxcross':
112 makesdna_tool.Replace(CC='gcc')
113 makesdna_tool.Replace(AR='ar')
114 makesdna_tool.Replace(LINK='gcc')
116 if sys.platform != 'cygwin':
117 makesrna_tool.Append (CCFLAGS = cflags)
118 makesrna_tool.Append (CPPDEFINES = defines)
120 libdir = root_build_dir+'/lib'
121 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
122 libdir = '#' + libdir
124 makesrna_tool.Append (LIBPATH = libdir)
126 makesrna_tool.Append( CFLAGS = env['CFLAGS'])
127 makesrna_tool.Append( CCFLAGS = env['CCFLAGS'])
128 makesrna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
130 if env['BF_PROFILE']:
131 makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
134 makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
135 makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
136 if env['OURPLATFORM'] in ('win32-vc','win64-vc'):
137 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
139 targetpath = root_build_dir+'/makesrna'
140 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
141 targetpath = '#' + targetpath
143 if env['OURPLATFORM'] == 'linux' and root_build_dir[0]==os.sep:
144 makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
146 makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_dna', 'bf_blenlib'])
148 rna_dict = rna.Dictionary()
149 rna.Depends (generated_files, makesrna)
151 # this seems bad, how to retrieve it from scons?
152 build_dir = root_build_dir + os.sep +'source' + os.sep + 'blender' + os.sep + 'makesrna' + os.sep + 'intern' + os.sep
154 if env['OURPLATFORM'] != 'linuxcross':
155 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
156 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna.exe\" \"" + build_dir )
158 rna.Command (generated_files, '', "\"" + root_build_dir+os.sep+"makesrna\" \"" + build_dir + '"' )
160 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
163 rna.Command (generated_files, '', 'wine ' + root_build_dir+os.sep+"makesrna.exe " + build_dir)
165 rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe " + build_dir)
168 obj = ['intern/rna_access.c']
169 for generated_file in generated_files:
170 obj += ['intern/' + generated_file]