Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SConscript « shaders « kernel « cycles « intern - git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 36b86d7b4f6aa8a4382022774f60461c0c3acaab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/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()

    # osl compiler
    osl_compiler = File(env.subst(env['BF_OSL_COMPILER'])).abspath

    # 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')