From 581970a64000e7637c5edfc6dfa852bc354d0cee Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Thu, 5 Apr 2007 05:14:50 +0000 Subject: [PATCH] === SCons === * enable TWEAK_MODE with BF_TWEAK_MODE=1 on cmd-line. Can also be specified in user-config.py --- SConstruct | 296 +++++++++++++++++----------------- source/blender/src/SConscript | 5 +- tools/Blender.py | 2 +- tools/btools.py | 8 +- 4 files changed, 159 insertions(+), 152 deletions(-) diff --git a/SConstruct b/SConstruct index 92ca04fc12f..3cea4b24e87 100644 --- a/SConstruct +++ b/SConstruct @@ -275,154 +275,154 @@ if not B.root_build_dir[-1]==os.sep: def NSIS_Installer(): - if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw': - print "NSIS installer is only available on Windows." - Exit() - - install_base_dir = os.getcwd() + "\\" - - os.chdir("release") - v = open("VERSION") - version = v.read()[:-1] - shortver = version.split('.')[0] + version.split('.')[1] - v.close() - - #### change to suit install dir #### - inst_dir = install_base_dir + env['BF_INSTALLDIR'] + if env['OURPLATFORM'] != 'win32-vc' and env['OURPLATFORM'] != 'win32-mingw': + print "NSIS installer is only available on Windows." + Exit() + + install_base_dir = os.getcwd() + "\\" - os.chdir("windows/installer") - - ns = open("00.sconsblender.nsi","r") - - ns_cnt = str(ns.read()) - ns.close() - - # do root - rootlist = [] - rootdir = os.listdir(inst_dir+"\\") - for rootitem in rootdir: - if os.path.isdir(inst_dir+"\\"+ rootitem) == 0: - rootlist.append("File " + inst_dir + "\\" + rootitem) - rootstring = string.join(rootlist, "\n ") - rootstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring) - - # do delete items - delrootlist = [] - for rootitem in rootdir: - if os.path.isdir(inst_dir + rootitem) == 0: - delrootlist.append("Delete $INSTDIR\\" + rootitem) - delrootstring = string.join(delrootlist, "\n ") - delrootstring += "\n" - ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) - - # do scripts - scriptlist = [] - scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts") - scriptdir = os.listdir(scriptpath) - for scriptitem in scriptdir: - scriptfile = "%s\\%s" % (scriptpath, scriptitem) - if os.path.isdir(scriptfile) == 0: - scriptlist.append("File %s" % scriptfile) - scriptstring = string.join(scriptlist, "\n ") - scriptstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring) - - # do scripts\bpymodules - bpymodlist = [] - bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules") - bpymoddir = os.listdir(bpymodpath) - - for bpymoditem in bpymoddir: - bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem) - if os.path.isdir(bpymodfile) == 0: - bpymodlist.append("File %s" % bpymodfile) - bpymodstring = string.join(bpymodlist, "\n ") - bpymodstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring) - - # do scripts\bpymodules\colladaimex - colladalist = [] - bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx") - bpymoddir = os.listdir(bpymodpath) - - for bpymoditem in bpymoddir: - bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem) - if os.path.isdir(bpymodfile) == 0: - colladalist.append("File %s" % bpymodfile) - bpymodstring = string.join(colladalist, "\n ") - bpymodstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring) - - # do scripts\bpydata - bpydatalist = [] - bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata") - bpydatadir = os.listdir(bpydatapath) - for bpydataitem in bpydatadir: - bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem) - if os.path.isdir(bpydatafile) == 0: - bpydatalist.append("File %s" % bpydatafile) - bpydatastring = string.join(bpydatalist, "\n ") - bpydatastring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring) - - # do plugins\include - plugincludelist = [] - plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include") - plugincludedir = os.listdir(plugincludepath) - for plugincludeitem in plugincludedir: - plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem) - if os.path.isdir(plugincludefile) == 0: - if plugincludefile.find('.h') or plugincludefile.find('.DEF'): - plugincludelist.append("File %s" % plugincludefile) - plugincludestring = string.join(plugincludelist, "\n ") - plugincludestring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring) - - # do scripts\bpydata\config - cfglist = [] - cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config") - cfgdir = os.listdir(cfgpath) - for cfgitem in cfgdir: - cfgfile = "%s\\%s" % (cfgpath, cfgitem) - if os.path.isdir(cfgfile) == 0: - cfglist.append("File %s" % cfgfile) - cfgstring = string.join(cfglist, "\n ") - cfgstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring) - - # do dotblender - dotblendlist = [] - dotblenddir = os.listdir(inst_dir+"\\.blender") - for dotblenditem in dotblenddir: - if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0: - dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem) - dotblendstring = string.join(dotblendlist, "\n ") - dotblendstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring) - - # do language files - langlist = [] - langfiles = [] - langdir = os.listdir(inst_dir + "\\.blender\\locale") - for langitem in langdir: - if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1: - langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES") - langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo") - langstring = string.join(langfiles, "\n ") - langstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring) - - # var replacements - ns_cnt = string.replace(ns_cnt, "DISTDIR", inst_dir+"\\") - ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver) - ns_cnt = string.replace(ns_cnt, "VERSION", version) - - new_nsis = open("00.blender_tmp.nsi", 'w') - new_nsis.write(ns_cnt) - new_nsis.close() - - sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w') + os.chdir("release") + v = open("VERSION") + version = v.read()[:-1] + shortver = version.split('.')[0] + version.split('.')[1] + v.close() + + #### change to suit install dir #### + inst_dir = install_base_dir + env['BF_INSTALLDIR'] + + os.chdir("windows/installer") + + ns = open("00.sconsblender.nsi","r") + + ns_cnt = str(ns.read()) + ns.close() + + # do root + rootlist = [] + rootdir = os.listdir(inst_dir+"\\") + for rootitem in rootdir: + if os.path.isdir(inst_dir+"\\"+ rootitem) == 0: + rootlist.append("File " + inst_dir + "\\" + rootitem) + rootstring = string.join(rootlist, "\n ") + rootstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring) + + # do delete items + delrootlist = [] + for rootitem in rootdir: + if os.path.isdir(inst_dir + rootitem) == 0: + delrootlist.append("Delete $INSTDIR\\" + rootitem) + delrootstring = string.join(delrootlist, "\n ") + delrootstring += "\n" + ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) + + # do scripts + scriptlist = [] + scriptpath = "%s%s" % (inst_dir, "\\.blender\\scripts") + scriptdir = os.listdir(scriptpath) + for scriptitem in scriptdir: + scriptfile = "%s\\%s" % (scriptpath, scriptitem) + if os.path.isdir(scriptfile) == 0: + scriptlist.append("File %s" % scriptfile) + scriptstring = string.join(scriptlist, "\n ") + scriptstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[SCRIPTCONTS]", scriptstring) + + # do scripts\bpymodules + bpymodlist = [] + bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules") + bpymoddir = os.listdir(bpymodpath) + + for bpymoditem in bpymoddir: + bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem) + if os.path.isdir(bpymodfile) == 0: + bpymodlist.append("File %s" % bpymodfile) + bpymodstring = string.join(bpymodlist, "\n ") + bpymodstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCONTS]", bpymodstring) + + # do scripts\bpymodules\colladaimex + colladalist = [] + bpymodpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpymodules\\ColladaImEx") + bpymoddir = os.listdir(bpymodpath) + + for bpymoditem in bpymoddir: + bpymodfile = "%s\\%s" % (bpymodpath, bpymoditem) + if os.path.isdir(bpymodfile) == 0: + colladalist.append("File %s" % bpymodfile) + bpymodstring = string.join(colladalist, "\n ") + bpymodstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[SCRIPTMODCOLLADACONT]", bpymodstring) + + # do scripts\bpydata + bpydatalist = [] + bpydatapath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata") + bpydatadir = os.listdir(bpydatapath) + for bpydataitem in bpydatadir: + bpydatafile = "%s\\%s" % (bpydatapath, bpydataitem) + if os.path.isdir(bpydatafile) == 0: + bpydatalist.append("File %s" % bpydatafile) + bpydatastring = string.join(bpydatalist, "\n ") + bpydatastring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACONTS]", bpydatastring) + + # do plugins\include + plugincludelist = [] + plugincludepath = "%s%s" % (inst_dir, "\\plugins\\include") + plugincludedir = os.listdir(plugincludepath) + for plugincludeitem in plugincludedir: + plugincludefile = "%s\\%s" % (plugincludepath, plugincludeitem) + if os.path.isdir(plugincludefile) == 0: + if plugincludefile.find('.h') or plugincludefile.find('.DEF'): + plugincludelist.append("File %s" % plugincludefile) + plugincludestring = string.join(plugincludelist, "\n ") + plugincludestring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[PLUGINCONTS]", plugincludestring) + + # do scripts\bpydata\config + cfglist = [] + cfgpath = "%s%s" % (inst_dir, "\\.blender\\scripts\\bpydata\\config") + cfgdir = os.listdir(cfgpath) + for cfgitem in cfgdir: + cfgfile = "%s\\%s" % (cfgpath, cfgitem) + if os.path.isdir(cfgfile) == 0: + cfglist.append("File %s" % cfgfile) + cfgstring = string.join(cfglist, "\n ") + cfgstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[SCRIPTDATACFGCONTS]", cfgstring) + + # do dotblender + dotblendlist = [] + dotblenddir = os.listdir(inst_dir+"\\.blender") + for dotblenditem in dotblenddir: + if os.path.isdir(inst_dir + "\\.blender\\" + dotblenditem) == 0: + dotblendlist.append("File " + inst_dir + "\\.blender\\" + dotblenditem) + dotblendstring = string.join(dotblendlist, "\n ") + dotblendstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[DOTBLENDERCONTS]", dotblendstring) + + # do language files + langlist = [] + langfiles = [] + langdir = os.listdir(inst_dir + "\\.blender\\locale") + for langitem in langdir: + if os.path.isdir(inst_dir + "\\.blender\\locale\\" + langitem) == 1: + langfiles.append("SetOutPath $BLENDERHOME\\.blender\\locale\\" + langitem + "\\LC_MESSAGES") + langfiles.append("File " + inst_dir + "\\.blender\\locale\\" + langitem + "\\LC_MESSAGES\\blender.mo") + langstring = string.join(langfiles, "\n ") + langstring += "\n\n" + ns_cnt = string.replace(ns_cnt, "[LANGUAGECONTS]", langstring) + + # var replacements + ns_cnt = string.replace(ns_cnt, "DISTDIR", inst_dir+"\\") + ns_cnt = string.replace(ns_cnt, "SHORTVER", shortver) + ns_cnt = string.replace(ns_cnt, "VERSION", version) + + new_nsis = open("00.blender_tmp.nsi", 'w') + new_nsis.write(ns_cnt) + new_nsis.close() + + sys.stdout = os.popen("makensis 00.blender_tmp.nsi", 'w') nsis_build = None if 'nsis' in B.targets: @@ -582,7 +582,7 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): '${LCGDIR}/zlib/lib/zlib.dll', '${LCGDIR}/tiff/lib/libtiff.dll'] if env['BF_DEBUG']: - dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}_d.dll') + dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll') else: dllsources.append('${LCGDIR}/python/lib/${BF_PYTHON_LIB}.dll') if env['OURPLATFORM'] == 'win32-mingw': diff --git a/source/blender/src/SConscript b/source/blender/src/SConscript index 215b0b2977a..815cf532c88 100644 --- a/source/blender/src/SConscript +++ b/source/blender/src/SConscript @@ -9,7 +9,7 @@ maxobj = 30 numlibs = numobj / maxobj if (numobj % maxobj): - numlibs = numlibs + 1 + numlibs = numlibs + 1 subsources = [] if (env['OURPLATFORM'] == 'win32-mingw'): @@ -33,6 +33,9 @@ incs += ' ' + env['BF_OPENGL_INC'] defs = [] +if env['BF_TWEAK_MODE'] == 1: + defs.append('TWEAK_MODE') + if env['WITH_BF_YAFRAY'] == 0: defs.append('DISABLE_YAFRAY') diff --git a/tools/Blender.py b/tools/Blender.py index a578139bdb8..87181b7dc0d 100644 --- a/tools/Blender.py +++ b/tools/Blender.py @@ -142,7 +142,7 @@ def setup_syslibs(lenv): lenv['BF_PNG_LIB'], lenv['BF_ZLIB_LIB'] ] - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): + if lenv['BF_DEBUG']==1 and lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): syslibs.append(lenv['BF_PYTHON_LIB']+'_d') else: syslibs.append(lenv['BF_PYTHON_LIB']) diff --git a/tools/btools.py b/tools/btools.py index 0a3e6793137..fba884ed09b 100755 --- a/tools/btools.py +++ b/tools/btools.py @@ -44,7 +44,9 @@ def validate_arguments(args, bc): 'C_WARN', 'CC_WARN', 'LLIBS', 'PLATFORM_LINKFLAGS', 'BF_PROFILE_FLAGS', 'LCGDIR', 'WITH_BF_VERSE', 'BF_VERSE_INCLUDE', - 'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO'] + 'VERSE_BUILD_BINARY', 'VERSE_BUILD_DIR', 'VERSE_REGEN_PROTO', + 'BF_TWEAK_MODE' + ] arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE', 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME', @@ -287,7 +289,9 @@ def read_opts(cfg, args): ('CC', 'C compiler to use', ''), ('CXX', 'C++ compiler to use', ''), - (BoolOption('BF_BUILDINFO', 'Buildtime in splash if true', 'true')) + (BoolOption('BF_BUILDINFO', 'Buildtime in splash if true', 'true')), + + (BoolOption('BF_TWEAK_MODE', 'Enable tweak mode if true', 'false')), ) # end of opts.AddOptions()