Undo revision 23130 which was a merge with 2.5, a messy one because I did something...
[blender.git] / source / blender / makesdna / intern / SConscript
1 #!/usr/bin/python
2 import sys
3 import os
4
5 def normpath(path):
6         return os.path.abspath(os.path.normpath(path))
7
8 Import ('env')
9 cflags = ''
10 defines = []
11 root_build_dir=normpath(env['BF_BUILDDIR'])
12
13 source_files = ['makesdna.c']
14 header_files = env.Glob('../*.h')
15
16 makesdna_tool = env.Clone()
17 dna = env.Clone()
18 makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ')
19
20 makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
21                                                                  '../../makesdna'])
22
23 if env['OURPLATFORM'] == 'linuxcross':
24         USE_WINE = True # when cross compiling on linux 64bit this is useful
25 else:
26         USE_WINE = False
27
28 if not USE_WINE:
29         if env['OURPLATFORM'] == 'linuxcross':
30                 makesdna_tool.Replace(CC='gcc')
31                 makesdna_tool.Replace(AR='ar')
32                 makesdna_tool.Replace(LINK='gcc')
33
34 if sys.platform != 'cygwin':
35         makesdna_tool.Append (CCFLAGS = cflags)
36 makesdna_tool.Append (CPPDEFINES = defines)
37 targetdir = normpath(root_build_dir+'/lib')
38
39 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
40         targetdir = '#'+targetdir
41 makesdna_tool.Append (LIBPATH = targetdir)
42 if env['BF_PROFILE']:
43         makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_LINKFLAGS'])
44
45 targetdir = normpath(root_build_dir + '/makesdna')
46
47 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
48         targetdir = '#' + targetdir
49
50 makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_guardedalloc'])
51
52 dna_dict = dna.Dictionary()
53 dna.Depends ('dna.c', makesdna)
54 dna.Depends ('dna.c', header_files)
55 if env['OURPLATFORM'] != 'linuxcross':
56         if USE_WINE:
57                 dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna $TARGET")
58         else:
59                 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw'):
60                         dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
61                 else:
62                         dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna $TARGET")
63 else:
64         dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna.exe $TARGET")
65 obj = ['intern/dna.c', 'intern/dna_genfile.c']
66 Return ('obj')