Revision: 14699 http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=14699 Author: mxcurioni Date: 2008-05-05 21:26:10 +0200 (Mon, 05 May 2008)
Log Message: ----------- soc-2008-mxcurioni: lib3ds compiles as an external library Modified Paths: -------------- branches/soc-2008-mxcurioni/SConstruct branches/soc-2008-mxcurioni/config/darwin-config.py branches/soc-2008-mxcurioni/extern/SConscript branches/soc-2008-mxcurioni/tools/Blender.py Added Paths: ----------- branches/soc-2008-mxcurioni/extern/freestyle/lib3ds/SConscript Removed Paths: ------------- branches/soc-2008-mxcurioni/extern/freestyle/SConscript Modified: branches/soc-2008-mxcurioni/SConstruct =================================================================== --- branches/soc-2008-mxcurioni/SConstruct 2008-05-05 19:19:27 UTC (rev 14698) +++ branches/soc-2008-mxcurioni/SConstruct 2008-05-05 19:26:10 UTC (rev 14699) @@ -269,7 +269,7 @@ print "clean dir %s"%(B.root_build_dir+dir) shutil.rmtree(B.root_build_dir+dir) for confile in ['extern/ffmpeg/config.mak', 'extern/x264/config.mak', - 'extern/xvidcore/build/generic/platform.inc']: + 'extern/xvidcore/build/generic/platform.inc','extern/freestyle/lib3ds/Makefile']: if os.path.exists(confile): print "clean file %s"%confile os.remove(confile) Modified: branches/soc-2008-mxcurioni/config/darwin-config.py =================================================================== --- branches/soc-2008-mxcurioni/config/darwin-config.py 2008-05-05 19:19:27 UTC (rev 14698) +++ branches/soc-2008-mxcurioni/config/darwin-config.py 2008-05-05 19:26:10 UTC (rev 14699) @@ -162,7 +162,7 @@ WITH_BF_FREESTYLE = 'true' BF_FREESTYLE = '#extern/freestyle' -BF_FREESTYLE_SRC = '${BF_FREESTYLE}/src' +BF_FREESTYLE_SRC = '#source/blender/freestyle/src' BF_SWIG = '${BF_FREESTYLE}/swig' BF_LIB3DS = '${BF_FREESTYLE}/lib3ds' BF_LIB3DS_LIB = 'extern_lib3ds' Modified: branches/soc-2008-mxcurioni/extern/SConscript =================================================================== --- branches/soc-2008-mxcurioni/extern/SConscript 2008-05-05 19:19:27 UTC (rev 14698) +++ branches/soc-2008-mxcurioni/extern/SConscript 2008-05-05 19:26:10 UTC (rev 14699) @@ -9,6 +9,9 @@ if env['WITH_BF_BULLET']: SConscript(['bullet2/src/SConscript']) +if env['WITH_BF_FREESTYLE']: + SConscript(['freestyle/lib3ds/SConscript']) + if env['WITH_BF_INTERNATIONAL']: SConscript(['bFTGL/SConscript']) Deleted: branches/soc-2008-mxcurioni/extern/freestyle/SConscript =================================================================== Added: branches/soc-2008-mxcurioni/extern/freestyle/lib3ds/SConscript =================================================================== --- branches/soc-2008-mxcurioni/extern/freestyle/lib3ds/SConscript (rev 0) +++ branches/soc-2008-mxcurioni/extern/freestyle/lib3ds/SConscript 2008-05-05 19:26:10 UTC (rev 14699) @@ -0,0 +1,113 @@ +#!/usr/bin/python + +Import('env') + +root = "extern/freestyle/lib3ds" + +import sys +import os +import re +import shutil + +from sets import Set + +lib3ds_env = env.Copy(); +lib3ds_env.Replace(CCFLAGS = '') +lib3ds_env.Replace(BF_DEBUG_FLAGS = '') + +makevardef = re.compile('^([a-zA-Z0-9_-]+)[ \t]*(\+?)=(.*)') +makevarsubst = re.compile('\$\(([^\)]+)\)') +makeifeq = re.compile('if(n?)eq \(([^,]*),([^\)]*)\)') + +def makeparseblock(fp, variables): + pendingline = '' + while 1: + line = fp.readline() + if pendingline: + line = pendingline + line + pendingline = '' + if not line: + return + if line.endswith('\\\n'): + pendingline = line[:-2] + continue + + i = line.find('#') + if i >= 0: + line = line[:i] + + iter = makevarsubst.finditer(line[:]) + for obj in iter: + (name) = obj.group(1) + s = "" + if name in variables: + s = variables[name] + line = line.replace('$(' + name + ')', s) + + matchobj = makevardef.match(line) + if matchobj: + (name, op, value) = matchobj.group(1, 2, 3) + + value = value.rstrip() + + if op == '+' and name in variables: + variables[name] += value + else: + variables[name] = value + continue + matchobj = makeifeq.match(line) + if matchobj: + (op, name1, name2) = matchobj.group(1, 2, 3) + if (op == '' and name1 == name2) or (op == 'n' and name1 != name2): + makeparseblock(fp, variables) + else: + tempvars = {} + makeparseblock(fp, tempvars) + continue + line = line.strip() + if line == 'endif': + return + +def getmakevars(filenames): + variables = { } + for filename in filenames: + fp = open(filename) + print "Processing makefile: " + filename + try: + makeparseblock(fp, variables) + finally: + fp.close() + + return variables + +print "Configuring lib3ds..." + +# Configure +os.chdir(root); + +if not os.path.isfile("Makefile"): + os.system("sh -c './configure'") +else: + print "(skipped, Makefile already exists)" + +# Makefile parsing +vars = getmakevars(['lib3ds/Makefile']) +srcs = vars['lib3ds_la_SOURCES'] +sources_temp = list(Set(srcs.split())) + +sources = [] +for source in sources_temp: + sources.append("lib3ds/" + source) + +defs = '' +cflags = '' + +print sources + +################## +lib3ds_env.BlenderLib (libname="extern_lib3ds", sources=sources, + includes=["."], + defines=Split(defs), + libtype=['blender'], + priority = [1], + compileflags = Split(cflags)) Modified: branches/soc-2008-mxcurioni/tools/Blender.py =================================================================== --- branches/soc-2008-mxcurioni/tools/Blender.py 2008-05-05 19:19:27 UTC (rev 14698) +++ branches/soc-2008-mxcurioni/tools/Blender.py 2008-05-05 19:26:10 UTC (rev 14699) @@ -163,7 +163,7 @@ syslibs += Split(lenv['BF_OPENEXR_LIB']) if lenv['WITH_BF_FFMPEG']: syslibs += Split(lenv['BF_FFMPEG_LIB']) - if lenv['WITH_BF_FREESTYLE']: + if lenv['WITH_BF_FREESTYLE']: syslibs += Split(lenv['BF_LIB3DS_LIB']) syslibs += Split(lenv['BF_SDL_LIB']) if not lenv['WITH_BF_STATICOPENGL']: _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org http://lists.blender.org/mailman/listinfo/bf-blender-cvs