diff options
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 197 |
1 files changed, 100 insertions, 97 deletions
diff --git a/SConstruct b/SConstruct index 30d8788f040..811298cc851 100644 --- a/SConstruct +++ b/SConstruct @@ -46,15 +46,22 @@ import glob import re from tempfile import mkdtemp -import tools.Blender -import tools.btools -import tools.bcolors +# store path to tools +toolpath=os.path.join(".", "build_files", "scons", "tools") + +# needed for importing tools +sys.path.append(toolpath) + +import Blender +import btools +import bcolors EnsureSConsVersion(1,0,0) -BlenderEnvironment = tools.Blender.BlenderEnvironment -btools = tools.btools -B = tools.Blender +BlenderEnvironment = Blender.BlenderEnvironment +B = Blender + +VERSION = btools.VERSION # This is used in creating the local config directories ### globals ### platform = sys.platform @@ -117,7 +124,7 @@ if toolset: print "Using " + toolset if toolset=='mstoolkit': env = BlenderEnvironment(ENV = os.environ) - env.Tool('mstoolkit', ['tools']) + env.Tool('mstoolkit', [toolpath]) else: env = BlenderEnvironment(tools=[toolset], ENV = os.environ) # xxx commented out, as was supressing warnings under mingw.. @@ -157,7 +164,7 @@ if crossbuild and platform not in ('win32-vc', 'win64-vc'): env['OURPLATFORM'] = platform -configfile = 'config'+os.sep+platform+'-config.py' +configfile = os.path.join("build_files", "scons", "config", platform + "-config.py") if os.path.exists(configfile): print B.bc.OKGREEN + "Using config file: " + B.bc.ENDC + configfile @@ -166,7 +173,7 @@ else: if crossbuild and env['PLATFORM'] != 'win32': print B.bc.HEADER+"Preparing for crossbuild"+B.bc.ENDC - env.Tool('crossmingw', ['tools']) + env.Tool('crossmingw', [toolpath]) # todo: determine proper libs/includes etc. # Needed for gui programs, console programs should do without it @@ -182,7 +189,7 @@ if os.path.exists(userconfig): else: print B.bc.WARNING + userconfig + " not found, no user overrides" + B.bc.ENDC -opts = btools.read_opts(optfiles, B.arguments) +opts = btools.read_opts(env, optfiles, B.arguments) opts.Update(env) if not env['BF_FANCY']: @@ -193,7 +200,7 @@ if not env['BF_FANCY']: # NOTE: only do the scripts directory for now, otherwise is too disruptive for developers # TODO: perhaps we need an option (off by default) to not do this altogether... if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']: - scriptsDir = env['BF_INSTALLDIR'] + os.sep + '.blender' + os.sep + 'scripts' + scriptsDir = os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts') if os.path.isdir(scriptsDir): print B.bc.OKGREEN + "Clearing installation directory%s: %s" % (B.bc.ENDC, os.path.abspath(scriptsDir)) shutil.rmtree(scriptsDir) @@ -201,15 +208,38 @@ if not env['WITHOUT_BF_INSTALL'] and not env['WITHOUT_BF_OVERWRITE_INSTALL']: SetOption('num_jobs', int(env['BF_NUMJOBS'])) print B.bc.OKGREEN + "Build with parallel jobs%s: %s" % (B.bc.ENDC, GetOption('num_jobs')) +print B.bc.OKGREEN + "Build with debug symbols%s: %s" % (B.bc.ENDC, env['BF_DEBUG']) -# BLENDERPATH is a unix only option to enable typical style paths this is -# spesifically a data-dir, which is used a lot but cant replace BF_INSTALLDIR -# because the blender binary is installed in $BF_INSTALLDIR/bin/blender +if 'blenderlite' in B.targets: + target_env_defs = {} + target_env_defs['WITH_BF_GAMEENGINE'] = False + target_env_defs['WITH_BF_OPENAL'] = False + target_env_defs['WITH_BF_OPENEXR'] = False + target_env_defs['WITH_BF_OPENMP'] = False + target_env_defs['WITH_BF_ICONV'] = False + target_env_defs['WITH_BF_INTERNATIONAL'] = False + target_env_defs['WITH_BF_OPENJPEG'] = False + target_env_defs['WITH_BF_FFMPEG'] = False + target_env_defs['WITH_BF_QUICKTIME'] = False + target_env_defs['WITH_BF_REDCODE'] = False + target_env_defs['WITH_BF_DDS'] = False + target_env_defs['WITH_BF_CINEON'] = False + target_env_defs['WITH_BF_HDR'] = False + target_env_defs['WITH_BF_ZLIB'] = False + target_env_defs['WITH_BF_SDL'] = False + target_env_defs['WITH_BF_JPEG'] = False + target_env_defs['WITH_BF_PNG'] = False + target_env_defs['WITH_BF_BULLET'] = False + target_env_defs['WITH_BF_BINRELOC'] = False + target_env_defs['BF_BUILDINFO'] = False + target_env_defs['BF_NO_ELBEEM'] = True + target_env_defs['WITH_BF_PYTHON'] = False + + # Merge blenderlite, let command line to override + for k,v in target_env_defs.iteritems(): + if k not in B.arguments: + env[k] = v -if env['WITH_BF_FHS']: - BLENDERPATH = os.path.join(env['BF_INSTALLDIR'], 'share', 'blender', env['BF_VERSION']) -else: - BLENDERPATH = env['BF_INSTALLDIR'] if env['WITH_BF_OPENMP'] == 1: if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'): @@ -263,33 +293,6 @@ if 'blenderplayer' in B.targets: if 'blendernogame' in B.targets: env['WITH_BF_GAMEENGINE'] = False -if 'blenderlite' in B.targets: - target_env_defs = {} - target_env_defs['WITH_BF_GAMEENGINE'] = False - target_env_defs['WITH_BF_OPENAL'] = False - target_env_defs['WITH_BF_OPENEXR'] = False - target_env_defs['WITH_BF_ICONV'] = False - target_env_defs['WITH_BF_INTERNATIONAL'] = False - target_env_defs['WITH_BF_OPENJPEG'] = False - target_env_defs['WITH_BF_FFMPEG'] = False - target_env_defs['WITH_BF_QUICKTIME'] = False - target_env_defs['WITH_BF_REDCODE'] = False - target_env_defs['WITH_BF_DDS'] = False - target_env_defs['WITH_BF_ZLIB'] = False - target_env_defs['WITH_BF_SDL'] = False - target_env_defs['WITH_BF_JPEG'] = False - target_env_defs['WITH_BF_PNG'] = False - target_env_defs['WITH_BF_BULLET'] = False - target_env_defs['WITH_BF_BINRELOC'] = False - target_env_defs['BF_BUILDINFO'] = False - target_env_defs['BF_NO_ELBEEM'] = True - target_env_defs['WITH_BF_PYTHON'] = False - - # Merge blenderlite, let command line to override - for k,v in target_env_defs.iteritems(): - if k not in B.arguments: - env[k] = v - # disable elbeem (fluidsim) compilation? if env['BF_NO_ELBEEM'] == 1: env['CPPFLAGS'].append('-DDISABLE_ELBEEM') @@ -302,7 +305,7 @@ if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-min # lastly we check for root_build_dir ( we should not do before, otherwise we might do wrong builddir B.root_build_dir = env['BF_BUILDDIR'] -B.doc_build_dir = os.path.join(BLENDERPATH, 'doc') +B.doc_build_dir = os.path.join(env['BF_INSTALLDIR'], 'doc') if not B.root_build_dir[-1]==os.sep: B.root_build_dir += os.sep if not B.doc_build_dir[-1]==os.sep: @@ -357,8 +360,9 @@ if not os.path.isdir ( B.root_build_dir): os.makedirs ( B.root_build_dir + 'extern' ) os.makedirs ( B.root_build_dir + 'lib' ) os.makedirs ( B.root_build_dir + 'bin' ) -if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']: - os.makedirs ( B.doc_build_dir ) +# # Docs not working with epy anymore +# if not os.path.isdir(B.doc_build_dir) and env['WITH_BF_DOCS']: +# os.makedirs ( B.doc_build_dir ) Help(opts.GenerateHelpText(env)) @@ -402,12 +406,12 @@ thestatlibs, thelibincs = B.setup_staticlibs(env) thesyslibs = B.setup_syslibs(env) if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']: - env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist + thestatlibs, [], thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender') + env.BlenderProg(B.root_build_dir, "blender", mainlist + thestatlibs + dobj, thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender') if env['WITH_BF_PLAYER']: playerlist = B.create_blender_liblist(env, 'player') playerlist += B.create_blender_liblist(env, 'intern') playerlist += B.create_blender_liblist(env, 'extern') - env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer') + env.BlenderProg(B.root_build_dir, "blenderplayer", playerlist, thestatlibs + dobj + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer') ##### Now define some targets @@ -423,18 +427,19 @@ if env['OURPLATFORM']=='darwin': for dp, dn, df in os.walk(bundle): if '.svn' in dn: dn.remove('.svn') + if '_svn' in dn: + dn.remove('_svn') dir=env['BF_INSTALLDIR']+dp[len(bundledir):] source=[dp+os.sep+f for f in df] blenderinstall.append(env.Install(dir=dir,source=source)) else: - if env['WITH_BF_FHS']: dir= os.path.join(env['BF_INSTALLDIR'], 'bin') - else: dir= env['BF_INSTALLDIR'] - - blenderinstall = env.Install(dir=dir, source=B.program_list) + blenderinstall = env.Install(dir=env['BF_INSTALLDIR'], source=B.program_list) -#-- .blender -#- dont do .blender and scripts for darwin, it is already in the bundle +#-- local path = config files in install dir: installdir\VERSION +#- dont do config and scripts for darwin, it is already in the bundle dotblendlist = [] +datafileslist = [] +datafilestargetlist = [] dottargetlist = [] scriptinstall = [] @@ -442,6 +447,8 @@ if env['OURPLATFORM']!='darwin': for dp, dn, df in os.walk('bin/.blender'): if '.svn' in dn: dn.remove('.svn') + if '_svn' in dn: + dn.remove('_svn') for f in df: if not env['WITH_BF_INTERNATIONAL']: @@ -453,30 +460,35 @@ if env['OURPLATFORM']!='darwin': if f.endswith('.ttf'): continue - dotblendlist.append(os.path.join(dp, f)) - if env['WITH_BF_FHS']: dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[2:])) # skip bin/.blender - else: dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[1:])) # skip bin - - # print dir+ os.sep + f - print dir - dottargetlist.append(dir + os.sep + f) - + if 'locale' in dp: + datafileslist.append(os.path.join(dp,f)) + dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['datafiles'] + dp.split(os.sep)[1:])) # skip bin + datafilestargetlist.append(dir + os.sep + f) + else: + dotblendlist.append(os.path.join(dp, f)) + dir= os.path.join(*([env['BF_INSTALLDIR']] + [VERSION] + ['config'] + dp.split(os.sep)[1:])) # skip bin + dottargetlist.append(dir + os.sep + f) + dotblenderinstall = [] for targetdir,srcfile in zip(dottargetlist, dotblendlist): td, tf = os.path.split(targetdir) dotblenderinstall.append(env.Install(dir=td, source=srcfile)) + for targetdir,srcfile in zip(datafilestargetlist, datafileslist): + td, tf = os.path.split(targetdir) + dotblenderinstall.append(env.Install(dir=td, source=srcfile)) if env['WITH_BF_PYTHON']: - #-- .blender/scripts + #-- local/VERSION/scripts scriptpaths=['release/scripts'] for scriptpath in scriptpaths: for dp, dn, df in os.walk(scriptpath): if '.svn' in dn: dn.remove('.svn') + if '_svn' in dn: + dn.remove('_svn') - if env['WITH_BF_FHS']: dir = BLENDERPATH - else: dir = os.path.join(env['BF_INSTALLDIR'], '.blender') + dir = os.path.join(env['BF_INSTALLDIR'], VERSION) dir += os.sep + os.path.basename(scriptpath) + dp[len(scriptpath):] source=[os.path.join(dp, f) for f in df if f[-3:]!='pyc'] @@ -490,9 +502,11 @@ if env['OURPLATFORM']=='linux2': for tp, tn, tf in os.walk('release/freedesktop/icons'): if '.svn' in tn: tn.remove('.svn') + if '_svn' in tn: + tn.remove('_svn') for f in tf: iconlist.append(os.path.join(tp, f)) - icontargetlist.append( os.path.join(*([BLENDERPATH] + tp.split(os.sep)[2:] + [f])) ) + icontargetlist.append( os.path.join(*([env['BF_INSTALLDIR']] + tp.split(os.sep)[2:] + [f])) ) iconinstall = [] for targetdir,srcfile in zip(icontargetlist, iconlist): @@ -516,27 +530,29 @@ plugtargetlist = [] for tp, tn, tf in os.walk('release/plugins'): if '.svn' in tn: tn.remove('.svn') + if '_svn' in tn: + tn.remove('_svn') df = tp[8:] # remove 'release/' for f in tf: pluglist.append(os.path.join(tp, f)) - plugtargetlist.append( os.path.join(BLENDERPATH, df, f) ) + plugtargetlist.append( os.path.join(env['BF_INSTALLDIR'], df, f) ) # header files for plugins pluglist.append('source/blender/blenpluginapi/documentation.h') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'documentation.h')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'documentation.h')) pluglist.append('source/blender/blenpluginapi/externdef.h') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'externdef.h')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'externdef.h')) pluglist.append('source/blender/blenpluginapi/floatpatch.h') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'floatpatch.h')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'floatpatch.h')) pluglist.append('source/blender/blenpluginapi/iff.h') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'iff.h')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'iff.h')) pluglist.append('source/blender/blenpluginapi/plugin.h') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.h')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'plugin.h')) pluglist.append('source/blender/blenpluginapi/util.h') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'util.h')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'util.h')) pluglist.append('source/blender/blenpluginapi/plugin.DEF') -plugtargetlist.append(os.path.join(BLENDERPATH, 'plugins', 'include', 'plugin.def')) +plugtargetlist.append(os.path.join(env['BF_INSTALLDIR'], 'plugins', 'include', 'plugin.def')) plugininstall = [] for targetdir,srcfile in zip(plugtargetlist, pluglist): @@ -548,10 +564,12 @@ texttargetlist = [] for tp, tn, tf in os.walk('release/text'): if '.svn' in tn: tn.remove('.svn') + if '_svn' in tn: + tn.remove('_svn') for f in tf: textlist.append(tp+os.sep+f) -textinstall = env.Install(dir=BLENDERPATH, source=textlist) +textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist) if env['OURPLATFORM']=='darwin': allinstall = [blenderinstall, plugininstall, textinstall] @@ -569,10 +587,12 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): #currently win64-vc doesn't appear to have libpng.dll if env['OURPLATFORM'] != 'win64-vc': - dllsources += ['${BF_PNG_LIBPATH}/libpng.dll', - '${BF_ZLIB_LIBPATH}/zlib.dll'] + dllsources += ['${BF_PNG_LIBPATH}/libpng.dll'] - dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll'] + dllsources += ['${BF_ZLIB_LIBPATH}/zlib.dll'] + # Used when linking to libtiff was dynamic + # keep it here until compilation on all platform would be ok + # dllsources += ['${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll'] if env['OURPLATFORM'] != 'linuxcross': # pthreads library is already added @@ -610,9 +630,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): '${BF_FFMPEG_LIBPATH}/avdevice-52.dll', '${BF_FFMPEG_LIBPATH}/avutil-50.dll', '${BF_FFMPEG_LIBPATH}/swscale-0.dll'] - - if env['WITH_BF_JACK']: - dllsources += ['${LCGDIR}/jack/lib/libjack.dll'] windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources) allinstall += windlls @@ -645,17 +662,3 @@ Default(B.program_list) if not env['WITHOUT_BF_INSTALL']: Default(installtarget) - -#------------ EPYDOC -if env['WITH_BF_DOCS']: - try: - import epydoc - except ImportError: - epydoc = None - - if epydoc: - SConscript('source/gameengine/PyDoc/SConscript') - else: - print "No epydoc install detected, Python API and Gameengine API Docs will not be generated " - - |