2012-12-17 08:01:43 +00:00
|
|
|
#!/usr/bin/env python
|
|
|
|
#
|
|
|
|
# ***** BEGIN GPL LICENSE BLOCK *****
|
|
|
|
#
|
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
|
# along with this program; if not, write to the Free Software Foundation,
|
|
|
|
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
#
|
|
|
|
# The Original Code is Copyright (C) 2006, Blender Foundation
|
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# The Original Code is: all of this file.
|
|
|
|
#
|
|
|
|
# Contributor(s): Nathan Letwory.
|
|
|
|
#
|
|
|
|
# ***** END GPL LICENSE BLOCK *****
|
|
|
|
|
2004-04-11 21:11:18 +00:00
|
|
|
import sys
|
2005-05-06 13:37:18 +00:00
|
|
|
import os
|
2004-04-11 21:11:18 +00:00
|
|
|
|
2009-03-30 07:28:37 +00:00
|
|
|
def normpath(path):
|
2010-08-29 20:52:05 +00:00
|
|
|
return os.path.abspath(os.path.normpath(path))
|
2009-03-30 07:28:37 +00:00
|
|
|
|
2006-02-04 14:15:10 +00:00
|
|
|
Import ('env')
|
|
|
|
cflags = ''
|
|
|
|
defines = []
|
2009-03-30 07:28:37 +00:00
|
|
|
root_build_dir=normpath(env['BF_BUILDDIR'])
|
2004-01-04 21:11:59 +00:00
|
|
|
|
2007-03-27 10:50:03 +00:00
|
|
|
source_files = ['makesdna.c']
|
2008-10-31 23:50:02 +00:00
|
|
|
header_files = env.Glob('../*.h')
|
2004-01-04 21:11:59 +00:00
|
|
|
|
2008-11-07 19:21:52 +00:00
|
|
|
makesdna_tool = env.Clone()
|
|
|
|
dna = env.Clone()
|
2007-03-05 20:50:36 +00:00
|
|
|
makesdna_tool.Append(CCFLAGS = '-DBASE_HEADER="\\"source/blender/makesdna/\\"" ')
|
2004-01-04 21:11:59 +00:00
|
|
|
|
2004-01-04 21:42:01 +00:00
|
|
|
makesdna_tool.Append (CPPPATH = ['#/intern/guardedalloc',
|
2011-03-17 23:30:29 +00:00
|
|
|
'../../makesdna', '../../blenloader', '../../bmesh'])
|
2004-01-04 21:42:01 +00:00
|
|
|
|
2006-03-13 11:42:49 +00:00
|
|
|
if env['OURPLATFORM'] == 'linuxcross':
|
2010-08-29 20:52:05 +00:00
|
|
|
USE_WINE = True # when cross compiling on linux 64bit this is useful
|
2008-12-14 17:32:24 +00:00
|
|
|
else:
|
2010-08-29 20:52:05 +00:00
|
|
|
USE_WINE = False
|
2008-12-14 17:32:24 +00:00
|
|
|
|
|
|
|
if not USE_WINE:
|
2010-08-29 20:52:05 +00:00
|
|
|
if env['OURPLATFORM'] == 'linuxcross':
|
|
|
|
makesdna_tool.Replace(CC='gcc')
|
|
|
|
makesdna_tool.Replace(AR='ar')
|
|
|
|
makesdna_tool.Replace(LINK='gcc')
|
2006-03-13 11:42:49 +00:00
|
|
|
|
2004-04-11 21:11:18 +00:00
|
|
|
if sys.platform != 'cygwin':
|
2010-08-29 20:52:05 +00:00
|
|
|
makesdna_tool.Append (CCFLAGS = cflags)
|
2004-01-04 21:42:01 +00:00
|
|
|
makesdna_tool.Append (CPPDEFINES = defines)
|
2009-09-16 17:43:09 +00:00
|
|
|
makesdna_tool.Append( CFLAGS = env['CFLAGS'])
|
|
|
|
makesdna_tool.Append( CCFLAGS = env['CCFLAGS'])
|
|
|
|
makesdna_tool.Append( LINKFLAGS = env['PLATFORM_LINKFLAGS'])
|
2009-03-30 07:28:37 +00:00
|
|
|
targetdir = normpath(root_build_dir+'/lib')
|
|
|
|
|
2008-11-11 21:37:53 +00:00
|
|
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
2010-08-29 20:52:05 +00:00
|
|
|
targetdir = '#'+targetdir
|
2008-11-11 21:37:53 +00:00
|
|
|
makesdna_tool.Append (LIBPATH = targetdir)
|
2008-10-31 23:50:02 +00:00
|
|
|
if env['BF_PROFILE']:
|
2010-08-29 20:52:05 +00:00
|
|
|
makesdna_tool.Append (LINKFLAGS = env['BF_PROFILE_LINKFLAGS'])
|
2006-03-13 11:42:49 +00:00
|
|
|
|
2009-03-30 07:28:37 +00:00
|
|
|
targetdir = normpath(root_build_dir + '/makesdna')
|
2008-11-11 20:26:53 +00:00
|
|
|
|
2008-11-11 21:37:53 +00:00
|
|
|
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
|
2010-08-29 20:52:05 +00:00
|
|
|
targetdir = '#' + targetdir
|
2008-11-11 20:26:53 +00:00
|
|
|
|
2010-09-07 05:47:34 +00:00
|
|
|
makesdna = makesdna_tool.Program (target = targetdir, source = source_files, LIBS=['bf_intern_guardedalloc', 'bf_blenlib'])
|
2004-01-04 21:11:59 +00:00
|
|
|
|
|
|
|
dna_dict = dna.Dictionary()
|
2007-03-05 06:38:30 +00:00
|
|
|
dna.Depends ('dna.c', makesdna)
|
2008-10-31 23:50:02 +00:00
|
|
|
dna.Depends ('dna.c', header_files)
|
2009-03-08 07:15:41 +00:00
|
|
|
|
2006-03-13 11:42:49 +00:00
|
|
|
if env['OURPLATFORM'] != 'linuxcross':
|
2012-04-24 12:57:58 +00:00
|
|
|
if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'):
|
2010-08-29 20:52:05 +00:00
|
|
|
dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
|
|
|
|
else:
|
|
|
|
dna.Command ('dna.c', '', "\"" + root_build_dir+os.sep+"makesdna\" $TARGET")
|
2010-02-01 18:39:41 +00:00
|
|
|
else:
|
2010-08-29 20:52:05 +00:00
|
|
|
if USE_WINE:
|
|
|
|
dna.Command ('dna.c', '', 'wine ' + root_build_dir+os.sep+"makesdna $TARGET")
|
|
|
|
else:
|
|
|
|
dna.Command ('dna.c', '', root_build_dir+os.sep+"makesdna.exe $TARGET")
|
2010-02-01 18:39:41 +00:00
|
|
|
|
2011-08-20 14:23:43 +00:00
|
|
|
# TODO, get WITH_DNA_GHASH working, see CMake's 'WITH_DNA_GHASH'
|
2008-10-31 23:50:02 +00:00
|
|
|
obj = ['intern/dna.c', 'intern/dna_genfile.c']
|
2004-01-04 21:11:59 +00:00
|
|
|
Return ('obj')
|