2.50: svn merge https://svn.blender.org/svnroot/bf-blender/trunk/blender -r17853...
[blender.git] / source / blender / makesrna / intern / SConscript
1 #!/usr/bin/python
2 import sys
3 import os
4
5 Import ('env')
6 cflags = '-Wall'
7 defines = []
8 root_build_dir=env['BF_BUILDDIR']
9
10 source_files = env.Glob('*.c')
11
12 # making rna_access.c part of both makesrna and blender seems to
13 # give conflict, how to solve?
14 source_files.remove('rna_access.c')
15 source_files.remove('rna_dependency.c')
16
17 generated_files = source_files[:]
18 generated_files.remove('rna_define.c')
19 generated_files.remove('makesrna.c')
20
21 generated_files = [filename[:-2] + '_gen.c' for filename in generated_files]
22
23 makesrna_tool = env.Clone()
24 rna = env.Clone()
25 makesrna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesrna/\\"" ')
26
27 makesrna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
28                                  '../../blenlib',
29                                  '../../blenkernel',
30                                  '../../makesdna',
31                                  '../../makesrna',
32                                                                  '../../windowmanager'])
33
34 if env['OURPLATFORM'] == 'linuxcross':
35     makesrna_tool.Replace(CC='gcc')
36     makesrna_tool.Replace(AR='ar')
37     makesrna_tool.Replace(LINK='gcc')
38
39 if sys.platform != 'cygwin':
40     makesrna_tool.Append (CCFLAGS = cflags)
41 makesrna_tool.Append (CPPDEFINES = defines)
42
43 libdir = root_build_dir+'/lib'
44 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
45         libdir = '#' + libdir
46
47 makesrna_tool.Append (LIBPATH = libdir)
48
49 if env['BF_PROFILE']:
50         makesrna_tool.Append (LINKFLAGS = env['BF_PROFILE_FLAGS'])
51
52 if env['BF_DEBUG']:
53         makesrna_tool.Append(CFLAGS = env['BF_DEBUG_CFLAGS'])
54         makesrna_tool.Append(CCFLAGS = env['BF_DEBUG_CCFLAGS'])
55         if env['OURPLATFORM'] == 'win32-vc':
56                 makesrna_tool.Append(LINKFLAGS = ['/DEBUG','/PDB:makesrna.pdb'])
57
58 targetpath = root_build_dir+'/makesrna'
59 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
60         targetpath = '#' + targetpath
61
62 if env['OURPLATFORM'] == 'linux2' and root_build_dir[0]==os.sep:
63     makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
64 else:
65     makesrna = makesrna_tool.Program (target = targetpath, source = source_files, LIBS=['bf_guardedalloc', 'bf_dna'])
66
67 rna_dict = rna.Dictionary()
68 rna.Depends (generated_files, makesrna)
69
70 # this seems bad, how to retrieve it from scons?
71 build_dir = root_build_dir + '/source/blender/makesrna/intern/'
72
73 if env['OURPLATFORM'] != 'linuxcross':
74     rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna " + build_dir)
75 else:
76     rna.Command (generated_files, '', root_build_dir+os.sep+"makesrna.exe "  + build_dir)
77
78 obj = ['intern/rna_access.c', 'intern/rna_dependency.c']
79 for generated_file in generated_files:
80         obj += ['intern/' + generated_file]
81
82 Return ('obj')
83