* add preliminary support for building Blender on 64bit Windows with _msvc_. The SConstruct should automatically detect if you are on a 64bit Windows and if you have that 64bit build is assumed. If you're not, 32bit build is assumed.
NOTE: this is still very much wip, so your mileage may vary. Do please report on b25 taskforce ML in case of trouble.
NOTE2: many of the libs are being linked in statically
NOTE3: hopefully I didn't break anything for other build platforms (mingw, linux, osx).
NOTE4: comes after NOTE3
# Set up some custom actions and target/argument handling
# Then read all SConscripts and build
+import platform as pltfrm
+
+if pltfrm.architecture()[0] == '64bit':
+ bitness = 64
+else:
+ bitness = 32
+
import sys
import os
import os.path
env['CXX'] = cxx
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
- platform = 'win32-vc'
+ if bitness == 64:
+ platform = 'win64-vc'
+ else:
+ platform = 'win32-vc'
elif env['CC'] in ['gcc'] and sys.platform=='win32':
platform = 'win32-mingw'
env.SConscriptChdir(0)
crossbuild = B.arguments.get('BF_CROSS', None)
-if crossbuild and platform!='win32':
+if crossbuild and platform not in ('win32-vc', 'win64-vc'):
platform = 'linuxcross'
env['OURPLATFORM'] = platform
env['CCFLAGS'].append('-DDISABLE_ELBEEM')
if env['WITH_BF_OPENMP'] == 1:
- if env['OURPLATFORM']=='win32-vc':
+ if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env['CCFLAGS'].append('/openmp')
env['CPPFLAGS'].append('/openmp')
env['CXXFLAGS'].append('/openmp')
env['BF_NO_ELBEEM'] = True
env['WITH_BF_PYTHON'] = False
-if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming'):
+if env['WITH_BF_SDL'] == False and env['OURPLATFORM'] in ('win32-vc', 'win32-ming', 'win64-vc'):
env['PLATFORM_LINKFLAGS'].remove('/ENTRY:mainCRTStartup')
env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
thesyslibs = B.setup_syslibs(env)
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']:
- env.BlenderProg(B.root_build_dir, "blender", dobj + mainlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
+ env.BlenderProg(B.root_build_dir, "blender", dobj , [], mainlist + thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blender')
if env['WITH_BF_PLAYER']:
playerlist = B.create_blender_liblist(env, 'player')
env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
if '.svn' in tn:
tn.remove('.svn')
for f in tf:
- print ">>>", env['BF_INSTALLDIR'], tp, f
iconlist.append(tp+os.sep+f)
icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
if '.svn' in tn:
tn.remove('.svn')
for f in tf:
- print ">>>", env['BF_INSTALLDIR'], tp, f
pluglist.append(tp+os.sep+f)
plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
else:
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
- dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll',
- '${BF_PNG_LIBPATH}/libpng.dll',
- '${BF_ZLIB_LIBPATH}/zlib.dll',
- '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
+ if env['OURPLATFORM'] == 'win64-vc':
+ dllsources = []
+ else:
+ dllsources = ['${LCGDIR}/gettext/lib/gettext.dll',
+ '${BF_PNG_LIBPATH}/libpng.dll',
+ '${BF_ZLIB_LIBPATH}/zlib.dll',
+ '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
if env['WITH_BF_SDL']:
- dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
+ if env['OURPLATFORM'] == 'win64-vc':
+ pass # we link statically already to SDL on win64
+ else:
+ dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
if env['WITH_BF_PYTHON']:
dllsources.append('#release/windows/extra/python25.zip')
dllsources.append('#release/windows/extra/zlib.pyd')
else:
dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
if env['WITH_BF_ICONV']:
- dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
+ if env['OURPLATFORM'] == 'win64-vc':
+ pass # we link statically to iconv on win64
+ else:
+ dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
if env['WITH_BF_FFMPEG']:
dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
'${LCGDIR}/ffmpeg/lib/avformat-52.dll',
if not env['WITHOUT_BF_INSTALL']:
Default(installtarget)
-#------------ RELEASE
-# TODO: zipup the installation
-
-#------------ BLENDERPLAYER
-# TODO: build stubs and link into blenderplayer
-
#------------ EPYDOC
if env['WITH_BF_DOCS']:
SConscript('source/blender/python/api2_2x/doc/SConscript')
defs = 'USE_DOUBLES QHULL _LIB'
cflags = []
-if env['OURPLATFORM']=='win32-vc':
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
defs += ' WIN32 NDEBUG _WINDOWS _LIB'
#cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6']
defs = 'USE_DOUBLES QHULL _LIB'
cflags = []
-if env['OURPLATFORM']=='win32-vc':
+if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
defs += ' WIN32 NDEBUG _WINDOWS _LIB'
cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6']
elif env['OURPLATFORM']=='win32-mingw':
for f in pf:
sources.remove('intern' + os.sep + f + 'Win32.cpp')
sources.remove('intern' + os.sep + f + 'Carbon.cpp')
-elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross'):
+elif window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
for f in pf:
sources.remove('intern' + os.sep + f + 'X11.cpp')
sources.remove('intern' + os.sep + f + 'Carbon.cpp')
Exit()
incs = '. ../string ' + env['BF_OPENGL_INC']
-if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross'):
+if window_system in ('win32-vc', 'win32-mingw', 'cygwin', 'linuxcross', 'win64-vc'):
incs = env['BF_WINTAB_INC'] + ' ' + incs
env.BlenderLib ('bf_ghost', sources, Split(incs), defines=['_USE_MATH_DEFINES'], libtype=['intern'], priority = [40] )
if env['BF_NO_ELBEEM']:
defs += ' DISABLE_ELBEEM'
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [165] )
cflags='-pthread'
incs += ' ../../../extern/binreloc/include'
-if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'):
+if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
incs += ' ' + env['BF_PTHREADS_INC']
env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core'], priority = [180], compileflags =cflags )
"""
+import os
import os.path
import string
import glob
sortlist.sort()
for sk in sortlist:
v = curlib[sk]
- target = root_build_dir + 'lib/'+lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX']
- if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
- target = '#'+target
+ target = os.path.abspath(os.getcwd() + os.sep + root_build_dir + 'lib' + os.sep +lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX'])
lst.append(target)
return lst
if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']:
statlibs += Split(lenv['BF_PYTHON_LIB_STATIC'])
- if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross'):
+ if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'):
libincs += Split(lenv['BF_PTHREADS_LIBPATH'])
return statlibs, libincs
]
if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']:
- if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc'):
+ if lenv['BF_DEBUG'] and lenv['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
else:
syslibs.append(lenv['BF_PYTHON_LIB'])
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'):
+ if lenv['OURPLATFORM'] in ('win32-vc', 'win32-mingw','linuxcross', 'win64-vc'):
syslibs += Split(lenv['BF_PTHREADS_LIB'])
syslibs += lenv['LLIBS']
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'):
+ if self['OURPLATFORM'] not in ('win32-vc','win32-mingw','linuxcross', 'win64-vc'):
print bc.FAIL+'BlenderRes is for windows only!'+bc.END
self.Exit()
def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None, binarykind=''):
print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
lenv = self.Clone()
- if lenv['OURPLATFORM'] in ['win32-vc', 'cygwin']:
+ if lenv['OURPLATFORM'] in ('win32-vc', 'cygwin', 'win64-vc'):
lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
if lenv['BF_DEBUG']:
lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb'])
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']=='win32-vc' and lenv['BF_BSC']:
+ 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)