3 # ***** BEGIN GPL LICENSE BLOCK *****
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software Foundation,
17 # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 # The Original Code is Copyright (C) 2006, Blender Foundation
20 # All rights reserved.
22 # The Original Code is: all of this file.
24 # Contributor(s): Nathan Letwory.
26 # ***** END GPL LICENSE BLOCK *****
32 return os.path.abspath(os.path.normpath(path))
37 root_build_dir=normpath(env['BF_BUILDDIR'])
39 source_files = ['makesdna.c']
40 header_files = env.Glob('../*.h')
42 makesdna_tool = env.Clone()
44 makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ')
46 makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
48 '../../makesdna', '../../bmesh',
51 if env['OURPLATFORM'] == 'linuxcross':
52 USE_WINE = True # when cross compiling on linux 64bit this is useful
57 if env['OURPLATFORM'] == 'linuxcross':
58 makesdna_tool.Replace(CC='gcc')
59 makesdna_tool.Replace(AR='ar')
60 makesdna_tool.Replace(LINK='gcc')
62 if sys.platform != 'cygwin':
63 makesdna_tool.Append (CCFLAGS = cflags)
64 makesdna_tool.Append (CPPDEFINES = defines)
65 makesdna_tool.Append( CFLAGS = env['CFLAGS'])
66 makesdna_tool.Append( CCFLAGS = env['CCFLAGS'])
67 makesdna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
68 targetdir = normpath(root_build_dir+'/lib')
70 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
71 targetdir = '#'+targetdir
72 makesdna_tool.Append (LIBPATH = targetdir)
74 makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_LINKFLAGS'])
76 targetdir = normpath(root_build_dir + '/makesdna')
78 if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
79 targetdir = '#' + targetdir
81 makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_blenlib'])
83 dna_dict = dna.Dictionary()
84 dna.Depends ('dna.c', makesdna)
85 dna.Depends ('dna.c', header_files)
87 if env['OURPLATFORM'] != 'linuxcross':
88 if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
89 dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
91 dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
94 dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna $TARGET")
96 dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET")
98 # TODO, get WITH_DNA_GHASH working, see CMake's 'WITH_DNA_GHASH'
99 obj = ['intern/dna.c', 'intern/dna_genfile.c']