2.5 / Scons | Building on 64bit Windows

* 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
This commit is contained in:
Nathan Letwory
2009-02-20 22:08:02 +00:00
parent d56fd6d4ce
commit 64dd45ef43
7 changed files with 45 additions and 35 deletions

View File

@@ -29,6 +29,13 @@
# Set up some custom actions and target/argument handling # Set up some custom actions and target/argument handling
# Then read all SConscripts and build # Then read all SConscripts and build
import platform as pltfrm
if pltfrm.architecture()[0] == '64bit':
bitness = 64
else:
bitness = 32
import sys import sys
import os import os
import os.path import os.path
@@ -132,6 +139,9 @@ if cxx:
env['CXX'] = cxx env['CXX'] = cxx
if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32': if env['CC'] in ['cl', 'cl.exe'] and sys.platform=='win32':
if bitness == 64:
platform = 'win64-vc'
else:
platform = 'win32-vc' platform = 'win32-vc'
elif env['CC'] in ['gcc'] and sys.platform=='win32': elif env['CC'] in ['gcc'] and sys.platform=='win32':
platform = 'win32-mingw' platform = 'win32-mingw'
@@ -139,7 +149,7 @@ elif env['CC'] in ['gcc'] and sys.platform=='win32':
env.SConscriptChdir(0) env.SConscriptChdir(0)
crossbuild = B.arguments.get('BF_CROSS', None) crossbuild = B.arguments.get('BF_CROSS', None)
if crossbuild and platform!='win32': if crossbuild and platform not in ('win32-vc', 'win64-vc'):
platform = 'linuxcross' platform = 'linuxcross'
env['OURPLATFORM'] = platform env['OURPLATFORM'] = platform
@@ -183,7 +193,7 @@ if env['BF_NO_ELBEEM'] == 1:
env['CCFLAGS'].append('-DDISABLE_ELBEEM') env['CCFLAGS'].append('-DDISABLE_ELBEEM')
if env['WITH_BF_OPENMP'] == 1: if env['WITH_BF_OPENMP'] == 1:
if env['OURPLATFORM']=='win32-vc': if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
env['CCFLAGS'].append('/openmp') env['CCFLAGS'].append('/openmp')
env['CPPFLAGS'].append('/openmp') env['CPPFLAGS'].append('/openmp')
env['CXXFLAGS'].append('/openmp') env['CXXFLAGS'].append('/openmp')
@@ -283,7 +293,7 @@ if 'blenderlite' in B.targets:
env['BF_NO_ELBEEM'] = True env['BF_NO_ELBEEM'] = True
env['WITH_BF_PYTHON'] = False 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'].remove('/ENTRY:mainCRTStartup')
env['PLATFORM_LINKFLAGS'].append('/ENTRY:main') env['PLATFORM_LINKFLAGS'].append('/ENTRY:main')
@@ -390,7 +400,7 @@ thestatlibs, thelibincs = B.setup_staticlibs(env)
thesyslibs = B.setup_syslibs(env) thesyslibs = B.setup_syslibs(env)
if 'blender' in B.targets or not env['WITH_BF_NOBLENDER']: 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']: if env['WITH_BF_PLAYER']:
playerlist = B.create_blender_liblist(env, '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') env.BlenderProg(B.root_build_dir, "blenderplayer", dobj + playerlist, [], thestatlibs + thesyslibs, [B.root_build_dir+'/lib'] + thelibincs, 'blenderplayer')
@@ -471,7 +481,6 @@ if env['OURPLATFORM']=='linux2':
if '.svn' in tn: if '.svn' in tn:
tn.remove('.svn') tn.remove('.svn')
for f in tf: for f in tf:
print ">>>", env['BF_INSTALLDIR'], tp, f
iconlist.append(tp+os.sep+f) iconlist.append(tp+os.sep+f)
icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f) icontargetlist.append(env['BF_INSTALLDIR']+tp[19:]+os.sep+f)
@@ -496,7 +505,6 @@ for tp, tn, tf in os.walk('release/plugins'):
if '.svn' in tn: if '.svn' in tn:
tn.remove('.svn') tn.remove('.svn')
for f in tf: for f in tf:
print ">>>", env['BF_INSTALLDIR'], tp, f
pluglist.append(tp+os.sep+f) pluglist.append(tp+os.sep+f)
plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f) plugtargetlist.append(env['BF_INSTALLDIR']+tp[7:]+os.sep+f)
@@ -540,13 +548,19 @@ elif env['OURPLATFORM']=='linux2':
else: else:
allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall] allinstall = [blenderinstall, dotblenderinstall, scriptinstall, plugininstall, textinstall]
if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'): if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc'):
dllsources = ['${LCGDIR}/gettext/lib/gnu_gettext.dll', if env['OURPLATFORM'] == 'win64-vc':
dllsources = []
else:
dllsources = ['${LCGDIR}/gettext/lib/gettext.dll',
'${BF_PNG_LIBPATH}/libpng.dll', '${BF_PNG_LIBPATH}/libpng.dll',
'${BF_ZLIB_LIBPATH}/zlib.dll', '${BF_ZLIB_LIBPATH}/zlib.dll',
'${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll'] '${BF_TIFF_LIBPATH}/${BF_TIFF_LIB}.dll']
dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll'] dllsources += ['${BF_PTHREADS_LIBPATH}/${BF_PTHREADS_LIB}.dll']
if env['WITH_BF_SDL']: if env['WITH_BF_SDL']:
if env['OURPLATFORM'] == 'win64-vc':
pass # we link statically already to SDL on win64
else:
dllsources.append('${BF_SDL_LIBPATH}/SDL.dll') dllsources.append('${BF_SDL_LIBPATH}/SDL.dll')
if env['WITH_BF_PYTHON']: if env['WITH_BF_PYTHON']:
dllsources.append('#release/windows/extra/python25.zip') dllsources.append('#release/windows/extra/python25.zip')
@@ -556,6 +570,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw'):
else: else:
dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll') dllsources.append('${BF_PYTHON_LIBPATH}/${BF_PYTHON_LIB}.dll')
if env['WITH_BF_ICONV']: if env['WITH_BF_ICONV']:
if env['OURPLATFORM'] == 'win64-vc':
pass # we link statically to iconv on win64
else:
dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll'] dllsources += ['${BF_ICONV_LIBPATH}/iconv.dll']
if env['WITH_BF_FFMPEG']: if env['WITH_BF_FFMPEG']:
dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll', dllsources += ['${LCGDIR}/ffmpeg/lib/avcodec-51.dll',
@@ -601,12 +618,6 @@ Default(B.program_list)
if not env['WITHOUT_BF_INSTALL']: if not env['WITHOUT_BF_INSTALL']:
Default(installtarget) Default(installtarget)
#------------ RELEASE
# TODO: zipup the installation
#------------ BLENDERPLAYER
# TODO: build stubs and link into blenderplayer
#------------ EPYDOC #------------ EPYDOC
if env['WITH_BF_DOCS']: if env['WITH_BF_DOCS']:
SConscript('source/blender/python/api2_2x/doc/SConscript') SConscript('source/blender/python/api2_2x/doc/SConscript')

View File

@@ -7,7 +7,7 @@ Import('env')
defs = 'USE_DOUBLES QHULL _LIB' defs = 'USE_DOUBLES QHULL _LIB'
cflags = [] cflags = []
if env['OURPLATFORM']=='win32-vc': if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
defs += ' WIN32 NDEBUG _WINDOWS _LIB' defs += ' WIN32 NDEBUG _WINDOWS _LIB'
#cflags += ['/MT', '/W3', '/GX', '/O2', '/Op'] #cflags += ['/MT', '/W3', '/GX', '/O2', '/Op']
cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6'] cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6']

View File

@@ -6,7 +6,7 @@ Import('env')
defs = 'USE_DOUBLES QHULL _LIB' defs = 'USE_DOUBLES QHULL _LIB'
cflags = [] cflags = []
if env['OURPLATFORM']=='win32-vc': if env['OURPLATFORM'] in ('win32-vc', 'win64-vc'):
defs += ' WIN32 NDEBUG _WINDOWS _LIB' defs += ' WIN32 NDEBUG _WINDOWS _LIB'
cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6'] cflags += ['/MT', '/W3', '/GX', '/Og', '/Ot', '/Ob1', '/Op', '/G6']
elif env['OURPLATFORM']=='win32-mingw': elif env['OURPLATFORM']=='win32-mingw':

View File

@@ -14,7 +14,7 @@ if window_system in ('linux2', 'openbsd3', 'sunos5', 'freebsd6', 'irix6'):
for f in pf: for f in pf:
sources.remove('intern' + os.sep + f + 'Win32.cpp') sources.remove('intern' + os.sep + f + 'Win32.cpp')
sources.remove('intern' + os.sep + f + 'Carbon.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: for f in pf:
sources.remove('intern' + os.sep + f + 'X11.cpp') sources.remove('intern' + os.sep + f + 'X11.cpp')
sources.remove('intern' + os.sep + f + 'Carbon.cpp') sources.remove('intern' + os.sep + f + 'Carbon.cpp')
@@ -27,6 +27,6 @@ else:
Exit() Exit()
incs = '. ../string ' + env['BF_OPENGL_INC'] 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 incs = env['BF_WINTAB_INC'] + ' ' + incs
env.BlenderLib ('bf_ghost', sources, Split(incs), defines=['_USE_MATH_DEFINES'], libtype=['intern'], priority = [40] ) env.BlenderLib ('bf_ghost', sources, Split(incs), defines=['_USE_MATH_DEFINES'], libtype=['intern'], priority = [40] )

View File

@@ -55,7 +55,7 @@ if env['WITH_BF_BULLET']:
if env['BF_NO_ELBEEM']: if env['BF_NO_ELBEEM']:
defs += ' DISABLE_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'] incs += ' ' + env['BF_PTHREADS_INC']
env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [165] ) env.BlenderLib ( libname = 'bf_blenkernel', sources = sources, includes = Split(incs), defines = Split(defs), libtype=['core'], priority = [165] )

View File

@@ -19,7 +19,7 @@ if env['OURPLATFORM'] == 'linux2':
cflags='-pthread' cflags='-pthread'
incs += ' ../../../extern/binreloc/include' 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'] incs += ' ' + env['BF_PTHREADS_INC']
env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core'], priority = [180], compileflags =cflags ) env.BlenderLib ( 'bf_blenlib', sources, Split(incs), Split(defs), libtype=['core'], priority = [180], compileflags =cflags )

View File

@@ -14,6 +14,7 @@ to kill any code duplication
""" """
import os
import os.path import os.path
import string import string
import glob import glob
@@ -99,9 +100,7 @@ def create_blender_liblist(lenv = None, libtype = None):
sortlist.sort() sortlist.sort()
for sk in sortlist: for sk in sortlist:
v = curlib[sk] v = curlib[sk]
target = root_build_dir + 'lib/'+lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX'] target = os.path.abspath(os.getcwd() + os.sep + root_build_dir + 'lib' + os.sep +lenv['LIBPREFIX'] + v + lenv['LIBSUFFIX'])
if not (root_build_dir[0]==os.sep or root_build_dir[1]==':'):
target = '#'+target
lst.append(target) lst.append(target)
return lst return lst
@@ -145,7 +144,7 @@ def setup_staticlibs(lenv):
if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']: if lenv['WITH_BF_PYTHON'] and lenv['WITH_BF_STATICPYTHON']:
statlibs += Split(lenv['BF_PYTHON_LIB_STATIC']) 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']) libincs += Split(lenv['BF_PTHREADS_LIBPATH'])
return statlibs, libincs return statlibs, libincs
@@ -159,7 +158,7 @@ def setup_syslibs(lenv):
] ]
if lenv['WITH_BF_PYTHON'] and not lenv['WITH_BF_STATICPYTHON']: 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') syslibs.append(lenv['BF_PYTHON_LIB']+'_d')
else: else:
syslibs.append(lenv['BF_PYTHON_LIB']) syslibs.append(lenv['BF_PYTHON_LIB'])
@@ -187,7 +186,7 @@ def setup_syslibs(lenv):
syslibs += Split(lenv['BF_SDL_LIB']) syslibs += Split(lenv['BF_SDL_LIB'])
if not lenv['WITH_BF_STATICOPENGL']: if not lenv['WITH_BF_STATICOPENGL']:
syslibs += Split(lenv['BF_OPENGL_LIB']) 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 += Split(lenv['BF_PTHREADS_LIB'])
syslibs += lenv['LLIBS'] syslibs += lenv['LLIBS']
@@ -391,7 +390,7 @@ class BlenderEnvironment(SConsEnvironment):
if not self or not libname or not source: if not self or not libname or not source:
print bc.FAIL+'Cannot continue. Missing argument for BlenderRes '+libname+bc.ENDC print bc.FAIL+'Cannot continue. Missing argument for BlenderRes '+libname+bc.ENDC
self.Exit() 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 print bc.FAIL+'BlenderRes is for windows only!'+bc.END
self.Exit() self.Exit()
@@ -456,7 +455,7 @@ class BlenderEnvironment(SConsEnvironment):
def BlenderProg(self=None, builddir=None, progname=None, sources=None, includes=None, libs=None, libpath=None, binarykind=''): 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 print bc.HEADER+'Configuring program '+bc.ENDC+bc.OKGREEN+progname+bc.ENDC
lenv = self.Clone() 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']) lenv.Append(LINKFLAGS = lenv['PLATFORM_LINKFLAGS'])
if lenv['BF_DEBUG']: if lenv['BF_DEBUG']:
lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb']) lenv.Prepend(LINKFLAGS = ['/DEBUG','/PDB:'+progname+'.pdb'])
@@ -486,7 +485,7 @@ class BlenderEnvironment(SConsEnvironment):
lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB']) lenv.Append(LIBS = lenv['BF_QUICKTIME_LIB'])
lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH']) lenv.Append(LIBPATH = lenv['BF_QUICKTIME_LIBPATH'])
prog = lenv.Program(target=builddir+'bin/'+progname, source=sources) 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) f = lenv.File(progname + '.bsc', builddir)
brs = lenv.Command(f, prog, [bsc]) brs = lenv.Command(f, prog, [bsc])
SConsEnvironment.Default(self, brs) SConsEnvironment.Default(self, brs)