blender/intern/cycles/kernel/shaders/SConscript
Sergey Sharybin 9eccf40daa OSL Scons rules
Initial support of OSL builds using SCons build system. Only tested on Linux now.
No changes to configuration files themselves -- for now check how it's configured
for linux buildbot (it was already horror to make all this changes and verify them,
changes to linux-config.py could easily be done later).

Currently WITH_BF_STATICOSL and WITH_BF_STATICLLVM are more like rudiments because
linking against oslexec requires special trick with --whole-archive. We woul either
need to find a way dealing with this oslexec less hackish or drop STATICOSL and 
STATICLLVM flags. Will keep dropping this flags for until we have "final" build
rules for OSL.

Still can not make 32bit linux rendering with OSL -- blender simply crashes when
starting rendering. So for time being this issues are solving disabled OSL for
32bit build slaves.
2012-11-15 13:11:12 +00:00

43 lines
1.0 KiB
Python

#!/usr/bin/python
import sys
import os
import Blender as B
def normpath(path):
return os.path.abspath(os.path.normpath(path))
Import ('env')
oso_files = []
if env['WITH_BF_CYCLES_OSL']:
shaders = env.Clone()
# cuda info
osl_compiler = env['BF_OSL_COMPILER']
# build directory
root_build_dir = normpath(env['BF_BUILDDIR'])
build_dir = os.path.join(root_build_dir, 'intern/cycles/kernel/shaders')
# source directories and files
source_dir = Dir('.').srcnode().path
# dependencies
dependencies = shaders.Glob('*.h')
for f in os.listdir(source_dir):
if f.endswith('.osl'):
osl_file = os.path.join(source_dir, f)
oso_file = os.path.join(build_dir, f.replace('.osl', '.oso'))
command = "%s -O2 -I%s -o %s %s" % (osl_compiler, source_dir, oso_file, osl_file)
shaders.Command(oso_file, f, command)
shaders.Depends(oso_file, [f] + dependencies)
oso_files.append(oso_file)
Return('oso_files')