From c9bca51e7646510913bace5374e0a948ddb7dfb7 Mon Sep 17 00:00:00 2001 From: Nathan Letwory Date: Tue, 8 Nov 2011 20:40:02 +0000 Subject: [PATCH] Add compiles support for Cycles. No CUDA compiling yet, will be added later. --- SConstruct | 51 ++++++++++++++++++++- build_files/scons/config/win32-vc-config.py | 13 +++--- build_files/scons/config/win64-vc-config.py | 4 +- build_files/scons/tools/Blender.py | 5 ++ build_files/scons/tools/btools.py | 3 ++ intern/SConscript | 3 ++ intern/cycles/SConscript | 33 +++++++++++++ source/blender/SConscript | 3 +- source/blender/makesrna/SConscript | 4 +- source/blender/python/SConscript | 3 ++ 10 files changed, 109 insertions(+), 13 deletions(-) create mode 100644 intern/cycles/SConscript diff --git a/SConstruct b/SConstruct index 16ce8ca4b32..5bc76c57091 100644 --- a/SConstruct +++ b/SConstruct @@ -435,12 +435,12 @@ B.init_lib_dict() Export('env') +BuildDir(B.root_build_dir+'/source', 'source', duplicate=0) +SConscript(B.root_build_dir+'/source/SConscript') BuildDir(B.root_build_dir+'/intern', 'intern', duplicate=0) SConscript(B.root_build_dir+'/intern/SConscript') BuildDir(B.root_build_dir+'/extern', 'extern', duplicate=0) SConscript(B.root_build_dir+'/extern/SConscript') -BuildDir(B.root_build_dir+'/source', 'source', duplicate=0) -SConscript(B.root_build_dir+'/source/SConscript') # now that we have read all SConscripts, we know what # libraries will be built. Create list of @@ -526,6 +526,50 @@ if env['OURPLATFORM']!='darwin': if len(source)==0: env.Execute(Mkdir(dir)) scriptinstall.append(env.Install(dir=dir,source=source)) + if env['WITH_BF_CYCLES']: + # cycles python code + dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles') + source=os.listdir('intern/cycles/blender/addon') + if '.svn' in source: source.remove('.svn') + if '_svn' in source: source.remove('_svn') + if '__pycache__' in source: source.remove('__pycache__') + source=['intern/cycles/blender/addon/'+s for s in source] + scriptinstall.append(env.Install(dir=dir,source=source)) + + # cycles kernel code + dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel') + source=os.listdir('intern/cycles/kernel') + if '.svn' in source: source.remove('.svn') + if '_svn' in source: source.remove('_svn') + if '__pycache__' in source: source.remove('__pycache__') + source.remove('kernel.cpp') + source.remove('CMakeLists.txt') + source.remove('svm') + source.remove('osl') + source=['intern/cycles/kernel/'+s for s in source] + source.append('intern/cycles/util/util_color.h') + source.append('intern/cycles/util/util_math.h') + source.append('intern/cycles/util/util_transform.h') + source.append('intern/cycles/util/util_types.h') + scriptinstall.append(env.Install(dir=dir,source=source)) + # svm + dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'kernel', 'svm') + source=os.listdir('intern/cycles/kernel/svm') + if '.svn' in source: source.remove('.svn') + if '_svn' in source: source.remove('_svn') + if '__pycache__' in source: source.remove('__pycache__') + source=['intern/cycles/kernel/svm/'+s for s in source] + scriptinstall.append(env.Install(dir=dir,source=source)) + + # licenses + dir=os.path.join(env['BF_INSTALLDIR'], VERSION, 'scripts', 'addons','cycles', 'license') + source=os.listdir('intern/cycles/doc/license') + if '.svn' in source: source.remove('.svn') + if '_svn' in source: source.remove('_svn') + if '__pycache__' in source: source.remove('__pycache__') + source.remove('CMakeLists.txt') + source=['intern/cycles/doc/license/'+s for s in source] + scriptinstall.append(env.Install(dir=dir,source=source)) if env['WITH_BF_INTERNATIONAL']: internationalpaths=['release' + os.sep + 'datafiles'] @@ -696,6 +740,9 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb.dll') dllsources.append('${LCGDIR}/thumbhandler/lib/BlendThumb64.dll') + if env['WITH_BF_OIIO']: + dllsources.append('${LCGDIR}/openimageio/bin/OpenImageIO.dll') + dllsources.append('#source/icons/blender.exe.manifest') windlls = env.Install(dir=env['BF_INSTALLDIR'], source = dllsources) diff --git a/build_files/scons/config/win32-vc-config.py b/build_files/scons/config/win32-vc-config.py index 1e4821180d6..20d4cdbf797 100644 --- a/build_files/scons/config/win32-vc-config.py +++ b/build_files/scons/config/win32-vc-config.py @@ -149,19 +149,20 @@ WITH_BF_3DMOUSE = True WITH_BF_OPENMP = True -''' +#Cycles +WITH_BF_CYCLES = True + WITH_BF_OIIO = True BF_OIIO = LIBDIR + '/openimageio' -BF_OIIO_INC = '${BF_OIIO}/include' +BF_OIIO_INC = '#../lib/windows/openimageio/include' BF_OIIO_LIB = 'OpenImageIO' -BF_OIIO_LIBPATH = '${BF_OIIO}/lib' +BF_OIIO_LIBPATH = '#../lib/windows/openimageio/lib' WITH_BF_BOOST = True BF_BOOST = LIBDIR + '/boost' -BF_BOOST_INC = '${BF_BOOST}/include' +BF_BOOST_INC = '#../lib/windows/boost/include' BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_46_1 libboost_filesystem-vc90-mt-s-1_46_1 libboost_regex-vc90-mt-s-1_46_1 libboost_system-vc90-mt-s-1_46_1 libboost_thread-vc90-mt-s-1_46_1' -BF_BOOST_LIBPATH = '${BF_BOOST}/lib' -''' +BF_BOOST_LIBPATH = '#../lib/windows/boost/lib' #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True diff --git a/build_files/scons/config/win64-vc-config.py b/build_files/scons/config/win64-vc-config.py index 0920d9375ae..051e4b0cc10 100644 --- a/build_files/scons/config/win64-vc-config.py +++ b/build_files/scons/config/win64-vc-config.py @@ -153,7 +153,8 @@ WITH_BF_3DMOUSE = True WITH_BF_OPENMP = True -''' +WITH_BF_CYCLES = True + WITH_BF_OIIO = True BF_OIIO = LIBDIR + '/openimageio' BF_OIIO_INC = '${BF_OIIO}/include' @@ -165,7 +166,6 @@ BF_BOOST = LIBDIR + '/boost' BF_BOOST_INC = '${BF_BOOST}/include' BF_BOOST_LIB = 'libboost_date_time-vc90-mt-s-1_45 libboost_filesystem-vc90-mt-s-1_45 libboost_regex-vc90-mt-s-1_45 libboost_system-vc90-mt-s-1_45 libboost_thread-vc90-mt-s-1_45' BF_BOOST_LIBPATH = '${BF_BOOST}/lib' -''' #Ray trace optimization WITH_BF_RAYOPTIMIZATION = True diff --git a/build_files/scons/tools/Blender.py b/build_files/scons/tools/Blender.py index ba15f1c1c09..ceadd031393 100644 --- a/build_files/scons/tools/Blender.py +++ b/build_files/scons/tools/Blender.py @@ -279,6 +279,11 @@ def setup_syslibs(lenv): if lenv['WITH_BF_3DMOUSE']: if not lenv['WITH_BF_STATIC3DMOUSE']: syslibs += Split(lenv['BF_3DMOUSE_LIB']) + + if lenv['WITH_BF_OIIO']: + syslibs += Split(lenv['BF_OIIO_LIB']) + if lenv['WITH_BF_BOOST']: + syslibs += Split(lenv['BF_BOOST_LIB']) if lenv['WITH_BF_OIIO']: syslibs += Split(lenv['BF_OIIO_LIB']) diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index 5c78dc646bb..6686b948631 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -156,6 +156,7 @@ def validate_arguments(args, bc): '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_3DMOUSE', 'WITH_BF_STATIC3DMOUSE', 'BF_3DMOUSE', 'BF_3DMOUSE_INC', 'BF_3DMOUSE_LIB', 'BF_3DMOUSE_LIBPATH', 'BF_3DMOUSE_LIB_STATIC', + 'WITH_BF_CYCLES', 'WITH_BF_OIIO', 'BF_OIIO', 'BF_OIIO_INC', 'BF_OIIO_LIB', 'BF_OIIO_LIBPATH', 'WITH_BF_BOOST', 'BF_BOOST', 'BF_BOOST_INC', 'BF_BOOST_LIB', 'BF_BOOST_LIBPATH' ] @@ -537,6 +538,8 @@ def read_opts(env, cfg, args): ('BUILDBOT_BRANCH', 'Buildbot branch name', ''), + (BoolVariable('WITH_BF_CYCLES', 'Build with the Cycles engine', True)), + (BoolVariable('WITH_BF_OIIO', 'Build with OpenImageIO', False)), ('BF_OIIO_INC', 'OIIO include path', ''), ('BF_OIIO_LIB', 'OIIO library', ''), diff --git a/intern/SConscript b/intern/SConscript index da245c78776..c13714543cb 100644 --- a/intern/SConscript +++ b/intern/SConscript @@ -24,6 +24,9 @@ NEW_CSG='false' if env['WITH_BF_FLUID']: SConscript(['elbeem/SConscript']) + +if env['WITH_BF_CYCLES']: + SConscript(['cycles/SConscript']) if NEW_CSG=='false': SConscript(['bsp/SConscript']) diff --git a/intern/cycles/SConscript b/intern/cycles/SConscript new file mode 100644 index 00000000000..dbaf52ff175 --- /dev/null +++ b/intern/cycles/SConscript @@ -0,0 +1,33 @@ +#!/usr/bin/python +from os import path +Import('env') + +cycles = env.Clone() + +cycles.Depends('../../source/blender/makesrna/intern/RNA_blender_cpp.h', 'makesrna') + +sources = cycles.Glob('bvh/*.cpp') + cycles.Glob('device/*.cpp') + cycles.Glob('kernel/*.cpp') + cycles.Glob('render/*.cpp') + cycles.Glob('subd/*.cpp') + cycles.Glob('util/*.cpp') + cycles.Glob('util/*.c') + cycles.Glob('blender/*.cpp') + +sources.remove(path.join('util', 'util_view.cpp')) +sources.remove(path.join('render', 'film_response.cpp')) + +incs = [] +defs = [] + +defs.append('CCL_NAMESPACE_BEGIN=namespace ccl {') +defs.append('CCL_NAMESPACE_END=}') + +defs.append('WITH_OPENCL') +defs.append('WITH_MULTI') +defs.append('WITH_CUDA') + +incs.extend('. bvh render device kernel kernel/osl kernel/svm util subd'.split()) +incs.extend('#intern/guardedalloc #source/blender/makesrna #source/blender/makesdna'.split()) +incs.extend('#source/blender/blenloader ../../source/blender/makesrna/intern'.split()) +incs.extend('#extern/glew/include'.split()) +incs.append(cycles['BF_OIIO_INC']) +incs.append(cycles['BF_BOOST_INC']) +incs.append(cycles['BF_PYTHON_INC']) + +cycles.BlenderLib('bf_intern_cycles', sources, incs, defs, libtype=['intern'], priority=[0] ) + diff --git a/source/blender/SConscript b/source/blender/SConscript index 969bd2966fc..ea5101f8111 100644 --- a/source/blender/SConscript +++ b/source/blender/SConscript @@ -11,7 +11,6 @@ SConscript(['avi/SConscript', 'editors/SConscript', 'imbuf/SConscript', 'makesdna/SConscript', - 'makesrna/SConscript', 'render/SConscript', 'nodes/SConscript', 'modifiers/SConscript', @@ -19,7 +18,7 @@ SConscript(['avi/SConscript', 'windowmanager/SConscript', 'blenfont/SConscript']) - +makesrna = SConscript('makesrna/SConscript') if env['WITH_BF_PYTHON']: SConscript(['python/SConscript']) diff --git a/source/blender/makesrna/SConscript b/source/blender/makesrna/SConscript index da186a57c8b..769ec880a65 100644 --- a/source/blender/makesrna/SConscript +++ b/source/blender/makesrna/SConscript @@ -65,4 +65,6 @@ if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'linuxcross', 'win64-vc'): if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') -env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] ) +rnalib = env.BlenderLib ( 'bf_rna', objs, Split(incs), defines=defs, libtype=['core','player'], priority = [165,20] ) + +Return ('rnalib') diff --git a/source/blender/python/SConscript b/source/blender/python/SConscript index 3f47038687a..c592e87f3b9 100644 --- a/source/blender/python/SConscript +++ b/source/blender/python/SConscript @@ -43,5 +43,8 @@ if env['BF_BUILDINFO']: if env['WITH_BF_INTERNATIONAL']: defs.append('WITH_INTERNATIONAL') +if env['WITH_BF_CYCLES']: + defs.append('WITH_CYCLES') + sources = env.Glob('intern/*.c') env.BlenderLib( libname = 'bf_python', sources = Split(sources), includes = Split(incs), defines = defs, libtype = ['core'], priority = [361])