From 35d0e99299cc653c9064026ccbb2b2453483c515 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 10 Jan 2013 08:01:07 +0000 Subject: [PATCH] Added new scons target: cudakernels It's intended to perform compilation of CUDA kernels only, without doing anything with other sources/resources and main purpose of this target is to be able to compile cuda kernels in completely different environment than the rest of blender was compiled. This is needed for linux build environment, where sm_13 compilation fails dramatically in 32bit chroot but could be compiled in 64bit environment. --- SConstruct | 24 +++++++++++++++++++++--- build_files/scons/tools/btools.py | 15 ++++++++++++++- 2 files changed, 35 insertions(+), 4 deletions(-) diff --git a/SConstruct b/SConstruct index 90c3c45b302..c50240b85e0 100644 --- a/SConstruct +++ b/SConstruct @@ -275,6 +275,9 @@ if 'blenderlite' in B.targets: if k not in B.arguments: env[k] = v +if 'cudakernels' in B.targets: + env['WITH_BF_CYCLES_CUDA_BINARIES'] = True + # Extended OSX_SDK and 3D_CONNEXION_CLIENT_LIBRARY and JAckOSX detection for OSX if env['OURPLATFORM']=='darwin': print B.bc.OKGREEN + "Detected Xcode version: -- " + B.bc.ENDC + env['XCODE_CUR_VER'] + " --" @@ -651,6 +654,7 @@ datafileslist = [] datafilestargetlist = [] dottargetlist = [] scriptinstall = [] +cubininstall = [] if env['OURPLATFORM']!='darwin': dotblenderinstall = [] @@ -746,7 +750,7 @@ if env['OURPLATFORM']!='darwin': for arch in env['BF_CYCLES_CUDA_BINARIES_ARCH']: kernel_build_dir = os.path.join(B.root_build_dir, 'intern/cycles/kernel') cubin_file = os.path.join(kernel_build_dir, "kernel_%s.cubin" % arch) - scriptinstall.append(env.Install(dir=dir,source=cubin_file)) + cubininstall.append(env.Install(dir=dir,source=cubin_file)) # osl shaders if env['WITH_BF_CYCLES_OSL']: @@ -857,9 +861,9 @@ textinstall = env.Install(dir=env['BF_INSTALLDIR'], source=textlist) if env['OURPLATFORM']=='darwin': allinstall = [blenderinstall, textinstall] elif env['OURPLATFORM']=='linux': - allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, iconinstall] + allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, iconinstall, cubininstall] else: - allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall] + allinstall = [blenderinstall, dotblenderinstall, scriptinstall, textinstall, cubininstall] if env['OURPLATFORM'] in ('win32-vc', 'win32-mingw', 'win64-vc', 'linuxcross'): dllsources = [] @@ -989,6 +993,20 @@ buildslave_alias = env.Alias('buildslave', buildslave_cmd) Depends(buildslave_cmd, allinstall) +cudakernels_action = env.Action(btools.cudakernels, btools.cudakernels_print) +cudakernels_cmd = env.Command('cudakernels_exec', None, cudakernels_action) +cudakernels_alias = env.Alias('cudakernels', cudakernels_cmd) + +cudakernel_dir = os.path.join(os.path.abspath(os.path.normpath(B.root_build_dir)), 'intern/cycles/kernel') +cuda_kernels = [] + +for x in env['BF_CYCLES_CUDA_BINARIES_ARCH']: + cubin = os.path.join(cudakernel_dir, 'kernel_' + x + '.cubin') + cuda_kernels.append(cubin) + +Depends(cudakernels_cmd, cuda_kernels) +Depends(cudakernels_cmd, cubininstall) + Default(B.program_list) if not env['WITHOUT_BF_INSTALL']: diff --git a/build_files/scons/tools/btools.py b/build_files/scons/tools/btools.py index f7673492013..22360447343 100644 --- a/build_files/scons/tools/btools.py +++ b/build_files/scons/tools/btools.py @@ -215,7 +215,8 @@ def print_targets(targs, bc): def validate_targets(targs, bc): valid_list = ['.', 'blender', 'blenderstatic', 'blenderplayer', 'webplugin', 'blendernogame', 'blenderstaticnogame', 'blenderlite', 'release', - 'everything', 'clean', 'install-bin', 'install', 'nsis','buildslave'] + 'everything', 'clean', 'install-bin', 'install', 'nsis','buildslave', + 'cudakernels'] oklist = [] for t in targs: if t in valid_list: @@ -826,6 +827,18 @@ def NSIS_Installer(target=None, source=None, env=None): 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: