diff options
author | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-01-04 12:20:48 +0300 |
---|---|---|
committer | Sergey Sharybin <sergey.vfx@gmail.com> | 2016-01-04 12:20:48 +0300 |
commit | 5d99cde8229a481363f1439ea4a4c2af851b1cb1 (patch) | |
tree | 76ebd7548ddb8eee0c7039e7f154ac982b57e80f /build_files/scons/tools | |
parent | 1eb5e0b6608b2c2bbc9813d9155ea379a5bc8ef4 (diff) |
Remove SCons building system
While SCons building system was serving us really good for ages it's no longer
having much attention by the developers and started to become quite a difficult
task to maintain.
What's even worse -- there started to be quite serious divergence between SCons
and CMake which was only accumulating over the releases now. The fact that none
of the active developers are really using SCons and that our main studio is also
using CMake spotting bugs in the SCons builds became quite a difficult task and
we aren't always spotting them in time.
Meanwhile CMake became really mature building system which is available on every
platform we support and arguably it's also easier and more robust to use.
This commit includes:
- Removal of actual SCons building system
- Removal of SCons git submodule
- Removal of documentation which is stored in the sources and covers SCons
- Tweaks to the buildbot master to stop using SCons submodule
(this change requires deploying to the server)
- Tweaks to the install dependencies script to skip installing or mentioning
SCons building system
- Tweaks to various helper scripts to avoid mention of SCons folders/files
as well
Reviewers: mont29, dingto, dfelinto, lukastoenne, lukasstockner97, brecht, Severin, merwin, aligorith, psy-fi, campbellbarton, juicyfruit
Reviewed By: campbellbarton, juicyfruit
Differential Revision: https://developer.blender.org/D1680
Diffstat (limited to 'build_files/scons/tools')
-rw-r--r-- | build_files/scons/tools/Blender.py | 1146 | ||||
-rw-r--r-- | build_files/scons/tools/__init__.py | 0 | ||||
-rw-r--r-- | build_files/scons/tools/bcolors.py | 16 | ||||
-rw-r--r-- | build_files/scons/tools/btools.py | 918 | ||||
-rw-r--r-- | build_files/scons/tools/crossmingw.py | 184 | ||||
-rw-r--r-- | build_files/scons/tools/mstoolkit.py | 353 |
6 files changed, 0 insertions, 2617 deletions
diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py deleted file mode 100644 index d44c5caaec8..00000000000 --- a/build_files/scons/tools/Blender.py +++ /dev/null @@ -1,1146 +0,0 @@ -#!/usr/bin/env python - -""" -tools.BlenderEnvironment - -This environment builds on SCons.Script.SConscript.SConsEnvironment - -* library repository -* custom printout -* wrapper functions - -TODO: clean up and sanitise code - crosscheck with btools and SConstruct -to kill any code duplication - -""" - -import os -import string -import ctypes as ct -import glob -import time -import sys -import tarfile -import shutil -import cStringIO -import platform - -from SCons.Script.SConscript import SConsEnvironment -import SCons.Action -import SCons.Util -import SCons.Builder -import SCons.Subst -import SCons.Tool -import bcolors -bc = bcolors.bcolors() -import btools -VERSION = btools.VERSION -VERSION_RELEASE_CYCLE = btools.VERSION_RELEASE_CYCLE - -Split = SCons.Util.Split -Action = SCons.Action.Action -Builder = SCons.Builder.Builder -GetBuildPath = SConsEnvironment.GetBuildPath - -# a few globals -root_build_dir = '' -doc_build_dir = '' -quickie = None # Anything else than None if BF_QUICK has been passed -quicklist = [] # The list of libraries/programs to compile during a quickie -program_list = [] # A list holding Nodes to final binaries, used to create installs -arguments = None -targets = None -resources = [] -allowed_bitnesses = {4 : 32, 8 : 64} # only expecting 32-bit or 64-bit -bitness = allowed_bitnesses[ct.sizeof(ct.c_void_p)] - -##### LIB STUFF ########## - -possible_types = ['core'] # can be set in ie. SConstruct -libs = {} -vcp = [] - -def getresources(): - return resources - -def init_lib_dict(): - for pt in possible_types: - libs[pt] = {} - -# helper func for add_lib_to_dict -def internal_lib_to_dict(dict = None, libtype = None, libname = None, priority = 100): - if not libname in dict[libtype]: - done = None - while not done: - if dict[libtype].has_key(priority): - priority = priority + 1 - else: - done = True - dict[libtype][priority] = libname - -# libtype and priority can both be lists, for defining lib in multiple places -def add_lib_to_dict(env, dict = None, libtype = None, libname = None, priority = 100): - if not dict or not libtype or not libname: - print "Passed wrong arg" - env.Exit() - - if type(libtype) is str and type(priority) is int: - internal_lib_to_dict(dict, libtype, libname, priority) - elif type(libtype) is list and type(priority) is list: - if len(libtype)==len(priority): - for lt, p in zip(libtype, priority): - internal_lib_to_dict(dict, lt, libname, p) - else: - print "libtype and priority lists are unequal in length" - env.Exit() - else: - print "Wrong type combinations for libtype and priority. Only str and int or list and list" - env.Exit() - -def create_blender_liblist(lenv = None, libtype = None): - if not lenv or not libtype: - print "missing arg" - - lst = [] - if libtype in possible_types: - curlib = libs[libtype] - sortlist = curlib.keys() - sortlist.sort() - for sk in sortlist: - v = curlib[sk] - if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): - target = os.path.abspath(os.getcwd() + os.sep + root_build_dir + 'lib' + os.sep +lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']) - else: - target = os.path.abspath(root_build_dir + 'lib' + os.sep +lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']) - lst.append(target) - - return lst - -## TODO: static linking -def setup_staticlibs(lenv): - statlibs = [ - #here libs for static linking - ] - - libincs = [] - - if lenv['WITH_BF_FFMPEG']: - libincs += Split(lenv['BF_FFMPEG_LIBPATH']) - - libincs.extend([ - lenv['BF_OPENGL_LIBPATH'], - lenv['BF_JPEG_LIBPATH'], - lenv['BF_ZLIB_LIBPATH'], - lenv['BF_PNG_LIBPATH'], - lenv['BF_ICONV_LIBPATH'] - ]) - - if lenv['WITH_BF_STATICJPEG']: - statlibs += Split(lenv['BF_JPEG_LIB_STATIC']) - if lenv['WITH_BF_STATICPNG']: - statlibs += Split(lenv['BF_PNG_LIB_STATIC']) - - libincs += Split(lenv['BF_FREETYPE_LIBPATH']) - if lenv['WITH_BF_PYTHON']: - libincs += Split(lenv['BF_PYTHON_LIBPATH']) - if lenv['WITH_BF_SDL'] and not lenv['WITH_BF_SDL_DYNLOAD']: - libincs += Split(lenv['BF_SDL_LIBPATH']) - if lenv['WITH_BF_JACK'] and not lenv['WITH_BF_JACK_DYNLOAD']: - libincs += Split(lenv['BF_JACK_LIBPATH']) - if lenv['WITH_BF_SNDFILE']: - libincs += Split(lenv['BF_SNDFILE_LIBPATH']) - if lenv['WITH_BF_TIFF']: - libincs += Split(lenv['BF_TIFF_LIBPATH']) - if lenv['WITH_BF_STATICTIFF']: - statlibs += Split(lenv['BF_TIFF_LIB_STATIC']) - if lenv['WITH_BF_FFTW3']: - libincs += Split(lenv['BF_FFTW3_LIBPATH']) - if lenv['WITH_BF_STATICFFTW3']: - statlibs += Split(lenv['BF_FFTW3_LIB_STATIC']) - ''' - if lenv['WITH_BF_ELTOPO']: - libincs += Split(lenv['BF_LAPACK_LIBPATH']) - if lenv['WITH_BF_STATICLAPACK']: - statlibs += Split(lenv['BF_LAPACK_LIB_STATIC']) - ''' - if lenv['WITH_BF_FFMPEG'] and lenv['WITH_BF_STATICFFMPEG']: - statlibs += Split(lenv['BF_FFMPEG_LIB_STATIC']) - if lenv['WITH_BF_INTERNATIONAL']: - if lenv['WITH_BF_FREETYPE_STATIC']: - statlibs += Split(lenv['BF_FREETYPE_LIB_STATIC']) - if lenv['WITH_BF_OPENAL']: - libincs += Split(lenv['BF_OPENAL_LIBPATH']) - if lenv['WITH_BF_STATICOPENAL']: - statlibs += Split(lenv['BF_OPENAL_LIB_STATIC']) - if lenv['WITH_BF_STATICOPENGL']: - statlibs += Split(lenv['BF_OPENGL_LIB_STATIC']) - if lenv['WITH_BF_STATICCXX']: - statlibs += Split(lenv['BF_CXX_LIB_STATIC']) - - if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']: - statlibs += Split(lenv['BF_PYTHON_LIB_STATIC']) - - if lenv['WITH_BF_SNDFILE'] and lenv['WITH_BF_STATICSNDFILE']: - statlibs += Split(lenv['BF_SNDFILE_LIB_STATIC']) - - if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): - libincs += Split(lenv['BF_PTHREADS_LIBPATH']) - - if lenv['WITH_BF_COLLADA']: - libincs += Split(lenv['BF_OPENCOLLADA_LIBPATH']) - if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): - libincs += Split(lenv['BF_PCRE_LIBPATH']) - libincs += Split(lenv['BF_EXPAT_LIBPATH']) - if lenv['WITH_BF_STATICOPENCOLLADA']: - statlibs += Split(lenv['BF_OPENCOLLADA_LIB_STATIC']) - - if lenv['WITH_BF_OPENMP']: - if lenv['OURPLATFORM'] == 'linuxcross': - libincs += Split(lenv['BF_OPENMP_LIBPATH']) - if lenv['WITH_BF_STATICOPENMP']: - statlibs += Split(lenv['BF_OPENMP_LIB_STATIC']) - - if lenv['WITH_BF_OIIO']: - libincs += Split(lenv['BF_OIIO_LIBPATH']) - if lenv['WITH_BF_STATICOIIO']: - statlibs += Split(lenv['BF_OIIO_LIB_STATIC']) - if lenv['WITH_BF_OPENEXR']: - libincs += Split(lenv['BF_OPENEXR_LIBPATH']) - if lenv['WITH_BF_STATICOPENEXR']: - statlibs += Split(lenv['BF_OPENEXR_LIB_STATIC']) - if lenv['WITH_BF_ZLIB'] and lenv['WITH_BF_STATICZLIB']: - statlibs += Split(lenv['BF_ZLIB_LIB_STATIC']) - - if lenv['WITH_BF_OCIO']: - libincs += Split(lenv['BF_OCIO_LIBPATH']) - if lenv['WITH_BF_STATICOCIO']: - statlibs += Split(lenv['BF_OCIO_LIB_STATIC']) - - if lenv['WITH_BF_CYCLES_OSL']: - libincs += Split(lenv['BF_OSL_LIBPATH']) - if lenv['WITH_BF_STATICOSL']: - statlibs += Split(lenv['BF_OSL_LIB_STATIC']) - - if lenv['WITH_BF_BOOST']: - libincs += Split(lenv['BF_BOOST_LIBPATH']) - if lenv['WITH_BF_STATICBOOST']: - statlibs += Split(lenv['BF_BOOST_LIB_STATIC']) - - if lenv['WITH_BF_LLVM']: - libincs += Split(lenv['BF_LLVM_LIBPATH']) - if lenv['WITH_BF_STATICLLVM']: - statlibs += Split(lenv['BF_LLVM_LIB_STATIC']) - - if lenv['WITH_BF_JEMALLOC']: - libincs += Split(lenv['BF_JEMALLOC_LIBPATH']) - if lenv['WITH_BF_STATICJEMALLOC']: - statlibs += Split(lenv['BF_JEMALLOC_LIB_STATIC']) - - if lenv['OURPLATFORM']=='linux': - if lenv['WITH_BF_3DMOUSE']: - libincs += Split(lenv['BF_3DMOUSE_LIBPATH']) - if lenv['WITH_BF_STATIC3DMOUSE']: - statlibs += Split(lenv['BF_3DMOUSE_LIB_STATIC']) - - if lenv['WITH_BF_OPENSUBDIV']: - libincs += Split(lenv['BF_OPENSUBDIV_LIBPATH']) - if lenv['WITH_BF_STATICOPENSUBDIV']: - statlibs += Split(lenv['BF_OPENSUBDIV_LIB_STATIC']) - - # setting this last so any overriding of manually libs could be handled - if lenv['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross', 'win64-mingw'): - # We must remove any previous items defining this path, for same reason stated above! - libincs = [e for e in libincs if SCons.Subst.scons_subst(e, lenv, gvars=lenv.Dictionary()) != "/usr/lib"] - libincs.append('/usr/lib') - - # Hack to pass OSD libraries to linker before extern_{clew,cuew} - # Here we only store library path, actual library name will be added in setup_syslibs() - for syslib in create_blender_liblist(lenv, 'system'): - libincs.append(os.path.dirname(syslib)) - - return statlibs, libincs - -def setup_syslibs(lenv): - syslibs = [] - - if not lenv['WITH_BF_FREETYPE_STATIC']: - syslibs += Split(lenv['BF_FREETYPE_LIB']) - if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']: - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'): - syslibs.append(lenv['BF_PYTHON_LIB']+'_d') - else: - syslibs.append(lenv['BF_PYTHON_LIB']) - if lenv['WITH_BF_OPENAL']: - if not lenv['WITH_BF_STATICOPENAL']: - syslibs += Split(lenv['BF_OPENAL_LIB']) - if lenv['WITH_BF_OPENMP'] and lenv['CC'] != 'icc' and lenv['C_COMPILER_ID'] != 'clang' and not lenv['WITH_BF_STATICOPENMP']: - if lenv['CC'] == 'cl.exe': - syslibs += ['vcomp'] - else: - syslibs += ['gomp'] - if lenv['WITH_BF_ICONV']: - syslibs += Split(lenv['BF_ICONV_LIB']) - if lenv['WITH_BF_OIIO']: - if not lenv['WITH_BF_STATICOIIO']: - syslibs += Split(lenv['BF_OIIO_LIB']) - - if lenv['WITH_BF_OCIO']: - if not lenv['WITH_BF_STATICOCIO']: - syslibs += Split(lenv['BF_OCIO_LIB']) - - if lenv['WITH_BF_OPENEXR'] and not lenv['WITH_BF_STATICOPENEXR']: - syslibs += Split(lenv['BF_OPENEXR_LIB']) - if lenv['WITH_BF_ZLIB'] and not lenv['WITH_BF_STATICZLIB']: - syslibs += Split(lenv['BF_ZLIB_LIB']) - if lenv['WITH_BF_TIFF'] and not lenv['WITH_BF_STATICTIFF']: - syslibs += Split(lenv['BF_TIFF_LIB']) - if lenv['WITH_BF_FFMPEG'] and not lenv['WITH_BF_STATICFFMPEG']: - syslibs += Split(lenv['BF_FFMPEG_LIB']) - if lenv['WITH_BF_OGG']: - syslibs += Split(lenv['BF_OGG_LIB']) - if lenv['WITH_BF_JACK'] and not lenv['WITH_BF_JACK_DYNLOAD']: - syslibs += Split(lenv['BF_JACK_LIB']) - if lenv['WITH_BF_SNDFILE'] and not lenv['WITH_BF_STATICSNDFILE']: - syslibs += Split(lenv['BF_SNDFILE_LIB']) - if lenv['WITH_BF_FFTW3'] and not lenv['WITH_BF_STATICFFTW3']: - syslibs += Split(lenv['BF_FFTW3_LIB']) - ''' - if lenv['WITH_BF_ELTOPO']: - syslibs += Split(lenv['BF_LAPACK_LIB']) - ''' - if lenv['WITH_BF_SDL'] and not lenv['WITH_BF_SDL_DYNLOAD']: - syslibs += Split(lenv['BF_SDL_LIB']) - if not lenv['WITH_BF_STATICOPENGL']: - syslibs += Split(lenv['BF_OPENGL_LIB']) - if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'): - syslibs += Split(lenv['BF_PTHREADS_LIB']) - if lenv['WITH_BF_COLLADA'] and not lenv['WITH_BF_STATICOPENCOLLADA']: - syslibs.append(lenv['BF_PCRE_LIB']) - if lenv['BF_DEBUG'] and (lenv['OURPLATFORM'] != 'linux'): - syslibs += [colladalib+'_d' for colladalib in Split(lenv['BF_OPENCOLLADA_LIB'])] - else: - syslibs += Split(lenv['BF_OPENCOLLADA_LIB']) - syslibs.append(lenv['BF_EXPAT_LIB']) - - if lenv['WITH_BF_JEMALLOC']: - if not lenv['WITH_BF_STATICJEMALLOC']: - syslibs += Split(lenv['BF_JEMALLOC_LIB']) - - if lenv['OURPLATFORM']=='linux': - if lenv['WITH_BF_3DMOUSE']: - if not lenv['WITH_BF_STATIC3DMOUSE']: - syslibs += Split(lenv['BF_3DMOUSE_LIB']) - - if lenv['WITH_BF_CYCLES_OSL'] and not lenv['WITH_BF_STATICOSL']: - syslibs += Split(lenv['BF_OSL_LIB']) - - if lenv['WITH_BF_BOOST'] and not lenv['WITH_BF_STATICBOOST']: - syslibs += Split(lenv['BF_BOOST_LIB']) - - if lenv['WITH_BF_INTERNATIONAL']: - syslibs += Split(lenv['BF_BOOST_LIB_INTERNATIONAL']) - - if lenv['WITH_BF_LLVM'] and not lenv['WITH_BF_STATICLLVM']: - syslibs += Split(lenv['BF_LLVM_LIB']) - - if not lenv['WITH_BF_STATICJPEG']: - syslibs += Split(lenv['BF_JPEG_LIB']) - - if not lenv['WITH_BF_STATICPNG']: - syslibs += Split(lenv['BF_PNG_LIB']) - - if lenv['WITH_BF_OPENSUBDIV']: - if not lenv['WITH_BF_STATICOPENSUBDIV']: - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'win64-mingw'): - syslibs += [osdlib+'_d' for osdlib in Split(lenv['BF_OPENSUBDIV_LIB'])] - else: - syslibs += Split(lenv['BF_OPENSUBDIV_LIB']) - - # Hack to pass OSD libraries to linker before extern_{clew,cuew} - for syslib in create_blender_liblist(lenv, 'system'): - syslibs.append(os.path.basename(syslib)) - - syslibs += lenv['LLIBS'] - - return syslibs - -def propose_priorities(): - print bc.OKBLUE+"Priorities:"+bc.ENDC - for t in possible_types: - print bc.OKGREEN+"\t"+t+bc.ENDC - new_priority = 0 - curlib = libs[t] - sortlist = curlib.keys() - sortlist.sort() - - for sk in sortlist: - v = curlib[sk] - #for p,v in sorted(libs[t].iteritems()): - print "\t\t",new_priority, v - new_priority += 5 - -# emits the necessary file objects for creator.c, to be used in creating -# the final blender executable -def creator(env): - sources = ['creator.c']# + Blender.buildinfo(env, "dynamic") + Blender.resources - - incs = ['#/intern/guardedalloc', '#/source/blender/blenlib', '#/source/blender/blenkernel', '#/source/blender/depsgraph', '#/source/blender/editors/include', '#/source/blender/blenloader', '#/source/blender/imbuf', '#/source/blender/renderconverter', '#/source/blender/render/extern/include', '#/source/blender/windowmanager', '#/source/blender/makesdna', '#/source/blender/makesrna', '#/source/gameengine/BlenderRoutines', '#/extern/glew/include', '#/source/blender/gpu', env['BF_OPENGL_INC']] - - defs = [] - - if env['WITH_BF_BINRELOC']: - incs.append('#/extern/binreloc/include') - defs.append('WITH_BINRELOC') - - if env['WITH_BF_SDL']: - if env['WITH_BF_SDL_DYNLOAD']: - defs.append('WITH_SDL_DYNLOAD') - incs.append('#/extern/sdlew/include') - defs.append('WITH_SDL') - - if env['WITH_BF_LIBMV']: - incs.append('#/extern/libmv') - defs.append('WITH_LIBMV') - - if env['WITH_BF_CYCLES'] and env['WITH_BF_CYCLES_LOGGING']: - incs.append('#/intern/cycles/blender') - defs.append('WITH_CYCLES_LOGGING') - - if env['WITH_BF_FFMPEG']: - defs.append('WITH_FFMPEG') - - if env['WITH_BF_PYTHON']: - incs.append('#/source/blender/python') - defs.append('WITH_PYTHON') - if env['BF_DEBUG']: - defs.append('_DEBUG') - - if env['WITH_BF_FREESTYLE']: - incs.append('#/source/blender/freestyle') - defs.append('WITH_FREESTYLE') - - if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc', 'win64-mingw'): - incs.append(env['BF_PTHREADS_INC']) - incs.append('#/intern/utfconv') - - env.Append(CPPDEFINES=defs) - env.Append(CPPPATH=incs) - obj = [env.Object(root_build_dir+'source/creator/creator/creator', ['#source/creator/creator.c'])] - - return obj - -## TODO: see if this can be made in an emitter -def buildinfo(lenv, build_type): - """ - Generate a buildinfo object - """ - import subprocess - - build_date = time.strftime ("%Y-%m-%d") - build_time = time.strftime ("%H:%M:%S") - - if os.path.isdir(os.path.abspath('.git')): - try: - build_commit_timestamp = btools.get_command_output(args=['git', 'log', '-1', '--format=%ct']).strip() - except OSError: - build_commit_timestamp = None - if not build_commit_timestamp: - # Git command not found - build_hash = 'unknown' - build_commit_timestamp = '0' - build_branch = 'unknown' - else: - no_upstream = False - - try : - build_hash = btools.get_command_output(['git', 'rev-parse', '--short', '@{u}'], stderr=subprocess.STDOUT).strip() - except subprocess.CalledProcessError: - # assume branch has no upstream configured - build_hash = btools.get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip() - no_upstream = True - - build_branch = btools.get_command_output(['git', 'rev-parse', '--abbrev-ref', 'HEAD']).strip() - - if build_branch == 'HEAD': - master_check = btools.get_command_output(['git', 'branch', '--list', 'master', '--contains', build_hash]).strip() - if master_check == 'master': - build_branch = 'master' - else: - head_hash = btools.get_command_output(['git', 'rev-parse', 'HEAD']).strip() - tag_hashes = btools.get_command_output(['git', 'show-ref', '--tags', '-d']) - if tag_hashes.find(head_hash) != -1: - build_branch = 'master' - - if not no_upstream: - older_commits = btools.get_command_output(['git', 'log', '--oneline', 'HEAD..@{u}']).strip() - if older_commits: - build_hash = btools.get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip() - - # ## Check for local modifications - has_local_changes = False - - # Update GIT index before getting dirty files - os.system('git update-index -q --refresh') - changed_files = btools.get_command_output(['git', 'diff-index', '--name-only', 'HEAD', '--']).strip() - - if changed_files: - has_local_changes = True - elif no_upstream == False: - unpushed_log = btools.get_command_output(['git', 'log', '--oneline', '@{u}..']).strip() - has_local_changes = unpushed_log != '' - - if build_branch.startswith('blender-v'): - build_branch = 'master' - - if has_local_changes: - build_branch += ' (modified)' - else: - build_hash = 'unknown' - build_commit_timestamp = '0' - build_branch = 'unknown' - - if lenv['BF_DEBUG']: - build_type = "Debug" - build_cflags = ' '.join(lenv['CFLAGS'] + lenv['CCFLAGS'] + lenv['BF_DEBUG_CCFLAGS'] + lenv['CPPFLAGS']) - build_cxxflags = ' '.join(lenv['CCFLAGS'] + lenv['CXXFLAGS'] + lenv['CPPFLAGS']) - else: - build_type = "Release" - build_cflags = ' '.join(lenv['CFLAGS'] + lenv['CCFLAGS'] + lenv['REL_CFLAGS'] + lenv['REL_CCFLAGS'] + lenv['CPPFLAGS']) - build_cxxflags = ' '.join(lenv['CCFLAGS'] + lenv['CXXFLAGS'] + lenv['REL_CXXFLAGS'] + lenv['REL_CCFLAGS'] + lenv['CPPFLAGS']) - - build_linkflags = ' '.join(lenv['PLATFORM_LINKFLAGS']) - - obj = [] - if lenv['BF_BUILDINFO']: - lenv.Append (CPPDEFINES = ['BUILD_TIME=\\"%s\\"'%(build_time), - 'BUILD_DATE=\\"%s\\"'%(build_date), - 'BUILD_TYPE=\\"%s\\"'%(build_type), - 'BUILD_HASH=\\"%s\\"'%(build_hash), - 'BUILD_COMMIT_TIMESTAMP=%s'%(build_commit_timestamp), - 'BUILD_BRANCH=\\"%s\\"'%(build_branch), - 'WITH_BUILDINFO', - 'BUILD_PLATFORM=\\"%s:%s\\"'%(platform.system(), platform.architecture()[0]), - 'BUILD_CFLAGS=\\"%s\\"'%(build_cflags), - 'BUILD_CXXFLAGS=\\"%s\\"'%(build_cxxflags), - 'BUILD_LINKFLAGS=\\"%s\\"'%(build_linkflags), - 'BUILD_SYSTEM=\\"SCons\\"' - ]) - - lenv.Append (CPPPATH = [root_build_dir+'source/blender/blenkernel']) - - obj = [lenv.Object (root_build_dir+'source/creator/%s_buildinfo'%build_type, ['#source/creator/buildinfo.c'])] - - return obj - -##### END LIB STUFF ############ - -##### ACTION STUFF ############# - -def my_print_cmd_line(self, s, target, source, env): - sys.stdout.write(' ' * 70 + '\r') - sys.stdout.flush() - sys.stdout.write(s + "\r") - sys.stdout.flush() - -def my_compile_print(target, source, env): - a = '%s' % (source[0]) - d, f = os.path.split(a) - return bc.OKBLUE + "Compiling" + bc.ENDC + " ==> '" + bc.OKGREEN + ("%s" % f) + bc.ENDC + "'" - -def my_moc_print(target, source, env): - a = '%s' % (source[0]) - d, f = os.path.split(a) - return bc.OKBLUE + "Creating MOC" + bc.ENDC + " ==> '" + bc.OKGREEN + ("%s" % f) + bc.ENDC + "'" - -def my_linking_print(target, source, env): - t = '%s' % (target[0]) - d, f = os.path.split(t) - return bc.OKBLUE + "Linking library" + bc.ENDC + " ==> '" + bc.OKGREEN + ("%s" % f) + bc.ENDC + "'" - -def my_program_print(target, source, env): - t = '%s' % (target[0]) - d, f = os.path.split(t) - return bc.OKBLUE + "Linking program" + bc.ENDC + " ==> '" + bc.OKGREEN + ("%s" % f) + bc.ENDC + "'" - -def msvc_hack(env): - static_lib = SCons.Tool.createStaticLibBuilder(env) - program = SCons.Tool.createProgBuilder(env) - - env['BUILDERS']['Library'] = static_lib - env['BUILDERS']['StaticLibrary'] = static_lib - env['BUILDERS']['Program'] = program - -def set_quiet_output(env): - mycaction = Action("$CCCOM", strfunction=my_compile_print) - myshcaction = Action("$SHCCCOM", strfunction=my_compile_print) - mycppaction = Action("$CXXCOM", strfunction=my_compile_print) - myshcppaction = Action("$SHCXXCOM", strfunction=my_compile_print) - mylibaction = Action("$ARCOM", strfunction=my_linking_print) - mylinkaction = Action("$LINKCOM", strfunction=my_program_print) - - static_ob, shared_ob = SCons.Tool.createObjBuilders(env) - static_ob.add_action('.c', mycaction) - static_ob.add_action('.cpp', mycppaction) - static_ob.add_action('.cc', mycppaction) - shared_ob.add_action('.c', myshcaction) - shared_ob.add_action('.cc', myshcppaction) - - static_lib = SCons.Builder.Builder(action = mylibaction, - emitter = '$LIBEMITTER', - prefix = '$LIBPREFIX', - suffix = '$LIBSUFFIX', - src_suffix = '$OBJSUFFIX', - src_builder = 'StaticObject') - - program = SCons.Builder.Builder(action = mylinkaction, - emitter = '$PROGEMITTER', - prefix = '$PROGPREFIX', - suffix = '$PROGSUFFIX', - src_suffix = '$OBJSUFFIX', - src_builder = 'Object', - target_scanner = SCons.Defaults.ProgScan) - - env['BUILDERS']['Object'] = static_ob - env['BUILDERS']['StaticObject'] = static_ob - env['BUILDERS']['StaticLibrary'] = static_lib - env['BUILDERS']['Library'] = static_lib - env['BUILDERS']['Program'] = program - if env['BF_LINE_OVERWRITE']: - SCons.Action._ActionAction.print_cmd_line = my_print_cmd_line - -def untar_pybundle(from_tar,to_dir,exclude_re): - tar= tarfile.open(from_tar, mode='r') - exclude_re= list(exclude_re) #single re object or list of re objects - debug= 0 #list files instead of unpacking - good= [] - if debug: print '\nFiles not being unpacked:\n' - for name in tar.getnames(): - is_bad= 0 - for r in exclude_re: - if r.match(name): - is_bad=1 - if debug: print name - break - if not is_bad: - good.append(tar.getmember(name)) - if debug: - print '\nFiles being unpacked:\n' - for g in good: - print g - else: - tar.extractall(to_dir, good) - -def my_winpybundle_print(target, source, env): - pass - -def WinPyBundle(target=None, source=None, env=None): - import re - py_tar = env.subst(env['LCGDIR']).lstrip("#") - if env['BF_DEBUG']: - py_tar+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_d.tar.gz' - else: - py_tar+= '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '.tar.gz' - - py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#") - py_target = os.path.join(py_target, VERSION, 'python') - def printexception(func,path,ex): - if os.path.exists(path): #do not report if path does not exist. eg on a fresh build. - print str(func) + ' failed on ' + str(path) - print "Trying to remove existing py bundle." - shutil.rmtree(py_target, False, printexception) - exclude_re=[re.compile('.*/test'), - re.compile('^test'), - re.compile('^distutils'), - re.compile('^idlelib'), - re.compile('^lib2to3'), - re.compile('^tkinter'), - re.compile('^_tkinter_d.pyd'), - re.compile('^turtledemo'), - re.compile('^turtle.py'), - ] - - print "Unpacking '" + py_tar + "' to '" + py_target + "'" - untar_pybundle(py_tar,py_target,exclude_re) - - # ------------- - # Extract Numpy - if env['WITH_BF_PYTHON_INSTALL_NUMPY']: - py_tar = env.subst(env['LCGDIR']).lstrip("#") - py_tar += '/release/python' + env['BF_PYTHON_VERSION'].replace('.','') + '_numpy_1.9.tar.gz' - - py_target = env.subst(env['BF_INSTALLDIR']).lstrip("#") - py_target = os.path.join(py_target, VERSION, 'python', 'lib', 'site-packages') - # rmtree handled above - # files are cleaned up in their archive - exclude_re = [] - print("Unpacking '" + py_tar + "' to '" + py_target + "'") - untar_pybundle(py_tar, py_target, exclude_re) - - # -------------------- - # Copy 'site-packages' - py_dir = env.subst(env['LCGDIR']).lstrip("#") - py_dir += '/release/site-packages' - # grr, we have to do one by one because the dir exists - for f in os.listdir(py_dir): - if f == '.svn': - continue - fn_src = os.path.join(py_dir, f) - fn_dst = os.path.join(py_target, f) - - shutil.rmtree(fn_dst, False, printexception) - shutil.copytree(fn_src, fn_dst) - - - -def my_appit_print(target, source, env): - a = '%s' % (target[0]) - d, f = os.path.split(a) - return "making bundle for " + f - -def AppIt(target=None, source=None, env=None): - import shutil - import commands - import os.path - - - a = '%s' % (target[0]) - builddir, b = os.path.split(a) - libdir = env['LCGDIR'][1:] - osxarch = env['MACOSX_ARCHITECTURE'] - installdir = env['BF_INSTALLDIR'] - print("compiled architecture: %s"%(osxarch)) - print("Installing to %s"%(installdir)) - # TODO, use tar. - python_zip = 'python_' + osxarch + '.zip' # set specific python_arch.zip - if env['WITH_OSX_STATICPYTHON']: - print("unzipping to app-bundle: %s"%(python_zip)) - else: - print("dynamic build - make sure to have python3.x-framework installed") - bldroot = env.Dir('.').abspath - binary = env['BINARYKIND'] - - sourcedir = bldroot + '/release/darwin/%s.app' % binary - sourceinfo = bldroot + "/release/darwin/%s.app/Contents/Info.plist"%binary - targetinfo = installdir +'/' + "%s.app/Contents/Info.plist"%binary - cmd = installdir + '/' +'%s.app'%binary - - if os.path.isdir(cmd): - shutil.rmtree(cmd) - shutil.copytree(sourcedir, cmd) - cmd = "cat %s | sed s/\$\{MACOSX_BUNDLE_SHORT_VERSION_STRING\}/%s/ | "%(sourceinfo,VERSION) - cmd += "sed s/\$\{MACOSX_BUNDLE_LONG_VERSION_STRING\}/%s,\ %s/g > %s"%(VERSION,time.strftime("%Y-%b-%d"),targetinfo) - commands.getoutput(cmd) - cmd = 'cp %s/%s %s/%s.app/Contents/MacOS/%s'%(builddir, binary,installdir, binary, binary) - commands.getoutput(cmd) - cmd = 'mkdir %s/%s.app/Contents/Resources/%s/'%(installdir, binary, VERSION) - commands.getoutput(cmd) - cmd = installdir + '/%s.app/Contents/MacOS/%s'%(binary,VERSION) - - # blenderplayer doesn't need all the files - if binary == 'blender': - cmd = 'mkdir %s/%s.app/Contents/Resources/%s/datafiles'%(installdir, binary, VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/datafiles/fonts %s/%s.app/Contents/Resources/%s/datafiles/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - mo_dir = os.path.join(builddir[:-4], "locale") - for f in os.listdir(mo_dir): - cmd = 'ditto %s/%s %s/%s.app/Contents/Resources/%s/datafiles/locale/%s/LC_MESSAGES/blender.mo'%(mo_dir, f, installdir, binary, VERSION, f[:-3]) - commands.getoutput(cmd) - cmd = 'cp %s/release/datafiles/locale/languages %s/%s.app/Contents/Resources/%s/datafiles/locale/'%(bldroot, installdir, binary, VERSION) - commands.getoutput(cmd) - - if env['WITH_BF_OCIO']: - cmd = 'cp -R %s/release/datafiles/colormanagement %s/%s.app/Contents/Resources/%s/datafiles/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - - cmd = 'cp -R %s/release/scripts %s/%s.app/Contents/Resources/%s/'%(bldroot,installdir,binary,VERSION) - commands.getoutput(cmd) - - if VERSION_RELEASE_CYCLE == "release": - cmd = 'rm -rf %s/%s.app/Contents/Resources/%s/scripts/addons_contrib'%(installdir,binary,VERSION) - commands.getoutput(cmd) - - if env['WITH_BF_CYCLES']: - croot = '%s/intern/cycles' % (bldroot) - cinstalldir = '%s/%s.app/Contents/Resources/%s/scripts/addons/cycles' % (installdir,binary,VERSION) - - cmd = 'mkdir %s' % (cinstalldir) - commands.getoutput(cmd) - cmd = 'mkdir %s/kernel' % (cinstalldir) - commands.getoutput(cmd) - cmd = 'mkdir %s/lib' % (cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/blender/addon/*.py %s/' % (croot, cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/doc/license %s/license' % (croot, cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/kernel/*.h %s/kernel/*.cl %s/kernel/*.cu %s/kernel/' % (croot, croot, croot, cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/kernel/svm %s/kernel/closure %s/kernel/geom %s/kernel/split %s/kernel/kernels %s/util/util_color.h %s/util/util_half.h %s/util/util_math.h %s/util/util_math_fast.h %s/util/util_transform.h %s/util/util_types.h %s/util/util_atomic.h %s/kernel/' % (croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, croot, cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/../intern/cycles/kernel/*.cubin %s/lib/' % (builddir, cinstalldir) - commands.getoutput(cmd) - - if env['WITH_BF_CYCLES_OSL']: - cmd = 'mkdir %s/shader' % (cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/kernel/shaders/*.h %s/shader' % (croot, cinstalldir) - commands.getoutput(cmd) - cmd = 'cp -R %s/../intern/cycles/kernel/shaders/*.oso %s/shader' % (builddir, cinstalldir) - commands.getoutput(cmd) - - if env['WITH_OSX_STATICPYTHON']: - cmd = 'mkdir %s/%s.app/Contents/Resources/%s/python/'%(installdir,binary, VERSION) - commands.getoutput(cmd) - cmd = 'unzip -q %s/release/%s -d %s/%s.app/Contents/Resources/%s/python/'%(libdir,python_zip,installdir,binary,VERSION) - commands.getoutput(cmd) - cmd = 'cp -R %s/release/site-packages/ %s/%s.app/Contents/Resources/%s/python/lib/python%s/site-packages/'%(libdir,installdir,binary,VERSION,env['BF_PYTHON_VERSION']) - commands.getoutput(cmd) - cmd = 'cp -r %s/python/bin -d %s/%s.app/Contents/Resources/%s/python/'%(libdir,installdir,binary,VERSION) - commands.getoutput(cmd) - - cmd = 'chmod +x %s/%s.app/Contents/MacOS/%s'%(installdir,binary, binary) - commands.getoutput(cmd) - cmd = 'find %s/%s.app -name .svn -prune -exec rm -rf {} \;'%(installdir, binary) - commands.getoutput(cmd) - cmd = 'find %s/%s.app -name .DS_Store -exec rm -rf {} \;'%(installdir, binary) - commands.getoutput(cmd) - cmd = 'find %s/%s.app -name __MACOSX -exec rm -rf {} \;'%(installdir, binary) - commands.getoutput(cmd) - cmd = 'SetFile -d "%s)" -m "%s)" %s/%s.app'%(time.strftime("%m/%d/%Y %H:%M"),time.strftime("%m/%d/%Y %H:%M"),installdir,binary) # give the bundles actual creation/modification date - commands.getoutput(cmd) - if env['WITH_BF_OPENMP']: - if env['C_COMPILER_ID'] == 'gcc' and env['CCVERSION'] >= '4.6.1': # for correct errorhandling with gcc >= 4.6.1 we need the gcc.dylib and gomp.dylib to link, thus distribute in app-bundle - print "Bundling libgcc and libgomp" - instname = env['BF_CXX'] - cmd = 'ditto --arch %s %s/lib/libgcc_s.1.dylib %s/%s.app/Contents/Resources/lib/'%(osxarch, instname, installdir, binary) # copy libgcc - commands.getoutput(cmd) - cmd = 'install_name_tool -id @executable_path/../Resources/lib/libgcc_s.1.dylib %s/%s.app/Contents/Resources/lib/libgcc_s.1.dylib'%(installdir, binary) # change id of libgcc - commands.getoutput(cmd) - cmd = 'ditto --arch %s %s/lib/libgomp.1.dylib %s/%s.app/Contents/Resources/lib/'%(osxarch, instname, installdir, binary) # copy libgomp - commands.getoutput(cmd) - cmd = 'install_name_tool -id @executable_path/../Resources/lib/libgomp.1.dylib %s/%s.app/Contents/Resources/lib/libgomp.1.dylib'%(installdir, binary) # change id of libgomp - commands.getoutput(cmd) - cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/../Resources/lib/libgcc_s.1.dylib %s/%s.app/Contents/Resources/lib/libgomp.1.dylib'%(instname, installdir, binary) # change ref to libgcc - commands.getoutput(cmd) - cmd = 'install_name_tool -change %s/lib/libgcc_s.1.dylib @executable_path/../Resources/lib/libgcc_s.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libgcc ( blender ) - commands.getoutput(cmd) - cmd = 'install_name_tool -change %s/lib/libgomp.1.dylib @executable_path/../Resources/lib/libgomp.1.dylib %s/%s.app/Contents/MacOS/%s'%(instname, installdir, binary, binary) # change ref to libgomp ( blender ) - commands.getoutput(cmd) - if env['C_COMPILER_ID'] == 'clang' and env['CCVERSION'] >= '3.4': - print "Bundling libiomp5" - instname = env['LCGDIR'][1:] # made libiomp5 part of blender libs - cmd = 'ditto --arch %s %s/openmp/lib/libiomp5.dylib %s/%s.app/Contents/Resources/lib/'%(osxarch, instname, installdir, binary) # copy libiomp5 - commands.getoutput(cmd) - cmd = 'cp %s/openmp/LICENSE.txt %s/LICENSE-libiomp5.txt'%(instname, installdir) # copy libiomp5 license - commands.getoutput(cmd) - -# extract copy system python, be sure to update other build systems -# when making changes to the files that are copied. -def my_unixpybundle_print(target, source, env): - pass - -def UnixPyBundle(target=None, source=None, env=None): - # Any Unix except osx - #-- VERSION/python/lib/python3.1 - - import commands - - def run(cmd): - print 'Install command:', cmd - commands.getoutput(cmd) - - dir = os.path.join(env['BF_INSTALLDIR'], VERSION) - - lib = env['BF_PYTHON_LIBPATH'].split(os.sep)[-1] - target_lib = "lib64" if lib == "lib64" else "lib" - - py_src = env.subst( env['BF_PYTHON_LIBPATH'] + '/python'+env['BF_PYTHON_VERSION'] ) - py_target = env.subst( dir + '/python/' + target_lib + '/python'+env['BF_PYTHON_VERSION'] ) - py_target_bin = env.subst(dir + '/python/bin') - - # This is a bit weak, but dont install if its been installed before, makes rebuilds quite slow. - if os.path.exists(py_target): - print 'Using existing python from:' - print '\t"%s"' % py_target - print '\t(skipping copy)\n' - return - - # Copied from source/creator/CMakeLists.txt, keep in sync. - print 'Install python from:' - print '\t"%s" into...' % py_src - print '\t"%s"\n' % py_target - - run("rm -rf '%s'" % py_target) - try: - os.makedirs(os.path.dirname(py_target)) # the final part is copied - except: - pass - - # install the executable - run("rm -rf '%s'" % py_target_bin) - os.makedirs(py_target_bin) - run("cp '%s' '%s'" % (env.subst(env['BF_PYTHON_BINARY']), py_target_bin)) - - run("cp -R '%s' '%s'" % (py_src, os.path.dirname(py_target))) - run("rm -rf '%s/distutils'" % py_target) - run("rm -rf '%s/lib2to3'" % py_target) - run("rm -rf '%s/config'" % py_target) - - for f in os.listdir(py_target): - if f.startswith("config-"): - run("rm -rf '%s/%s'" % (py_target, f)) - - run("rm -rf '%s/site-packages'" % py_target) - run("mkdir '%s/site-packages'" % py_target) # python needs it.' - run("rm -rf '%s/idlelib'" % py_target) - run("rm -rf '%s/tkinter'" % py_target) - run("rm -rf '%s/turtledemo'" % py_target) - run("rm -r '%s/turtle.py'" % py_target) - run("rm -f '%s/lib-dynload/_tkinter.so'" % py_target) - - if env['WITH_BF_PYTHON_INSTALL_NUMPY']: - numpy_src = py_src + "/site-packages/numpy" - numpy_target = py_target + "/site-packages/numpy" - - if os.path.exists(numpy_src): - print 'Install numpy from:' - print '\t"%s" into...' % numpy_src - print '\t"%s"\n' % numpy_target - - run("cp -R '%s' '%s'" % (numpy_src, os.path.dirname(numpy_target))) - run("rm -rf '%s/distutils'" % numpy_target) - run("rm -rf '%s/oldnumeric'" % numpy_target) - run("rm -rf '%s/doc'" % numpy_target) - run("rm -rf '%s/tests'" % numpy_target) - run("rm -rf '%s/f2py'" % numpy_target) - run("find '%s' -type d -name 'include' -prune -exec rm -rf {} ';'" % numpy_target) - run("find '%s' -type d -name '*.h' -prune -exec rm -rf {} ';'" % numpy_target) - run("find '%s' -type d -name '*.a' -prune -exec rm -rf {} ';'" % numpy_target) - else: - print 'Failed to find numpy at %s, skipping copying' % numpy_src - del numpy_src, numpy_target - - if env['WITH_BF_PYTHON_INSTALL_REQUESTS']: - requests_src = py_src + "/site-packages/requests" - requests_target = py_target + "/site-packages/requests" - if os.path.exists(requests_src): - run("cp -R '%s' '%s'" % (requests_src, os.path.dirname(requests_target))) - run("find '%s' -type d -name '*.pem -prune -exec rm -rf {} ';'" % requests_target) - else: - print('Failed to find requests at %s, skipping copying' % requests_src) - del requests_src, requests_target - - run("find '%s' -type d -name 'test' -prune -exec rm -rf {} ';'" % py_target) - run("find '%s' -type d -name '__pycache__' -exec rm -rf {} ';'" % py_target) - run("find '%s' -name '*.py[co]' -exec rm -rf {} ';'" % py_target) - run("find '%s' -name '*.so' -exec strip -s {} ';'" % py_target) - -#### END ACTION STUFF ######### - -def bsc(env, target, source): - - bd = os.path.dirname(target[0].abspath) - bscfile = '\"'+target[0].abspath+'\"' - bscpathcollect = '\"'+bd + os.sep + '*.sbr\"' - bscpathtmp = '\"'+bd + os.sep + 'bscmake.tmp\"' - - os.system('dir /b/s '+bscpathcollect+' >'+bscpathtmp) - - myfile = open(bscpathtmp[1:-1], 'r') - lines = myfile.readlines() - myfile.close() - - newfile = open(bscpathtmp[1:-1], 'w') - for l in lines: - newfile.write('\"'+l[:-1]+'\"\n') - newfile.close() - - os.system('bscmake /nologo /n /o'+bscfile+' @'+bscpathtmp) - os.system('del '+bscpathtmp) - -class BlenderEnvironment(SConsEnvironment): - - PyBundleActionAdded = False - - def BlenderRes(self=None, libname=None, source=None, libtype=['core'], priority=[100]): - global libs - if not self or not libname or not source: - print bc.FAIL+'Cannot continue. Missing argument for BlenderRes '+libname+bc.ENDC - self.Exit() - if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc', 'win64-mingw'): - print bc.FAIL+'BlenderRes is for windows only!'+bc.END - self.Exit() - - print bc.HEADER+'Configuring resource '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC - lenv = self.Clone() - if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): - res = lenv.RES('#'+root_build_dir+'lib/'+libname, source) - else: - res = lenv.RES(root_build_dir+'lib/'+libname, source) - - - SConsEnvironment.Default(self, res) - resources.append(res) - - def BlenderLib(self=None, libname=None, sources=None, includes=[], defines=[], libtype='common', priority = 100, compileflags=None, cc_compileflags=None, cxx_compileflags=None, cc_compilerchange=None, cxx_compilerchange=None): - global vcp - - # sanity check - # run once in a while to check we dont have duplicates - if 0: - for name, dirs in (("source", sources), ("include", includes)): - files_clean = [os.path.normpath(f) for f in dirs] - files_clean_set = set(files_clean) - if len(files_clean) != len(files_clean_set): - for f in sorted(files_clean_set): - if f != '.' and files_clean.count(f) > 1: - raise Exception("Found duplicate %s %r" % (name, f)) - del name, dirs, files_clean, files_clean_set, f - # end sanity check - - if not self or not libname or not sources: - print bc.FAIL+'Cannot continue. Missing argument for BuildBlenderLib '+libname+bc.ENDC - self.Exit() - - def list_substring(quickie, libname): - for q in quickie: - if q in libname: - return True - return False - - if list_substring(quickie, libname) or len(quickie)==0: - if list_substring(quickdebug, libname): - print bc.HEADER+'Configuring library '+bc.ENDC+bc.OKGREEN+libname +bc.ENDC+bc.OKBLUE+ " (debug mode)" + bc.ENDC - else: - print bc.HEADER+'Configuring library '+bc.ENDC+bc.OKGREEN+libname + bc.ENDC - lenv = self.Clone() - lenv.Append(CPPPATH=includes) - lenv.Append(CPPDEFINES=defines) - if lenv['BF_DEBUG'] or (libname in quickdebug): - lenv.Append(CFLAGS = lenv['BF_DEBUG_CFLAGS']) - lenv.Append(CCFLAGS = lenv['BF_DEBUG_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['BF_DEBUG_CXXFLAGS']) - else: - lenv.Append(CFLAGS = lenv['REL_CFLAGS']) - lenv.Append(CCFLAGS = lenv['REL_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['REL_CXXFLAGS']) - if lenv['BF_PROFILE']: - lenv.Append(CFLAGS = lenv['BF_PROFILE_CFLAGS']) - lenv.Append(CCFLAGS = lenv['BF_PROFILE_CCFLAGS']) - lenv.Append(CXXFLAGS = lenv['BF_PROFILE_CXXFLAGS']) - if compileflags: - lenv.Replace(CFLAGS = compileflags) - if cc_compileflags: - lenv.Replace(CCFLAGS = cc_compileflags) - if cxx_compileflags: - lenv.Replace(CXXFLAGS = cxx_compileflags) - if cc_compilerchange: - lenv.Replace(CC = cc_compilerchange) - if cxx_compilerchange: - lenv.Replace(CXX = cxx_compilerchange) - lenv.Append(CFLAGS = lenv['C_WARN']) - lenv.Append(CCFLAGS = lenv['CC_WARN']) - lenv.Append(CXXFLAGS = lenv['CXX_WARN']) - - if lenv['OURPLATFORM'] == 'win64-vc': - lenv.Append(LINKFLAGS = ['/MACHINE:X64']) - - if lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - if lenv['BF_DEBUG']: - lenv.Append(CCFLAGS = ['/MTd']) - else: - lenv.Append(CCFLAGS = ['/MT']) - - targetdir = root_build_dir+'lib/' + libname - if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'): - targetdir = '#'+targetdir - lib = lenv.Library(target= targetdir, source=sources) - SConsEnvironment.Default(self, lib) # we add to default target, because this way we get some kind of progress info during build - if self['BF_MSVS'] and self['OURPLATFORM'] in ('win32-vc', 'win64-vc'): - #if targetdir[0] == '#': - # targetdir = targetdir[1:-1] - print "! ",targetdir+ '.vcproj' # + self['MSVSPROJECTSUFFIX'] - vcproject = self.MSVSProject(target = targetdir + '.vcproj', # + self['MSVSPROJECTSUFFIX'], - srcs = sources, - buildtarget = lib, - variant = 'Release', - auto_build_solution=0) - vcp.append(vcproject) - SConsEnvironment.Default(self, vcproject) - else: - print bc.WARNING+'Not building '+bc.ENDC+bc.OKGREEN+libname+bc.ENDC+' for '+bc.OKBLUE+'BF_QUICK'+bc.ENDC - # note: libs is a global - add_lib_to_dict(self, libs, libtype, libname, priority) - - def BlenderProg(self=None, builddir=None, progname=None, sources=None, libs=None, libpath=None, binarykind=''): - global vcp - print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC - lenv = self.Clone() - lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS']) - lenv.Append(LINKFLAGS = lenv['BF_PROGRAM_LINKFLAGS']) - if lenv['OURPLATFORM'] in ('win32-mingw', 'win64-mingw', 'linuxcross', 'cygwin', 'linux'): - lenv.Replace(LINK = '$CXX') - if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'): - if lenv['BF_DEBUG']: - lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb','/NODEFAULTLIB:libcmt']) - if lenv['OURPLATFORM']=='linux': - if lenv['WITH_BF_PYTHON']: - lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) - if lenv['OURPLATFORM']=='sunos5': - if lenv['WITH_BF_PYTHON']: - lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) - if lenv['CXX'].endswith('CC'): - lenv.Replace(LINK = '$CXX') - if lenv['OURPLATFORM']=='darwin': - if lenv['WITH_BF_PYTHON']: - lenv.Append(LINKFLAGS = lenv['BF_PYTHON_LINKFLAGS']) - lenv.Append(LINKFLAGS = lenv['BF_OPENGL_LINKFLAGS']) - if lenv['BF_PROFILE']: - lenv.Append(LINKFLAGS = lenv['BF_PROFILE_LINKFLAGS']) - if root_build_dir[0]==os.sep or root_build_dir[1]==':': - lenv.Append(LIBPATH=root_build_dir + '/lib') - lenv.Append(LIBPATH=libpath) - lenv.Append(LIBS=libs) - if lenv['WITH_BF_QUICKTIME']: - lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB']) - lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH']) - prog = lenv.Program(target=builddir+'bin/'+progname, source=sources) - if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc') and lenv['BF_BSC']: - f = lenv.File(progname + '.bsc', builddir) - brs = lenv.Command(f, prog, [bsc]) - SConsEnvironment.Default(self, brs) - SConsEnvironment.Default(self, prog) - if self['BF_MSVS'] and self['OURPLATFORM'] in ('win32-vc', 'win64-vc') and progname == 'blender': - print "! ",builddir + "/" + progname + '.sln' - sln = self.MSVSProject(target = builddir + "/" + progname + '.sln', - projects= vcp, - variant = 'Release') - SConsEnvironment.Default(self, sln) - program_list.append(prog) - if lenv['OURPLATFORM']=='darwin': - lenv['BINARYKIND'] = binarykind - lenv.AddPostAction(prog,Action(AppIt,strfunction=my_appit_print)) - elif os.sep == '/' and lenv['OURPLATFORM'] != 'linuxcross': # any unix (except cross-compilation) - if lenv['WITH_BF_PYTHON']: - if (not lenv['WITHOUT_BF_INSTALL'] and - not lenv['WITHOUT_BF_PYTHON_INSTALL'] and - not lenv['WITHOUT_BF_PYTHON_UNPACK'] and - not BlenderEnvironment.PyBundleActionAdded): - lenv.AddPostAction(prog,Action(UnixPyBundle,strfunction=my_unixpybundle_print)) - BlenderEnvironment.PyBundleActionAdded = True - elif lenv['OURPLATFORM'].startswith('win') or lenv['OURPLATFORM'] == 'linuxcross': # windows or cross-compilation - if lenv['WITH_BF_PYTHON']: - if (not lenv['WITHOUT_BF_PYTHON_INSTALL'] and - not lenv['WITHOUT_BF_PYTHON_UNPACK'] and - not BlenderEnvironment.PyBundleActionAdded): - lenv.AddPostAction(prog,Action(WinPyBundle,strfunction=my_winpybundle_print)) - BlenderEnvironment.PyBundleActionAdded = True - return prog - - def Glob(lenv, pattern): - path = string.replace(GetBuildPath(lenv,'SConscript'),'SConscript', '') - files = [] - for i in glob.glob(path + pattern): - files.append(string.replace(i, path, '')) - return files diff --git a/build_files/scons/tools/__init__.py b/build_files/scons/tools/__init__.py deleted file mode 100644 index e69de29bb2d..00000000000 --- a/build_files/scons/tools/__init__.py +++ /dev/null diff --git a/build_files/scons/tools/bcolors.py b/build_files/scons/tools/bcolors.py deleted file mode 100644 index b01bb781524..00000000000 --- a/build_files/scons/tools/bcolors.py +++ /dev/null @@ -1,16 +0,0 @@ -class bcolors: - HEADER = '\033[95m' - OKBLUE = '\033[94m' - OKGREEN = '\033[92m' - WARNING = '\033[93m' - FAIL = '\033[91m' - ENDC = '\033[0m' - - def disable(self): - self.HEADER = '' - self.OKBLUE = '' - self.OKGREEN = '' - self.WARNING = '' - self.FAIL = '' - self.ENDC = '' - diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py deleted file mode 100644 index 0b85940d024..00000000000 --- a/build_files/scons/tools/btools.py +++ /dev/null @@ -1,918 +0,0 @@ -import os -import os.path -import SCons.Options - -import SCons.Variables -try: - import subprocess -except ImportError: - pass -import string -import shutil -import sys - -Variables = SCons.Variables -BoolVariable = SCons.Variables.BoolVariable - -def get_command_output(*popenargs, **kwargs): - if hasattr(subprocess, "check_output"): - return subprocess.check_output(*popenargs, **kwargs) - if 'stdout' in kwargs: - raise ValueError('stdout argument not allowed, it will be overridden.') - process = subprocess.Popen(stdout=subprocess.PIPE, *popenargs, **kwargs) - output, unused_err = process.communicate() - retcode = process.poll() - if retcode: - cmd = kwargs.get("args") - if cmd is None: - cmd = popenargs[0] - raise subprocess.CalledProcessError(retcode, cmd) - return output - -def get_version(): - import re - - fname = os.path.join(os.path.dirname(__file__), "..", "..", "..", "source", "blender", "blenkernel", "BKE_blender.h") - ver_base = None - ver_char = None - ver_cycle = None - - re_ver = re.compile("^#\s*define\s+BLENDER_VERSION\s+([0-9]+)") - re_ver_char = re.compile("^#\s*define\s+BLENDER_VERSION_CHAR\s*(\S*)") # optional arg - re_ver_cycle = re.compile("^#\s*define\s+BLENDER_VERSION_CYCLE\s*(\S*)") # optional arg - - for l in open(fname, "r"): - match = re_ver.match(l) - if match: - ver = int(match.group(1)) - ver_base = "%d.%d" % (ver / 100, ver % 100) - - match = re_ver_char.match(l) - if match: - ver_char = match.group(1) - if ver_char == "BLENDER_CHAR_VERSION": - ver_char = "" - - match = re_ver_cycle.match(l) - if match: - ver_cycle = match.group(1) - if ver_cycle == "BLENDER_CYCLE_VERSION": - ver_cycle = "" - - if (ver_base is not None) and (ver_char is not None) and (ver_cycle is not None): - # eg '2.56a-beta' - if ver_cycle != "release": - ver_display = "%s%s-%s" % (ver_base, ver_char, ver_cycle) - else: - ver_display = "%s%s" % (ver_base, ver_char) - - return ver_base, ver_display, ver_cycle - - raise Exception("%s: missing version string" % fname) - -def get_hash(): - try: - build_hash = get_command_output(['git', 'rev-parse', '--short', 'HEAD']).strip() - except OSError: - build_hash = None - print("WARNING: could not use git to retrieve current Blender repository hash...") - except subprocess.CalledProcessError as e: - build_hash = None - print("WARNING: git errored while retrieving current Blender repository hash (%d)..." % e.returncode) - if build_hash == '' or build_hash == None: - build_hash = 'UNKNOWN' - - return build_hash - - -def checkEndian(): - return sys.byteorder - - -# This is used in creating the local config directories -VERSION, VERSION_DISPLAY, VERSION_RELEASE_CYCLE = get_version() -HASH = get_hash() -ENDIAN = checkEndian() - - -def print_arguments(args, bc): - if len(args): - for k,v in args.iteritems(): - if type(v)==list: - v = ' '.join(v) - print '\t'+bc.OKBLUE+k+bc.ENDC+' = '+bc.OKGREEN + v + bc.ENDC - else: - print '\t'+bc.WARNING+'No command-line arguments given'+bc.ENDC - -def validate_arguments(args, bc): - opts_list = [ - 'WITH_BF_FREESTYLE', 'WITH_BF_PYTHON', 'WITH_BF_PYTHON_SAFETY', 'WITH_BF_PYTHON_SECURITY', 'BF_PYTHON', 'BF_PYTHON_VERSION', 'BF_PYTHON_INC', 'BF_PYTHON_BINARY', 'BF_PYTHON_LIB', 'BF_PYTHON_LIBPATH', 'BF_PYTHON_LIBPATH_ARCH', 'WITH_BF_STATICPYTHON', 'WITH_OSX_STATICPYTHON', 'BF_PYTHON_LIB_STATIC', 'BF_PYTHON_DLL', 'BF_PYTHON_ABI_FLAGS', - 'WITH_BF_AUDASPACE', 'BF_AUDASPACE_C_INC', 'BF_AUDASPACE_PY_INC', 'BF_AUDASPACE_DEF', - 'WITH_BF_OPENAL', 'BF_OPENAL', 'BF_OPENAL_INC', 'BF_OPENAL_LIB', 'BF_OPENAL_LIBPATH', 'WITH_BF_STATICOPENAL', 'BF_OPENAL_LIB_STATIC', - 'WITH_BF_SDL', 'BF_SDL', 'BF_SDL_INC', 'BF_SDL_LIB', 'BF_SDL_LIBPATH', 'WITH_BF_SDL_DYNLOAD', - 'WITH_BF_JACK', 'BF_JACK', 'BF_JACK_INC', 'BF_JACK_LIB', 'BF_JACK_LIBPATH', 'WITH_BF_JACK_DYNLOAD', - 'WITH_BF_SNDFILE', 'BF_SNDFILE', 'BF_SNDFILE_INC', 'BF_SNDFILE_LIB', 'BF_SNDFILE_LIBPATH', 'WITH_BF_STATICSNDFILE', 'BF_SNDFILE_LIB_STATIC', - 'BF_PTHREADS', 'BF_PTHREADS_INC', 'BF_PTHREADS_LIB', 'BF_PTHREADS_LIBPATH', - 'WITH_BF_OPENEXR', 'BF_OPENEXR', 'BF_OPENEXR_INC', 'BF_OPENEXR_LIB', 'BF_OPENEXR_LIBPATH', 'WITH_BF_STATICOPENEXR', 'BF_OPENEXR_LIB_STATIC', - 'WITH_BF_DDS', 'WITH_BF_CINEON', 'WITH_BF_HDR', - 'WITH_BF_FFMPEG', 'BF_FFMPEG_LIB','BF_FFMPEG_EXTRA', 'BF_FFMPEG', 'BF_FFMPEG_INC', 'BF_FFMPEG_DLL', - 'WITH_BF_STATICFFMPEG', 'BF_FFMPEG_LIB_STATIC', - 'WITH_BF_OGG', 'BF_OGG', 'BF_OGG_LIB', - 'WITH_BF_FRAMESERVER', - 'WITH_BF_COMPOSITOR', - 'WITH_BF_JPEG', 'BF_JPEG', 'BF_JPEG_INC', 'BF_JPEG_LIB', 'BF_JPEG_LIBPATH', 'WITH_BF_STATICJPEG', 'BF_JPEG_LIB_STATIC', - 'WITH_BF_OPENJPEG', 'BF_OPENJPEG', 'BF_OPENJPEG_INC', 'BF_OPENJPEG_LIB', 'BF_OPENJPEG_LIBPATH', - 'WITH_BF_REDCODE', 'BF_REDCODE', 'BF_REDCODE_INC', 'BF_REDCODE_LIB', 'BF_REDCODE_LIBPATH', - 'WITH_BF_PNG', 'BF_PNG', 'BF_PNG_INC', 'BF_PNG_LIB', 'BF_PNG_LIBPATH', 'WITH_BF_STATICPNG', 'BF_PNG_LIB_STATIC', - 'WITH_BF_TIFF', 'BF_TIFF', 'BF_TIFF_INC', 'BF_TIFF_LIB', 'BF_TIFF_LIBPATH', 'WITH_BF_STATICTIFF', 'BF_TIFF_LIB_STATIC', - 'WITH_BF_ZLIB', 'BF_ZLIB', 'BF_ZLIB_INC', 'BF_ZLIB_LIB', 'BF_ZLIB_LIBPATH', 'WITH_BF_STATICZLIB', 'BF_ZLIB_LIB_STATIC', - 'WITH_BF_INTERNATIONAL', - 'WITH_BF_ICONV', 'BF_ICONV', 'BF_ICONV_INC', 'BF_ICONV_LIB', 'BF_ICONV_LIBPATH', - 'WITH_BF_GAMEENGINE', - 'WITH_BF_BULLET', 'BF_BULLET', 'BF_BULLET_INC', 'BF_BULLET_LIB', - # 'WITH_BF_ELTOPO', # now only available in a branch - 'BF_LAPACK', 'BF_LAPACK_LIB', 'BF_LAPACK_LIBPATH', 'BF_LAPACK_LIB_STATIC', - 'BF_WINTAB', 'BF_WINTAB_INC', - 'BF_FREETYPE', 'BF_FREETYPE_INC', 'BF_FREETYPE_LIB', 'BF_FREETYPE_LIBPATH', 'BF_FREETYPE_LIB_STATIC', 'WITH_BF_FREETYPE_STATIC', - 'WITH_BF_QUICKTIME', 'BF_QUICKTIME', 'BF_QUICKTIME_INC', 'BF_QUICKTIME_LIB', 'BF_QUICKTIME_LIBPATH', - 'WITH_BF_FFTW3', 'BF_FFTW3', 'BF_FFTW3_INC', 'BF_FFTW3_LIB', 'BF_FFTW3_LIBPATH', 'WITH_BF_STATICFFTW3', 'BF_FFTW3_LIB_STATIC', - 'WITH_BF_STATICOPENGL', 'BF_OPENGL', 'BF_OPENGL_INC', 'BF_OPENGL_LIB', 'BF_OPENGL_LIBPATH', 'BF_OPENGL_LIB_STATIC', - 'WITH_BF_EGL', 'WITH_BF_GLEW_ES', 'BF_GLEW_INC', 'WITH_BF_GL_PROFILE_CORE', 'WITH_BF_GL_PROFILE_COMPAT', 'WITH_BF_GL_PROFILE_ES20', - 'WITH_BF_GLEW_MX', 'WITH_BF_GL_EGL', 'WITH_BF_GL_ANGLE', - - 'WITH_BF_COLLADA', 'BF_COLLADA', 'BF_COLLADA_INC', 'BF_COLLADA_LIB', 'BF_OPENCOLLADA', 'BF_OPENCOLLADA_INC', 'BF_OPENCOLLADA_LIB', 'BF_OPENCOLLADA_LIBPATH', 'BF_PCRE', 'BF_PCRE_LIB', 'BF_PCRE_LIBPATH', 'BF_EXPAT', 'BF_EXPAT_LIB', 'BF_EXPAT_LIBPATH', - 'WITH_BF_STATICOPENCOLLADA', 'BF_OPENCOLLADA_LIB_STATIC', - 'WITH_BF_PLAYER', - 'WITH_BF_NOBLENDER', - 'WITH_BF_BINRELOC', - 'WITH_BF_LZO', 'WITH_BF_LZMA', - 'LCGDIR', - 'BF_CXX', 'WITH_BF_STATICCXX', 'BF_CXX_LIB_STATIC', - 'BF_TWEAK_MODE', 'BF_SPLIT_SRC', - 'WITHOUT_BF_INSTALL', - 'WITHOUT_BF_PYTHON_INSTALL', 'WITHOUT_BF_PYTHON_UNPACK', - 'WITH_BF_PYTHON_INSTALL_NUMPY', 'WITH_BF_PYTHON_INSTALL_REQUESTS', - 'WITHOUT_BF_OVERWRITE_INSTALL', - 'WITH_BF_OPENMP', 'BF_OPENMP', 'BF_OPENMP_LIBPATH', 'WITH_BF_STATICOPENMP', 'BF_OPENMP_STATIC_STATIC', - 'WITH_GHOST_SDL', - 'WITH_GHOST_XDND', - 'WITH_X11_XINPUT', - 'WITH_X11_XF86VMODE', - 'BF_GHOST_DEBUG', - 'BF_FANCY', 'BF_QUIET', 'BF_LINE_OVERWRITE', - 'BF_X264_CONFIG', - 'BF_XVIDCORE_CONFIG', - 'WITH_BF_DOCS', - 'BF_NUMJOBS', - 'BF_MSVS', - 'WITH_BF_RAYOPTIMIZATION', - 'BF_RAYOPTIMIZATION_SSE_FLAGS', - 'WITH_BF_FLUID', - 'WITH_BF_BOOLEAN', - 'WITH_BF_REMESH', - 'WITH_BF_OCEANSIM', - 'WITH_BF_SMOKE', - 'WITH_BF_CXX_GUARDEDALLOC', - 'WITH_BF_JEMALLOC', 'WITH_BF_STATICJEMALLOC', 'BF_JEMALLOC', 'BF_JEMALLOC_INC', 'BF_JEMALLOC_LIBPATH', 'BF_JEMALLOC_LIB', 'BF_JEMALLOC_LIB_STATIC', - 'BUILDBOT_BRANCH', - 'WITH_BF_IME', - 'WITH_BF_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC', - 'WITH_BF_CYCLES', 'WITH_BF_CYCLES_CUDA_BINARIES', 'BF_CYCLES_CUDA_NVCC', 'BF_CYCLES_CUDA_NVCC', 'WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'BF_CYCLES_CUDA_ENV', - 'WITH_BF_OIIO', 'WITH_BF_STATICOIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIB_STATIC', 'BF_OIIO_LIBPATH', - 'WITH_BF_OCIO', 'WITH_BF_STATICOCIO', 'BF_OCIO', 'BF_OCIO_INC', 'BF_OCIO_LIB', 'BF_OCIO_LIB_STATIC', 'BF_OCIO_LIBPATH', - 'WITH_BF_BOOST', 'WITH_BF_STATICBOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIB_INTERNATIONAL', 'BF_BOOST_LIB_STATIC', 'BF_BOOST_LIBPATH', - 'WITH_BF_LIBMV', 'WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS', - 'WITH_BF_CYCLES_OSL', 'WITH_BF_STATICOSL', 'BF_OSL', 'BF_OSL_INC', 'BF_OSL_LIB', 'BF_OSL_LIBPATH', 'BF_OSL_LIB_STATIC', 'BF_OSL_COMPILER', - 'WITH_BF_LLVM', 'WITH_BF_STATICLLVM', 'BF_LLVM', 'BF_LLVM_LIB', 'BF_LLVM_LIBPATH', 'BF_LLVM_LIB_STATIC', 'BF_PROGRAM_LINKFLAGS', - 'WITH_BF_OPENSUBDIV', 'WITH_BF_STATICOPENSUBDIV', 'BF_OPENSUBDIV', 'BF_OPENSUBDIV_INC', 'BF_OPENSUBDIV_LIB', 'BF_OPENSUBDIV_LIBPATH', 'BF_OPENSUBDIV_LIB_STATIC' - ] - - # Have options here that scons expects to be lists - opts_list_split = [ - 'BF_PYTHON_LINKFLAGS', - 'BF_OPENGL_LINKFLAGS', - 'BF_GL_DEFINITIONS', - 'CFLAGS', 'CCFLAGS', 'CXXFLAGS', 'CPPFLAGS', - 'REL_CFLAGS', 'REL_CCFLAGS', 'REL_CXXFLAGS', - 'BGE_CXXFLAGS', - 'BF_PROFILE_CFLAGS', 'BF_PROFILE_CCFLAGS', 'BF_PROFILE_CXXFLAGS', 'BF_PROFILE_LINKFLAGS', - 'BF_DEBUG_CFLAGS', 'BF_DEBUG_CCFLAGS', 'BF_DEBUG_CXXFLAGS', - 'C_WARN', 'CC_WARN', 'CXX_WARN', - 'LLIBS', 'PLATFORM_LINKFLAGS', 'MACOSX_ARCHITECTURE', 'MACOSX_SDK', 'XCODE_CUR_VER', 'C_COMPILER_ID', - 'BF_CYCLES_CUDA_BINARIES_ARCH', 'BF_PROGRAM_LINKFLAGS', 'MACOSX_DEPLOYMENT_TARGET', - 'WITH_BF_CYCLES_DEBUG', 'WITH_BF_CYCLES_LOGGING', - 'WITH_BF_CPP11', 'WITH_BF_LEGACY_DEPSGRAPH', - ] - - - arg_list = ['BF_DEBUG', 'BF_QUIET', 'BF_CROSS', 'BF_UPDATE', - 'BF_INSTALLDIR', 'BF_TOOLSET', 'BF_BINNAME', - 'BF_BUILDDIR', 'BF_FANCY', 'BF_QUICK', 'BF_PROFILE', 'BF_LINE_OVERWRITE', - 'BF_BSC', 'BF_CONFIG', - 'BF_PRIORITYLIST', 'BF_BUILDINFO','CC', 'CXX', 'BF_QUICKDEBUG', - 'BF_LISTDEBUG', 'LCGDIR', 'BF_X264_CONFIG', 'BF_XVIDCORE_CONFIG', - 'BF_UNIT_TEST', 'BF_BITNESS', 'MSVS_VERSION'] - - okdict = {} - - for k,v in args.iteritems(): - if (k in opts_list) or (k in arg_list): - okdict[k] = v - elif k in opts_list_split: - okdict[k] = v.split() # "" have already been stripped - else: - print '\t'+bc.WARNING+'Invalid argument: '+bc.ENDC+k+'='+v - - return okdict - -def print_targets(targs, bc): - if len(targs)>0: - for t in targs: - print '\t'+bc.OKBLUE+t+bc.ENDC - else: - print '\t'+bc.WARNING+'No targets given, using '+bc.ENDC+bc.OKGREEN+'default'+bc.ENDC - -def validate_targets(targs, bc): - valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin', - 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release', - 'everything', 'clean', 'install-bin', 'install', 'nsis','buildslave', - 'cudakernels'] - oklist = [] - for t in targs: - if t in valid_list: - oklist.append(t) - else: - print '\t'+bc.WARNING+'Invalid target: '+bc.ENDC+t - return oklist - -class OurSpawn: - def ourspawn(self, sh, escape, cmd, args, env): - newargs = " ".join(args[1:]) - cmdline = cmd + " " + newargs - startupinfo = subprocess.STARTUPINFO() - proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env=env) - data, err = proc.communicate() - rv = proc.wait() - if err: - print(err) - return rv - -def SetupSpawn( env ): - buf = OurSpawn() - env['SPAWN'] = buf.ourspawn - - -def read_opts(env, cfg, args): - localopts = Variables.Variables(cfg, args) - localopts.AddVariables( - ('LCGDIR', 'Location of SVN lib dir'), - ('LIBDIR', 'Root dir of libs'), - (BoolVariable('WITH_BF_PYTHON', 'Compile with python', True)), - (BoolVariable('WITH_BF_PYTHON_SAFETY', 'Internal API error checking to track invalid data to prevent crash on access (at the expense of some effeciency)', False)), - (BoolVariable('WITH_BF_PYTHON_SECURITY', 'Disables execution of scripts within blend files by default', True)), - ('BF_PYTHON', 'Base path for python', ''), - ('BF_PYTHON_VERSION', 'Python version to use', ''), - ('BF_PYTHON_INC', 'Include path for Python headers', ''), - ('BF_PYTHON_BINARY', 'Path to the Python interpreter', ''), - ('BF_PYTHON_LIB', 'Python library', ''), - ('BF_PYTHON_LIBPATH_ARCH', 'Additional Python library under some linux flavors (arch-dependent)', ''), - ('BF_PYTHON_DLL', 'Python dll - used on Windows only', ''), - ('BF_PYTHON_LIB_STATIC', 'Python static libraries', ''), - ('BF_PYTHON_LIBPATH', 'Library path', ''), - ('BF_PYTHON_LINKFLAGS', 'Python link flags', ''), - (BoolVariable('WITH_BF_STATICPYTHON', 'Staticly link to python', False)), - (BoolVariable('WITH_OSX_STATICPYTHON', 'Staticly link to python', True)), - ('BF_PYTHON_ABI_FLAGS', 'Python ABI flags (suffix in library version: m, mu, etc)', ''), - - (BoolVariable('WITH_BF_FLUID', 'Build with Fluid simulation (Elbeem)', True)), - (BoolVariable('WITH_BF_BOOLEAN', 'Build with boolean modifier', True)), - (BoolVariable('WITH_BF_REMESH', 'Build with remesh modifier', True)), - (BoolVariable('WITH_BF_OCEANSIM', 'Build with ocean simulation', False)), - (BoolVariable('WITH_BF_SMOKE', 'Build with smoke simulation', True)), - ('BF_PROFILE_FLAGS', 'Profiling compiler flags', ''), - (BoolVariable('WITH_BF_OPENAL', 'Use OpenAL if true', False)), - ('BF_OPENAL', 'Base path for OpenAL', ''), - ('BF_OPENAL_INC', 'Include path for python headers', ''), - ('BF_OPENAL_LIB', 'Path to OpenAL library', ''), - ('BF_OPENAL_LIB_STATIC', 'Path to OpenAL static library', ''), - ('BF_OPENAL_LIBPATH', 'Path to OpenAL library', ''), - (BoolVariable('WITH_BF_STATICOPENAL', 'Staticly link to openal', False)), - - (BoolVariable('WITH_BF_AUDASPACE', 'Build with audaspace if true', True)), - ('BF_AUDASPACE_C_INC', 'audaspace-c include path', ''), - ('BF_AUDASPACE_PY_INC', 'audaspace-py include path', ''), - ('BF_AUDASPACE_DEF', 'audaspace defines', ''), - - (BoolVariable('WITH_BF_SDL', 'Use SDL if true', False)), - ('BF_SDL', 'SDL base path', ''), - ('BF_SDL_INC', 'SDL include path', ''), - ('BF_SDL_LIB', 'SDL library', ''), - ('BF_SDL_LIBPATH', 'SDL library path', ''), - (BoolVariable('WITH_BF_SDL_DYNLOAD', 'Enable runtime dynamic SDL libraries loading (works only on Linux)', False)), - - (BoolVariable('WITH_BF_JACK', 'Enable jack support if true', True)), - ('BF_JACK', 'jack base path', ''), - ('BF_JACK_INC', 'jack include path', ''), - ('BF_JACK_LIB', 'jack library', ''), - ('BF_JACK_LIBPATH', 'jack library path', ''), - (BoolVariable('WITH_BF_JACK_DYNLOAD', 'Enable runtime dynamic Jack libraries loading (works only on Linux)', False)), - - (BoolVariable('WITH_BF_SNDFILE', 'Enable sndfile support if true', True)), - ('BF_SNDFILE', 'sndfile base path', ''), - ('BF_SNDFILE_INC', 'sndfile include path', ''), - ('BF_SNDFILE_LIB', 'sndfile library', ''), - ('BF_SNDFILE_LIB_STATIC', 'Path to sndfile static library', ''), - ('BF_SNDFILE_LIBPATH', 'sndfile library path', ''), - (BoolVariable('WITH_BF_STATICSNDFILE', 'Staticly link to sndfile', False)), - - ('BF_PTHREADS', 'Pthreads base path', ''), - ('BF_PTHREADS_INC', 'Pthreads include path', ''), - ('BF_PTHREADS_LIB', 'Pthreads library', ''), - ('BF_PTHREADS_LIBPATH', 'Pthreads library path', ''), - - (BoolVariable('WITH_BF_OPENEXR', 'Use OPENEXR if true', True)), - (BoolVariable('WITH_BF_STATICOPENEXR', 'Staticly link to OpenEXR', False)), - ('BF_OPENEXR', 'OPENEXR base path', ''), - ('BF_OPENEXR_INC', 'OPENEXR include path', ''), - ('BF_OPENEXR_LIB', 'OPENEXR library', ''), - ('BF_OPENEXR_LIBPATH', 'OPENEXR library path', ''), - ('BF_OPENEXR_LIB_STATIC', 'OPENEXR static library', ''), - - (BoolVariable('WITH_BF_DDS', 'Support DDS image format if true', True)), - - (BoolVariable('WITH_BF_CINEON', 'Support CINEON and DPX image formats if true', True)), - - (BoolVariable('WITH_BF_HDR', 'Support HDR image formats if true', True)), - - (BoolVariable('WITH_BF_FRAMESERVER', 'Support export to a frameserver', True)), - - (BoolVariable('WITH_BF_FFMPEG', 'Use FFMPEG if true', False)), - ('BF_FFMPEG', 'FFMPEG base path', ''), - ('BF_FFMPEG_LIB', 'FFMPEG library', ''), - ('BF_FFMPEG_DLL', 'FFMPEG dll libraries to be installed', ''), - ('BF_FFMPEG_EXTRA', 'FFMPEG flags that must be preserved', ''), - - ('BF_FFMPEG_INC', 'FFMPEG includes', ''), - ('BF_FFMPEG_LIBPATH', 'FFMPEG library path', ''), - (BoolVariable('WITH_BF_STATICFFMPEG', 'Use static FFMPEG if true', False)), - ('BF_FFMPEG_LIB_STATIC', 'Static FFMPEG libraries', ''), - - (BoolVariable('WITH_BF_OGG', 'Link OGG, THEORA, VORBIS with FFMPEG if true', - False)), - ('BF_OGG', 'OGG base path', ''), - ('BF_OGG_LIB', 'OGG library', ''), - - (BoolVariable('WITH_BF_JPEG', 'Use JPEG if true', True)), - (BoolVariable('WITH_BF_STATICJPEG', 'Staticly link to JPEG', False)), - ('BF_JPEG', 'JPEG base path', ''), - ('BF_JPEG_INC', 'JPEG include path', ''), - ('BF_JPEG_LIB', 'JPEG library', ''), - ('BF_JPEG_LIBPATH', 'JPEG library path', ''), - ('BF_JPEG_LIB_STATIC', 'JPEG static library', ''), - - (BoolVariable('WITH_BF_OPENJPEG', 'Use OPENJPEG if true', False)), - ('BF_OPENJPEG', 'OPENJPEG base path', ''), - ('BF_OPENJPEG_INC', 'OPENJPEG include path', ''), - ('BF_OPENJPEG_LIB', 'OPENJPEG library', ''), - ('BF_OPENJPEG_LIBPATH', 'OPENJPEG library path', ''), - - (BoolVariable('WITH_BF_REDCODE', 'Use REDCODE if true', False)), - ('BF_REDCODE', 'REDCODE base path', ''), - ('BF_REDCODE_INC', 'REDCODE include path', ''), - ('BF_REDCODE_LIB', 'REDCODE library', ''), - ('BF_REDCODE_LIBPATH', 'REDCODE library path', ''), - - (BoolVariable('WITH_BF_PNG', 'Use PNG if true', True)), - (BoolVariable('WITH_BF_STATICPNG', 'Staticly link to PNG', False)), - ('BF_PNG', 'PNG base path', ''), - ('BF_PNG_INC', 'PNG include path', ''), - ('BF_PNG_LIB', 'PNG library', ''), - ('BF_PNG_LIBPATH', 'PNG library path', ''), - ('BF_PNG_LIB_STATIC', 'PNG static library', ''), - - (BoolVariable('WITH_BF_TIFF', 'Use TIFF if true', True)), - (BoolVariable('WITH_BF_STATICTIFF', 'Staticly link to TIFF', False)), - ('BF_TIFF', 'TIFF base path', ''), - ('BF_TIFF_INC', 'TIFF include path', ''), - ('BF_TIFF_LIB', 'TIFF library', ''), - ('BF_TIFF_LIBPATH', 'TIFF library path', ''), - ('BF_TIFF_LIB_STATIC', 'TIFF static library', ''), - - (BoolVariable('WITH_BF_ZLIB', 'Use ZLib if true', True)), - (BoolVariable('WITH_BF_STATICZLIB', 'Staticly link to ZLib', False)), - ('BF_ZLIB', 'ZLib base path', ''), - ('BF_ZLIB_INC', 'ZLib include path', ''), - ('BF_ZLIB_LIB', 'ZLib library', ''), - ('BF_ZLIB_LIBPATH', 'ZLib library path', ''), - ('BF_ZLIB_LIB_STATIC', 'ZLib static library', ''), - - (BoolVariable('WITH_BF_INTERNATIONAL', 'Use Boost::locale if true', True)), - - (BoolVariable('WITH_BF_ICONV', 'Use iconv if true', True)), - ('BF_ICONV', 'iconv base path', ''), - ('BF_ICONV_INC', 'iconv include path', ''), - ('BF_ICONV_LIB', 'iconv library', ''), - ('BF_ICONV_LIBPATH', 'iconv library path', ''), - - (BoolVariable('WITH_BF_FREESTYLE', 'Compile with freestyle', True)), - - (BoolVariable('WITH_BF_GAMEENGINE', 'Build with gameengine' , False)), - - (BoolVariable('WITH_BF_BULLET', 'Use Bullet if true', True)), - # (BoolVariable('WITH_BF_ELTOPO', 'Use Eltopo collision library if true', False)), # this is now only available in a branch - ('BF_LAPACK', 'LAPACK base path', ''), - ('BF_LAPACK_LIB', 'LAPACK library', ''), - ('BF_LAPACK_LIB_STATIC', 'LAPACK library', ''), - ('BF_LAPACK_LIBPATH', 'LAPACK library path', ''), - (BoolVariable('WITH_BF_STATICLAPACK', 'Staticly link to LAPACK', False)), - - ('BF_BULLET', 'Bullet base dir', ''), - ('BF_BULLET_INC', 'Bullet include path', ''), - ('BF_BULLET_LIB', 'Bullet library', ''), - - ('BF_WINTAB', 'WinTab base dir', ''), - ('BF_WINTAB_INC', 'WinTab include dir', ''), - ('BF_CXX', 'c++ base path for libstdc++, only used when static linking', ''), - (BoolVariable('WITH_BF_STATICCXX', 'static link to stdc++', False)), - ('BF_CXX_LIB_STATIC', 'static library path for stdc++', ''), - - ('BF_FREETYPE', 'Freetype base path', ''), - ('BF_FREETYPE_INC', 'Freetype include path', ''), - ('BF_FREETYPE_LIB', 'Freetype library', ''), - ('BF_FREETYPE_LIBPATH', 'Freetype library path', ''), - (BoolVariable('WITH_BF_FREETYPE_STATIC', 'Use Static Freetype if true', False)), - ('BF_FREETYPE_LIB_STATIC', 'Static Freetype library', ''), - - (BoolVariable('WITH_BF_OPENMP', 'Use OpenMP if true', False)), - (BoolVariable('WITH_BF_STATICOPENMP', 'Staticly link to OpenMP', False)), - ('BF_OPENMP', 'Base path to OpenMP (used when cross-compiling with older versions of WinGW)', ''), - ('BF_OPENMP_INC', 'Path to OpenMP includes (used when cross-compiling with older versions of WinGW)', ''), - ('BF_OPENMP_LIBPATH', 'Path to OpenMP libraries (used when cross-compiling with older versions of WinGW)', ''), - (BoolVariable('WITH_GHOST_SDL', 'Enable building blender against SDL for windowing rather then the native APIs', False)), - (BoolVariable('WITH_X11_XINPUT', 'Enable X11 Xinput (tablet support and unicode input)', True)), - (BoolVariable('WITH_X11_XF86VMODE', 'Enable X11 video mode switching', True)), - ('BF_OPENMP_LIB_STATIC', 'OpenMP static library', ''), - - (BoolVariable('WITH_BF_QUICKTIME', 'Use QuickTime if true', False)), - ('BF_QUICKTIME', 'QuickTime base path', ''), - ('BF_QUICKTIME_INC', 'QuickTime include path', ''), - ('BF_QUICKTIME_LIB', 'QuickTime library', ''), - ('BF_QUICKTIME_LIBPATH', 'QuickTime library path', ''), - - (BoolVariable('WITH_BF_FFTW3', 'Use FFTW3 if true', False)), - ('BF_FFTW3', 'FFTW3 base path', ''), - ('BF_FFTW3_INC', 'FFTW3 include path', ''), - ('BF_FFTW3_LIB', 'FFTW3 library', ''), - ('BF_FFTW3_LIB_STATIC', 'FFTW3 static libraries', ''), - ('BF_FFTW3_LIBPATH', 'FFTW3 library path', ''), - (BoolVariable('WITH_BF_STATICFFTW3', 'Staticly link to FFTW3', False)), - - (BoolVariable('WITH_BF_STATICOPENGL', 'Use MESA if true', True)), - ('BF_OPENGL', 'OpenGL base path', ''), - ('BF_OPENGL_INC', 'OpenGL include path', ''), - ('BF_OPENGL_LIB', 'OpenGL libraries', ''), - ('BF_OPENGL_LIBPATH', 'OpenGL library path', ''), - ('BF_OPENGL_LIB_STATIC', 'OpenGL static libraries', ''), - ('BF_OPENGL_LINKFLAGS', 'OpenGL link flags', ''), - - (BoolVariable('WITH_BF_GLEW_MX', '', False)), - (BoolVariable('WITH_BF_GLEW_ES', '', False)), - (BoolVariable('WITH_BF_GL_EGL', '', False)), - (BoolVariable('WITH_BF_GL_PROFILE_COMPAT', '', True)), - (BoolVariable('WITH_BF_GL_PROFILE_CORE', '', False)), - (BoolVariable('WITH_BF_GL_PROFILE_ES20', '', False)), - (BoolVariable('WITH_BF_GL_ANGLE', '', False)), - ('BF_GL_DEFINITIONS', '', []), - ('BF_GLEW_INC', '', ''), - ) # end of opts.AddVariables() - - localopts.AddVariables( - (BoolVariable('WITH_BF_COLLADA', 'Build COLLADA import/export module if true', False)), - (BoolVariable('WITH_BF_STATICOPENCOLLADA', 'Staticly link to OpenCollada', False)), - ('BF_COLLADA', 'COLLADA base path', ''), - ('BF_COLLADA_INC', 'COLLADA include path', ''), - ('BF_COLLADA_LIB', 'COLLADA library', ''), - ('BF_OPENCOLLADA', 'OpenCollada base path', ''), - ('BF_OPENCOLLADA_INC', 'OpenCollada base include path', ''), - ('BF_OPENCOLLADA_LIB', 'OpenCollada library', ''), - ('BF_OPENCOLLADA_LIBPATH', 'OpenCollada library path', ''), - ('BF_PCRE', 'PCRE base path', ''), - ('BF_PCRE_LIB', 'PCRE library', ''), - ('BF_PCRE_LIBPATH', 'PCRE library path', ''), - ('BF_EXPAT', 'Expat base path', ''), - ('BF_EXPAT_LIB', 'Expat library', ''), - ('BF_EXPAT_LIBPATH', 'Expat library path', ''), - ('BF_OPENCOLLADA_LIB_STATIC', 'OpenCollada static library', ''), - - (BoolVariable('WITH_BF_JEMALLOC', 'Use jemalloc if true', False)), - (BoolVariable('WITH_BF_STATICJEMALLOC', 'Staticly link to jemalloc', False)), - ('BF_JEMALLOC', 'jemalloc base path', ''), - ('BF_JEMALLOC_INC', 'jemalloc include path', ''), - ('BF_JEMALLOC_LIB', 'jemalloc library', ''), - ('BF_JEMALLOC_LIBPATH', 'jemalloc library path', ''), - ('BF_JEMALLOC_LIB_STATIC', 'jemalloc static library', ''), - - (BoolVariable('WITH_BF_PLAYER', 'Build blenderplayer if true', False)), - (BoolVariable('WITH_BF_NOBLENDER', 'Do not build blender if true', False)), - - (BoolVariable('WITH_BF_IME', 'Enable Input Method Editor (IME) for complex Asian character input', False)), - - (BoolVariable('WITH_BF_3DMOUSE', 'Build blender with support of 3D mouses', False)), - (BoolVariable('WITH_BF_STATIC3DMOUSE', 'Staticly link to 3d mouse library', False)), - ('BF_3DMOUSE', '3d mouse library base path', ''), - ('BF_3DMOUSE_INC', '3d mouse library include path', ''), - ('BF_3DMOUSE_LIB', '3d mouse library', ''), - ('BF_3DMOUSE_LIBPATH', '3d mouse library path', ''), - ('BF_3DMOUSE_LIB_STATIC', '3d mouse static library', ''), - - ('CFLAGS', 'C only flags', []), - ('CCFLAGS', 'Generic C and C++ flags', []), - ('CXXFLAGS', 'C++ only flags', []), - ('BGE_CXXFLAGS', 'C++ only flags for BGE', []), - ('CPPFLAGS', 'Defines', []), - ('REL_CFLAGS', 'C only release flags', []), - ('REL_CCFLAGS', 'Generic C and C++ release flags', []), - ('REL_CXXFLAGS', 'C++ only release flags', []), - - ('C_WARN', 'C warning flags', []), - ('CC_WARN', 'Generic C and C++ warning flags', []), - ('CXX_WARN', 'C++ only warning flags', []), - - ('LLIBS', 'Platform libs', []), - ('PLATFORM_LINKFLAGS', 'Platform linkflags', []), - ('MACOSX_ARCHITECTURE', 'python_arch.zip select', ''), - ('MACOSX_SDK', 'Set OS X SDK', ''), - ('XCODE_CUR_VER', 'Detect XCode version', ''), - ('MACOSX_DEPLOYMENT_TARGET', 'Detect OS X target version', ''), - ('C_COMPILER_ID', 'Detect the resolved compiler', ''), - - (BoolVariable('BF_PROFILE', 'Add profiling information if true', False)), - ('BF_PROFILE_CFLAGS', 'C only profiling flags', []), - ('BF_PROFILE_CCFLAGS', 'C and C++ profiling flags', []), - ('BF_PROFILE_CXXFLAGS', 'C++ only profiling flags', []), - ('BF_PROFILE_LINKFLAGS', 'Profile linkflags', []), - - (BoolVariable('BF_DEBUG', 'Add debug flags if true', False)), - ('BF_DEBUG_CFLAGS', 'C only debug flags', []), - ('BF_DEBUG_CCFLAGS', 'C and C++ debug flags', []), - ('BF_DEBUG_CXXFLAGS', 'C++ only debug flags', []), - - (BoolVariable('BF_BSC', 'Create .bsc files (msvc only)', False)), - - ('BF_BUILDDIR', 'Build dir', ''), - ('BF_INSTALLDIR', 'Installation dir', ''), - - ('CC', 'C compiler to use', env['CC']), - ('CXX', 'C++ compiler to use', env['CXX']), - - (BoolVariable('BF_BUILDINFO', 'Buildtime in splash if true', True)), - - (BoolVariable('BF_TWEAK_MODE', 'Enable tweak mode if true', False)), - (BoolVariable('BF_SPLIT_SRC', 'Split src lib into several chunks if true', False)), - (BoolVariable('WITHOUT_BF_INSTALL', 'dont install if true', False)), - (BoolVariable('WITHOUT_BF_PYTHON_INSTALL', 'dont install Python modules if true', False)), - (BoolVariable('WITH_BF_PYTHON_INSTALL_NUMPY', 'install Python numpy module', False)), - (BoolVariable('WITH_BF_PYTHON_INSTALL_REQUESTS', 'install Python requests module', False)), - (BoolVariable('WITHOUT_BF_PYTHON_UNPACK', 'dont remove and unpack Python modules everytime if true', False)), - (BoolVariable('WITHOUT_BF_OVERWRITE_INSTALL', 'dont remove existing files before breating the new install directory (set to False when making packages for others)', False)), - (BoolVariable('BF_FANCY', 'Enable fancy output if true', True)), - (BoolVariable('BF_QUIET', 'Enable silent output if true', True)), - (BoolVariable('BF_LINE_OVERWRITE', 'Enable overwriting of compile line in BF_QUIET mode if true', False)), - (BoolVariable('WITH_BF_BINRELOC', 'Enable relocatable binary (linux only)', False)), - - (BoolVariable('WITH_BF_LZO', 'Enable fast LZO pointcache compression', True)), - (BoolVariable('WITH_BF_LZMA', 'Enable best LZMA pointcache compression', True)), - - (BoolVariable('WITH_BF_LIBMV', 'Enable libmv structure from motion library', True)), - (BoolVariable('WITH_BF_LIBMV_SCHUR_SPECIALIZATIONS', 'Enable fixed-size schur specializations', True)), - - (BoolVariable('WITH_BF_COMPOSITOR', 'Enable the tile based nodal compositor', True)), - ) # end of opts.AddOptions() - - localopts.AddVariables( - ('BF_X264_CONFIG', 'configuration flags for x264', ''), - ('BF_XVIDCORE_CONFIG', 'configuration flags for xvidcore', ''), -# (BoolVariable('WITH_BF_DOCS', 'Generate API documentation', False)), - - ('BF_CONFIG', 'SCons python config file used to set default options', 'user_config.py'), - ('BF_NUMJOBS', 'Number of build processes to spawn', '1'), - ('BF_MSVS', 'Generate MSVS project files and solution', False), - - (BoolVariable('BF_UNIT_TEST', 'Build with unit test support.', False)), - - (BoolVariable('BF_GHOST_DEBUG', 'Make GHOST print events and info to stdout. (very verbose)', False)), - - (BoolVariable('WITH_BF_RAYOPTIMIZATION', 'Enable raytracer SSE/SIMD optimization.', False)), - ('BF_RAYOPTIMIZATION_SSE_FLAGS', 'SSE flags', ''), - (BoolVariable('WITH_BF_CXX_GUARDEDALLOC', 'Enable GuardedAlloc for C++ memory allocation tracking.', False)), - - ('BUILDBOT_BRANCH', 'Buildbot branch name', ''), - - (BoolVariable('WITH_BF_CYCLES', 'Build with the Cycles engine', True)), - (BoolVariable('WITH_BF_CYCLES_CUDA_BINARIES', 'Build with precompiled CUDA binaries', False)), - (BoolVariable('WITH_BF_CYCLES_CUDA_THREADED_COMPILE', 'Build several render kernels at once (using BF_NUMJOBS)', False)), - ('BF_CYCLES_CUDA_NVCC', 'CUDA nvcc compiler path', ''), - ('BF_CYCLES_CUDA_ENV', 'preset environement nvcc will execute in', ''), - ('BF_CYCLES_CUDA_BINARIES_ARCH', 'CUDA architectures to compile binaries for', []), - (BoolVariable('WITH_BF_CYCLES_DEBUG', 'Build Cycles engine with extra debugging capabilities', False)), - (BoolVariable('WITH_BF_CYCLES_LOGGING', 'Build Cycles engine with logging support', True)), - - (BoolVariable('WITH_BF_OIIO', 'Build with OpenImageIO', False)), - (BoolVariable('WITH_BF_STATICOIIO', 'Statically link to OpenImageIO', False)), - ('BF_OIIO', 'OIIO root path', ''), - ('BF_OIIO_INC', 'OIIO include path', ''), - ('BF_OIIO_LIB', 'OIIO library', ''), - ('BF_OIIO_LIBPATH', 'OIIO library path', ''), - ('BF_OIIO_LIB_STATIC', 'OIIO static library', ''), - - (BoolVariable('WITH_BF_OCIO', 'Build with OpenColorIO', False)), - (BoolVariable('WITH_BF_STATICOCIO', 'Staticly link to OpenColorIO', False)), - ('BF_OCIO', 'OCIO root path', ''), - ('BF_OCIO_INC', 'OCIO include path', ''), - ('BF_OCIO_LIB', 'OCIO library', ''), - ('BF_OCIO_LIBPATH', 'OCIO library path', ''), - ('BF_OCIO_LIB_STATIC', 'OCIO static library', ''), - - (BoolVariable('WITH_BF_BOOST', 'Build with Boost', False)), - (BoolVariable('WITH_BF_STATICBOOST', 'Staticly link to boost', False)), - ('BF_BOOST', 'Boost root path', ''), - ('BF_BOOST_INC', 'Boost include path', ''), - ('BF_BOOST_LIB', 'Boost library', ''), - ('BF_BOOST_LIB_INTERNATIONAL', 'Boost library', ''), - ('BF_BOOST_LIBPATH', 'Boost library path', ''), - ('BF_BOOST_LIB_STATIC', 'Boost static library', ''), - - (BoolVariable('WITH_GHOST_XDND', 'Build with drag-n-drop support on Linux platforms using XDND protocol', True)), - - (BoolVariable('WITH_BF_CYCLES_OSL', 'Build with OSL sypport in Cycles', False)), - (BoolVariable('WITH_BF_STATICOSL', 'Staticly link to OSL', False)), - ('BF_OSL', 'OSL root path', ''), - ('BF_OSL_INC', 'OSL include path', ''), - ('BF_OSL_LIB', 'OSL library', ''), - ('BF_OSL_LIBPATH', 'OSL library path', ''), - ('BF_OSL_LIB_STATIC', 'OSL static library', ''), - ('BF_OSL_COMPILER', 'OSL compiler', ''), - - (BoolVariable('WITH_BF_LLVM', 'Build with LLVM sypport (required for OSL)', False)), - (BoolVariable('WITH_BF_STATICLLVM', 'Staticly link to LLVM', False)), - ('BF_LLVM', 'LLVM root path', ''), - ('BF_LLVM_LIB', 'LLVM library', ''), - ('BF_LLVM_LIBPATH', 'LLVM library path', ''), - ('BF_LLVM_LIB_STATIC', 'LLVM static library', ''), - - ('BF_PROGRAM_LINKFLAGS', 'Link flags applied only to final binaries (blender and blenderplayer, not makesrna/makesdna)', ''), - - (BoolVariable('WITH_BF_OPENSUBDIV', 'Build with OpenSubdiv library', False)), - (BoolVariable('WITH_BF_STATICOPENSUBDIV', 'Staticly link to OpenColorIO', False)), - ('BF_OPENSUBDIV', 'OpenSubdiv root path', ''), - ('BF_OPENSUBDIV_INC', 'OpenSubdiv include path', ''), - ('BF_OPENSUBDIV_LIB', 'OpenSubdiv library', ''), - ('BF_OPENSUBDIV_LIBPATH', 'OpenSubdiv library path', ''), - ('BF_OPENSUBDIV_LIB_STATIC', 'OpenSubdiv static library', ''), - - (BoolVariable('WITH_BF_CPP11', '"Build with C++11 standard enabled, for development use only!', False)), - - (BoolVariable('WITH_BF_LEGACY_DEPSGRAPH', 'Build Blender with legacy dependency graph', True)), - ) # end of opts.AddOptions() - - return localopts - -def buildbot_zip(src, dest, package_name, extension): - import zipfile - ln = len(src)+1 # one extra to remove leading os.sep when cleaning root for package_root - flist = list() - - # create list of tuples containing file and archive name - for root, dirs, files in os.walk(src): - package_root = os.path.join(package_name, root[ln:]) - flist.extend([(os.path.join(root, file), os.path.join(package_root, file)) for file in files]) - - if extension == '.zip': - package = zipfile.ZipFile(dest, 'w', zipfile.ZIP_DEFLATED) - package.comment = package_name + ' is a zip-file containing the Blender software. Visit http://www.blender.org for more information.' - for entry in flist: - package.write(entry[0], entry[1]) - package.close() - else: - import tarfile - package = tarfile.open(dest, 'w:bz2') - for entry in flist: - package.add(entry[0], entry[1], recursive=False) - package.close() - bb_zip_name = os.path.normpath(src + os.sep + '..' + os.sep + 'buildbot_upload.zip') - print("creating %s" % (bb_zip_name)) - bb_zip = zipfile.ZipFile(bb_zip_name, 'w', zipfile.ZIP_DEFLATED) - print("writing %s to %s" % (dest, bb_zip_name)) - bb_zip.write(dest, os.path.split(dest)[1]) - bb_zip.close() - print("removing unneeded packed file %s (to keep install directory clean)" % (dest)) - os.remove(dest) - print("done.") - -def buildslave_print(target, source, env): - return "Running buildslave target" - -def buildslave(target=None, source=None, env=None): - """ - Builder for buildbot integration. Used by buildslaves of http://builder.blender.org only. - """ - - if env['OURPLATFORM'] in ('win32-vc', 'win64-vc', 'win32-mingw', 'darwin', 'win64-mingw'): - extension = '.zip' - else: - extension = '.tar.bz2' - - if env['OURPLATFORM'] == 'win32-mingw': - platform = 'mingw32' - elif env['OURPLATFORM'] == 'win64-mingw': - platform = 'mingw64' - else: - platform = env['OURPLATFORM'].split('-')[0] - - if platform == 'linux': - import platform - - if "glibc27" in env['BF_INSTALLDIR']: - glibc = "glibc27" - elif "glibc211" in env['BF_INSTALLDIR']: - glibc = "glibc211" - - bitness = platform.architecture()[0] - if bitness == '64bit': - platform = 'linux-' + glibc + '-x86_64' - elif bitness == '32bit': - platform = 'linux-' + glibc + '-i686' - if platform == 'darwin': - platform = 'OSX-' + env['MACOSX_DEPLOYMENT_TARGET'] + '-' + env['MACOSX_ARCHITECTURE'] - - - branch = env['BUILDBOT_BRANCH'] - - outdir = os.path.abspath(env['BF_INSTALLDIR']) - package_name = 'blender-' + VERSION+'-'+HASH + '-' + platform - if branch != '': - package_name = branch + '-' + package_name - package_dir = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name) - package_archive = os.path.normpath(outdir + os.sep + '..' + os.sep + package_name + extension) - - try: - if os.path.exists(package_archive): - os.remove(package_archive) - if os.path.exists(package_dir): - shutil.rmtree(package_dir) - except Exception, ex: - sys.stderr.write('Failed to clean up old package files: ' + str(ex) + '\n') - return 1 - - buildbot_zip(outdir, package_archive, package_name, extension) - - return 0 - -def NSIS_print(target, source, env): - return "Creating NSIS installer for Blender" - -def NSIS_Installer(target=None, source=None, env=None): - print "="*35 - - if env['OURPLATFORM'] not in ('win32-vc', 'win32-mingw', 'win64-vc', 'win64-mingw'): - print "NSIS installer is only available on Windows." - exit() - if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): - bitness = '32' - elif env['OURPLATFORM'] in ('win64-vc', 'win64-mingw'): - bitness = '64' - - start_dir = os.getcwd() - rel_dir = os.path.join(start_dir,'release','windows','installer') - install_base_dir = start_dir + os.sep - - bf_installdir = os.path.join(os.getcwd(),env['BF_INSTALLDIR']) - bf_installdir = os.path.normpath(bf_installdir) - - doneroot = False - rootdirconts = [] - datafiles = '' - deldatafiles = '' - deldatadirs = '' - l = len(bf_installdir) - - for dp,dn,df in os.walk(bf_installdir): - # install - if not doneroot: - for f in df: - rootdirconts.append(os.path.join(dp,f)) - doneroot = True - else: - if len(df)>0: - datafiles += "\n" +r'SetOutPath $INSTDIR'+dp[l:]+"\n\n" - - for f in df: - outfile = os.path.join(dp,f) - datafiles += ' File '+outfile + "\n" - - # uninstall - deldir = dp[l+1:] - - if len(deldir)>0: - deldatadirs = "RMDir $INSTDIR\\" + deldir + "\n" + deldatadirs - deldatadirs = "RMDir /r $INSTDIR\\" + deldir + "\\__pycache__\n" + deldatadirs - - for f in df: - deldatafiles += 'Delete \"$INSTDIR\\' + os.path.join(deldir, f) + "\"\n" - - #### change to suit install dir #### - inst_dir = install_base_dir + env['BF_INSTALLDIR'] - - os.chdir(rel_dir) - - ns = open("00.sconsblender.nsi","r") - - ns_cnt = str(ns.read()) - ns.close() - - # var replacements - ns_cnt = string.replace(ns_cnt, "[DISTDIR]", os.path.normpath(inst_dir+os.sep)) - ns_cnt = string.replace(ns_cnt, "[VERSION]", VERSION_DISPLAY) - ns_cnt = string.replace(ns_cnt, "[SHORTVERSION]", VERSION) - ns_cnt = string.replace(ns_cnt, "[RELDIR]", os.path.normpath(rel_dir)) - ns_cnt = string.replace(ns_cnt, "[BITNESS]", bitness) - - # do root - rootlist = [] - for rootitem in rootdirconts: - rootlist.append("File \"" + rootitem + "\"") - rootstring = string.join(rootlist, "\n ") - rootstring = rootstring - rootstring += "\n\n" - ns_cnt = string.replace(ns_cnt, "[ROOTDIRCONTS]", rootstring) - - - # do delete items - delrootlist = [] - for rootitem in rootdirconts: - delrootlist.append("Delete $INSTDIR\\" + rootitem[l+1:]) - delrootstring = string.join(delrootlist, "\n ") - delrootstring += "\n" - ns_cnt = string.replace(ns_cnt, "[DELROOTDIRCONTS]", delrootstring) - - ns_cnt = string.replace(ns_cnt, "[DODATAFILES]", datafiles) - ns_cnt = string.replace(ns_cnt, "[DELDATAFILES]", deldatafiles) - ns_cnt = string.replace(ns_cnt, "[DELDATADIRS]", deldatadirs) - - tmpnsi = os.path.normpath(install_base_dir+os.sep+env['BF_BUILDDIR']+os.sep+"00.blender_tmp.nsi") - new_nsis = open(tmpnsi, 'w') - new_nsis.write(ns_cnt) - new_nsis.close() - print "NSIS Installer script created" - - os.chdir(start_dir) - print "Launching 'makensis'" - - cmdline = "makensis " + "\""+tmpnsi+"\"" - - startupinfo = subprocess.STARTUPINFO() - #startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW - proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE, - stderr=subprocess.PIPE, startupinfo=startupinfo, shell = True) - data, err = proc.communicate() - rv = proc.wait() - - if rv != 0: - print - print data.strip().split("\n")[-1] - return rv - -def cudakernels_print(target, source, env): - return "Running cudakernels target" - -def cudakernels(target=None, source=None, env=None): - """ - Builder for cuda kernels compilation. Used by release build environment only - """ - - # Currently nothing to do, everything is handled by a dependency resolver - - pass - -def check_environ(): - problematic_envvars = "" - for i in os.environ: - try: - os.environ[i].decode('ascii') - except UnicodeDecodeError: - problematic_envvars = problematic_envvars + "%s = %s\n" % (i, os.environ[i]) - if len(problematic_envvars)>0: - print("================\n\n") - print("@@ ABORTING BUILD @@\n") - print("PROBLEM DETECTED WITH ENVIRONMENT") - print("---------------------------------\n\n") - print("A problem with one or more environment variable was found") - print("Their value contain non-ascii characters. Check the below") - print("list and override them locally to be ASCII-clean by doing") - print("'set VARNAME=cleanvalue' on the command-line prior to") - print("starting the build process:\n") - print(problematic_envvars) - return False - else: - return True diff --git a/build_files/scons/tools/crossmingw.py b/build_files/scons/tools/crossmingw.py deleted file mode 100644 index f97fdf3c15e..00000000000 --- a/build_files/scons/tools/crossmingw.py +++ /dev/null @@ -1,184 +0,0 @@ -"""SCons.Tool.gcc - -Tool-specific initialization for MinGW (http://www.mingw.org/) - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 The SCons Foundation -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - -__revision__ = "src/engine/SCons/Tool/mingw.py 4043 2009/02/23 09:06:45 scons" - -import os -import os.path -import string - -import SCons.Action -import SCons.Builder -import SCons.Defaults -import SCons.Tool -import SCons.Util - -# This is what we search for to find mingw: -prefixes = SCons.Util.Split(""" - mingw32- - i386-mingw32msvc- - i486-mingw32msvc- - i586-mingw32msvc- - i686-mingw32msvc- - i686-pc-mingw32- -""") - -def find(env): - for prefix in prefixes: - # First search in the SCons path and then the OS path: - if env.WhereIs(prefix + 'gcc') or SCons.Util.WhereIs(prefix + 'gcc'): - return prefix - - return '' - -def shlib_generator(target, source, env, for_signature): - cmd = SCons.Util.CLVar(['$SHLINK']) - - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: cmd.extend(['-o', dll]) - - cmd.extend(['$SOURCES', '$SHLINKFLAGS', '$_LIBDIRFLAGS', '$_LIBFLAGS']) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: cmd.append('-Wl,--out-implib,'+implib.get_string(for_signature)) - - def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - insert_def = env.subst("$WINDOWS_INSERT_DEF") - if not insert_def in ['', '0', 0] and def_target: \ - cmd.append('-Wl,--output-def,'+def_target.get_string(for_signature)) - - return [cmd] - -def shlib_emitter(target, source, env): - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") - - if not no_import_lib and \ - not env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX'): - - # Append an import library to the list of targets. - target.append(env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'LIBPREFIX', 'LIBSUFFIX')) - - # Append a def file target if there isn't already a def file target - # or a def file source. There is no option to disable def file - # target emitting, because I can't figure out why someone would ever - # want to turn it off. - def_source = env.FindIxes(source, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - def_target = env.FindIxes(target, 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX') - if not def_source and not def_target: - target.append(env.ReplaceIxes(dll, - 'SHLIBPREFIX', 'SHLIBSUFFIX', - 'WINDOWSDEFPREFIX', 'WINDOWSDEFSUFFIX')) - - return (target, source) - - -shlib_action = SCons.Action.Action(shlib_generator, generator=1) - -res_action = SCons.Action.Action('$RCCOM', '$RCCOMSTR') - -res_builder = SCons.Builder.Builder(action=res_action, suffix='.o', - source_scanner=SCons.Tool.SourceFileScanner) -SCons.Tool.SourceFileScanner.add_scanner('.rc', SCons.Defaults.CScan) - -def generate(env): - mingw = find(env) - if mingw: - dir = os.path.dirname(mingw) - env.PrependENVPath('PATH', dir ) - - - # Most of mingw is the same as gcc and friends... - gnu_tools = ['gcc', 'g++', 'gnulink', 'ar', 'gas', 'm4'] - for tool in gnu_tools: - SCons.Tool.Tool(tool)(env) - - #... but a few things differ: - env['CC'] = mingw + 'gcc' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['CXX'] = mingw + 'g++' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS -shared') - env['SHLINKCOM'] = shlib_action - env['LDMODULECOM'] = shlib_action - env.Append(SHLIBEMITTER = [shlib_emitter]) - env['RANLIB'] = mingw + 'ranlib' - env['LINK'] = mingw + 'gcc' - env['AS'] = mingw + 'as' - env['AR'] = mingw + 'ar' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WINDOWSDEFPREFIX'] = '${WIN32DEFPREFIX}' - env['WINDOWSDEFSUFFIX'] = '${WIN32DEFSUFFIX}' - - env['SHOBJSUFFIX'] = '.o' - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = mingw + 'windres' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCINCFLAGS'] = '$( ${_concat(RCINCPREFIX, CPPPATH, RCINCSUFFIX, __env__, RDirs, TARGET, SOURCE)} $)' - env['RCINCPREFIX'] = '--include-dir ' - env['RCINCSUFFIX'] = '' - env['RCCOM'] = '$RC $_CPPDEFFLAGS $RCINCFLAGS ${RCINCPREFIX} ${SOURCE.dir} $RCFLAGS -i $SOURCE -o $TARGET' - env['BUILDERS']['RES'] = res_builder - - # Some setting from the platform also have to be overridden: - env['OBJPREFIX'] = '' - env['OBJSUFFIX'] = '.o' - env['LIBPREFIX'] = 'lib' - env['LIBSUFFIX'] = '.a' - env['SHOBJPREFIX'] = '$OBJPREFIX' - env['SHOBJSUFFIX'] = '$OBJSUFFIX' - env['PROGPREFIX'] = '' - env['PROGSUFFIX'] = '.exe' - env['LIBPREFIX'] = '' - env['LIBSUFFIX'] = '.lib' - env['SHLIBPREFIX'] = '' - env['SHLIBSUFFIX'] = '.dll' - env['LIBPREFIXES'] = [ '$LIBPREFIX' ] - env['LIBSUFFIXES'] = [ '$LIBSUFFIX' ] - -def exists(env): - return find(env) - -# Local Variables: -# tab-width:4 -# indent-tabs-mode:nil -# End: -# vim: set expandtab tabstop=4 shiftwidth=4: diff --git a/build_files/scons/tools/mstoolkit.py b/build_files/scons/tools/mstoolkit.py deleted file mode 100644 index 68e8c4b6475..00000000000 --- a/build_files/scons/tools/mstoolkit.py +++ /dev/null @@ -1,353 +0,0 @@ -"""tools.mstoolkit - -Tool-specific initialization for Microsoft Visual C/C++ Toolkit Commandline - -There normally shouldn't be any need to import this module directly. -It will usually be imported through the generic SCons.Tool.Tool() -selection method. - -""" - -# -# Copyright (c) 2004 John Connors -# -# Permission is hereby granted, free of charge, to any person obtaining -# a copy of this software and associated documentation files (the -# "Software"), to deal in the Software without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Software, and to -# permit persons to whom the Software is furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY -# KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE -# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -# - - -import os.path -import re -import string -import types - -import SCons.Action -import SCons.Builder -import SCons.Errors -import SCons.Platform.win32 -import SCons.Tool -import SCons.Util -import SCons.Warnings - -CSuffixes = ['.c', '.C'] -CXXSuffixes = ['.cc', '.cpp', '.cxx', '.c++', '.C++'] - -def get_msvctoolkit_paths(): - """Return a 4-tuple of (INCLUDE, LIB, PATH, TOOLKIT) as the values of those - three environment variables that should be set in order to execute - the MSVC .NET tools properly, if the information wasn't available - from the registry.""" - - MSToolkitDir = None - paths = {} - exe_path = '' - lib_path = '' - include_path = '' - - # First, we get the shell folder for this user: - if not SCons.Util.can_read_reg: - raise SCons.Errors.InternalError, "No Windows registry module was found" - - # look for toolkit - if os.environ.has_key('VCToolkitInstallDir'): - MSToolkitDir = os.path.normpath(os.environ['VCToolkitInstallDir']) - else: - # last resort -- default install location - MSToolkitDir = r'C:\Program Files\Microsoft Visual C++ Toolkit 2003' - - # look for platform sdk - if os.environ.has_key('MSSdk'): - PlatformSDKDir = os.path.normpath(os.environ['MSSdk']) - else: - try: - PlatformSDKDir = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\MicrosoftSDK\Directories\Install Dir')[0] - PlatformSDKDir = str(PlatformSDKDir) - except SCons.Util.RegError: - raise SCons.Errors.InternalError, "The Platform SDK directory was not found in the registry or in the `MSSdk` environment variable." - - # look for DX Sdk (expecting DX9) - # dxsdk docs have a directory key, look for it, extract path - #dxsdkdocs = "" - DXsdkDir = "" - #try: - # dxsdkdocs = SCons.Util.RegGetValue(SCons.Util.HKEY_LOCAL_MACHINE, r'SOFTWARE\Microsoft\DirectX SDK\DX9SDK Doc Path') - #except SCons.Util.RegError: - # raise SCons.Errors.InternalError, "The DXSDK directory was not found in the registry." - if os.environ.has_key('DXSDK_DIR'): - DXsdkDir = os.path.normpath(os.environ['DXSDK_DIR']) - - #DXsdkDir = os.path.split(dxsdkdocs[0])[0] - DXsdkDir = os.path.split(DXsdkDir)[0] - - include_path = r'%s\include;%s\include;%s\include' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) - lib_path = r'%s\lib;%s\lib;%s\lib' % (MSToolkitDir, PlatformSDKDir, DXsdkDir) - exe_path = r'%s\bin;%s\bin\win95;%s\bin' % (MSToolkitDir, PlatformSDKDir, PlatformSDKDir) - return (include_path, lib_path, exe_path, PlatformSDKDir) - -def validate_vars(env): - """Validate the PDB, PCH, and PCHSTOP construction variables.""" - if env.has_key('PCH') and env['PCH']: - if not env.has_key('PCHSTOP'): - raise SCons.Errors.UserError, "The PCHSTOP construction must be defined if PCH is defined." - if not SCons.Util.is_String(env['PCHSTOP']): - raise SCons.Errors.UserError, "The PCHSTOP construction variable must be a string: %r"%env['PCHSTOP'] - -def pch_emitter(target, source, env): - """Sets up the PDB dependencies for a pch file, and adds the object - file target.""" - - validate_vars(env) - - pch = None - obj = None - - for t in target: - if SCons.Util.splitext(str(t))[1] == '.pch': - pch = t - if SCons.Util.splitext(str(t))[1] == '.obj': - obj = t - - if not obj: - obj = SCons.Util.splitext(str(pch))[0]+'.obj' - - target = [pch, obj] # pch must be first, and obj second for the PCHCOM to work - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - return (target, source) - -def object_emitter(target, source, env, parent_emitter): - """Sets up the PDB and PCH dependencies for an object file.""" - - validate_vars(env) - - parent_emitter(target, source, env) - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - if env.has_key('PCH') and env['PCH']: - env.Depends(target, env['PCH']) - - return (target, source) - -def static_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.StaticObjectEmitter) - -def shared_object_emitter(target, source, env): - return object_emitter(target, source, env, - SCons.Defaults.SharedObjectEmitter) - -pch_builder = SCons.Builder.Builder(action='$PCHCOM', suffix='.pch', emitter=pch_emitter) -res_builder = SCons.Builder.Builder(action='$RCCOM', suffix='.res') - -def pdbGenerator(env, target, source, for_signature): - if target and env.has_key('PDB') and env['PDB']: - return ['/PDB:%s'%target[0].File(env['PDB']).get_string(for_signature), - '/DEBUG'] - -def win32ShlinkTargets(target, source, env, for_signature): - listCmd = [] - dll = env.FindIxes(target, 'SHLIBPREFIX', 'SHLIBSUFFIX') - if dll: listCmd.append("/out:%s"%dll.get_string(for_signature)) - - implib = env.FindIxes(target, 'LIBPREFIX', 'LIBSUFFIX') - if implib: listCmd.append("/implib:%s"%implib.get_string(for_signature)) - - return listCmd - -def win32ShlinkSources(target, source, env, for_signature): - listCmd = [] - - deffile = env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX") - for src in source: - if src == deffile: - # Treat this source as a .def file. - listCmd.append("/def:%s" % src.get_string(for_signature)) - else: - # Just treat it as a generic source file. - listCmd.append(src) - return listCmd - -def win32LibEmitter(target, source, env): - # SCons.Tool.msvc.validate_vars(env) - - dll = env.FindIxes(target, "SHLIBPREFIX", "SHLIBSUFFIX") - no_import_lib = env.get('no_import_lib', 0) - - if not dll: - raise SCons.Errors.UserError, "A shared library should have exactly one target with the suffix: %s" % env.subst("$SHLIBSUFFIX") - - if env.get("WIN32_INSERT_DEF", 0) and \ - not env.FindIxes(source, "WIN32DEFPREFIX", "WIN32DEFSUFFIX"): - - # append a def file to the list of sources - source.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "WIN32DEFPREFIX", "WIN32DEFSUFFIX")) - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - if not no_import_lib and \ - not env.FindIxes(target, "LIBPREFIX", "LIBSUFFIX"): - # Append an import library to the list of targets. - target.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "LIBPREFIX", "LIBSUFFIX")) - # and .exp file is created if there are exports from a DLL - target.append(env.ReplaceIxes(dll, - "SHLIBPREFIX", "SHLIBSUFFIX", - "WIN32EXPPREFIX", "WIN32EXPSUFFIX")) - - return (target, source) - -def prog_emitter(target, source, env): - #SCons.Tool.msvc.validate_vars(env) - - if env.has_key('PDB') and env['PDB']: - env.SideEffect(env['PDB'], target) - env.Precious(env['PDB']) - - return (target,source) - -def RegServerFunc(target, source, env): - if env.has_key('register') and env['register']: - ret = regServerAction([target[0]], [source[0]], env) - if ret: - raise SCons.Errors.UserError, "Unable to register %s" % target[0] - else: - print "Registered %s sucessfully" % target[0] - return ret - return 0 - -regServerAction = SCons.Action.Action("$REGSVRCOM") -regServerCheck = SCons.Action.Action(RegServerFunc, None) -shlibLinkAction = SCons.Action.Action('${TEMPFILE("$SHLINK $SHLINKFLAGS $_SHLINK_TARGETS $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $_SHLINK_SOURCES")}') -compositeLinkAction = shlibLinkAction + regServerCheck - -def generate(env): - """Add Builders and construction variables for MSVC++ to an Environment.""" - static_obj, shared_obj = SCons.Tool.createObjBuilders(env) - - for suffix in CSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCAction) - - for suffix in CXXSuffixes: - static_obj.add_action(suffix, SCons.Defaults.CXXAction) - shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction) - - SCons.Tool.createStaticLibBuilder(env) - SCons.Tool.createSharedLibBuilder(env) - SCons.Tool.createProgBuilder(env) - - env['CCPDBFLAGS'] = SCons.Util.CLVar(['${(PDB and "/Zi /Fd%s"%File(PDB)) or ""}']) - env['CCPCHFLAGS'] = SCons.Util.CLVar(['${(PCH and "/Yu%s /Fp%s"%(PCHSTOP or "",File(PCH))) or ""}']) - env['CCCOMFLAGS'] = '$CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo$TARGET $CCPCHFLAGS $CCPDBFLAGS' - env['CC'] = 'cl' - env['CCFLAGS'] = SCons.Util.CLVar('/nologo') - env['CCCOM'] = '$CC $CCFLAGS $CCCOMFLAGS' - env['SHCC'] = '$CC' - env['SHCCFLAGS'] = SCons.Util.CLVar('$CCFLAGS') - env['SHCCCOM'] = '$SHCC $SHCCFLAGS $CCCOMFLAGS' - env['CXX'] = '$CC' - env['CXXFLAGS'] = SCons.Util.CLVar('$CCFLAGS $( /TP $)') - env['CXXCOM'] = '$CXX $CXXFLAGS $CCCOMFLAGS' - env['SHCXX'] = '$CXX' - env['SHCXXFLAGS'] = SCons.Util.CLVar('$CXXFLAGS') - env['SHCXXCOM'] = '$SHCXX $SHCXXFLAGS $CCCOMFLAGS' - env['CPPDEFPREFIX'] = '/D' - env['CPPDEFSUFFIX'] = '' - env['INCPREFIX'] = '/I' - env['INCSUFFIX'] = '' - env['OBJEMITTER'] = static_object_emitter - env['SHOBJEMITTER'] = shared_object_emitter - env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME'] = 1 - - env['RC'] = 'rc' - env['RCFLAGS'] = SCons.Util.CLVar('') - env['RCCOM'] = '$RC $_CPPDEFFLAGS $_CPPINCFLAGS $RCFLAGS /fo$TARGET $SOURCES' - CScan = env.get_scanner('.c') - if CScan: - CScan.add_skey('.rc') - env['BUILDERS']['RES'] = res_builder - - include_path, lib_path, exe_path, sdk_path = get_msvctoolkit_paths() - env.PrependENVPath('INCLUDE', include_path) - env.PrependENVPath('LIB', lib_path) - env.PrependENVPath('PATH', exe_path) - - env['ENV']['CPU'] = 'i386' - env['ENV']['MSSDK'] = sdk_path - env['ENV']['BkOffice'] = sdk_path - env['ENV']['Basemake'] = sdk_path + "\\Include\\BKOffice.Mak" - env['ENV']['INETSDK'] = sdk_path - env['ENV']['MSSDK'] = sdk_path - env['ENV']['MSTOOLS'] = sdk_path - env['ENV']['TARGETOS'] = 'WINNT' - env['ENV']['APPVER'] = '5.0' - - env['CFILESUFFIX'] = '.c' - env['CXXFILESUFFIX'] = '.cc' - - env['PCHCOM'] = '$CXX $CXXFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS /c $SOURCES /Fo${TARGETS[1]} /Yc$PCHSTOP /Fp${TARGETS[0]} $CCPDBFLAGS' - env['BUILDERS']['PCH'] = pch_builder - - env['AR'] = 'lib.exe' #'"' +sdk_path + '\\bin\\Win64\\lib.exe"' - env['ARFLAGS'] = SCons.Util.CLVar('/nologo') - env['ARCOM'] = "${TEMPFILE('$AR $ARFLAGS /OUT:$TARGET $SOURCES')}" - - env['SHLINK'] = '$LINK' - env['SHLINKFLAGS'] = SCons.Util.CLVar('$LINKFLAGS /dll') - env['_SHLINK_TARGETS'] = win32ShlinkTargets - env['_SHLINK_SOURCES'] = win32ShlinkSources - env['SHLINKCOM'] = compositeLinkAction - env['SHLIBEMITTER']= win32LibEmitter - env['LINK'] = 'link.exe' #'"' +sdk_path + '\\bin\\Win64\\' + 'link.exe"' - env['LINKFLAGS'] = SCons.Util.CLVar('/nologo') - env['_PDB'] = pdbGenerator - env["TEMPFILE"] = SCons.Platform.win32.TempFileMunge - env['LINKCOM'] = '${TEMPFILE("$LINK $LINKFLAGS /OUT:$TARGET $( $_LIBDIRFLAGS $) $_LIBFLAGS $_PDB $SOURCES")}' - env['PROGEMITTER'] = prog_emitter - env['LIBDIRPREFIX']='/LIBPATH:' - env['LIBDIRSUFFIX']='' - env['LIBLINKPREFIX']='' - env['LIBLINKSUFFIX']='$LIBSUFFIX' - - env['WIN32DEFPREFIX'] = '' - env['WIN32DEFSUFFIX'] = '.def' - env['WIN32_INSERT_DEF'] = 0 - - env['WIN32EXPPREFIX'] = '' - env['WIN32EXPSUFFIX'] = '.exp' - - env['REGSVRACTION'] = regServerCheck - env['REGSVR'] = os.path.join(SCons.Platform.win32.get_system_root(),'System32','regsvr32') - env['REGSVRFLAGS'] = '/s ' - env['REGSVRCOM'] = '$REGSVR $REGSVRFLAGS $TARGET' - - -def exists(env): - return env.Detect('cl') |