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