~ubuntu-branches/ubuntu/vivid/emscripten/vivid

« back to all changes in this revision

Viewing changes to scons-tools/llvm.py

  • Committer: Package Import Robot
  • Author(s): Sylvestre Ledru
  • Date: 2013-06-11 15:45:24 UTC
  • mfrom: (1.2.1) (2.1.1 experimental)
  • Revision ID: package-import@ubuntu.com-20130611154524-rppb3w6tixlegv4n
Tags: 1.4.7~20130611~a1eb425-1
* New snapshot release
* Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
from SCons.Scanner.Prog import scan
 
2
from SCons.Builder import Builder
 
3
 
 
4
def exists(env):
 
5
    return True
 
6
 
 
7
def add_libraries(target, source, env):
 
8
    unique = []
 
9
    lib_nodes = set()
 
10
    for x in scan(None, env, tuple(map(env.Dir, env['LIBPATH']))):
 
11
        if x in lib_nodes:
 
12
            continue
 
13
        lib_nodes.add(x)
 
14
        unique.append(x)
 
15
    return (target, source + unique)
 
16
 
 
17
def generate(env):
 
18
    env.SetDefault(
 
19
        CLANG='clang',
 
20
        CLANGXX='clang++',
 
21
        LLVM_DIS='llvm-dis',
 
22
        LLVM_OPT='opt',
 
23
        LLVM_LINK='llvm-link')
 
24
    
 
25
    env['BUILDERS']['LLVMDis'] = Builder(
 
26
        action='${LLVM_ROOT}/$LLVM_DIS -o=$TARGET $SOURCE')
 
27
 
 
28
    env['BUILDERS']['LLVMOpt'] = Builder(
 
29
        action='${LLVM_ROOT}/$LLVM_OPT $LLVM_OPT_FLAGS $LLVM_OPT_PASSES -o=$TARGET $SOURCE')
 
30
 
 
31
    env['BUILDERS']['LLVMLink'] = Builder(
 
32
        action='${LLVM_ROOT}/$LLVM_LINK -o=$TARGET $SOURCES',
 
33
        emitter=add_libraries)