summaryrefslogtreecommitdiffstats
path: root/test/CompilationDatabase/fixture/SConstruct_variant
blob: ea461fbab88b1feb5f00651263fa25f92fb287c8 (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
43
44
import sys

DefaultEnvironment(tools=[])
env = Environment(
    PYTHON=sys.executable,
    LINK='$PYTHON mylink.py',
    LINKFLAGS=[],
    CC='$PYTHON mygcc.py cc',
    CXX='$PYTHON mygcc.py c++',
    tools=['gcc','g++','gnulink'],
)
env.Tool('compilation_db')

env_abs = env.Clone(COMPILATIONDB_USE_ABSPATH=True)
env_abs.CompilationDatabase('compile_commands_clone_abs.json')

# Should be relative paths
env.CompilationDatabase('compile_commands_only_arg.json')
env.CompilationDatabase(target='compile_commands_target.json')

# Should default name compile_commands.json
env.CompilationDatabase()

# Should be absolute paths
env.CompilationDatabase('compile_commands_over_abs.json', COMPILATIONDB_USE_ABSPATH=True)
env.CompilationDatabase(target='compile_commands_target_over_abs.json', COMPILATIONDB_USE_ABSPATH=True)

# Should be relative paths
env.CompilationDatabase('compile_commands_over_rel.json', COMPILATIONDB_USE_ABSPATH=False)

# Try 1/0 for COMPILATIONDB_USE_ABSPATH
env.CompilationDatabase('compile_commands_over_abs_1.json', COMPILATIONDB_USE_ABSPATH=1)
env.CompilationDatabase('compile_commands_over_abs_0.json', COMPILATIONDB_USE_ABSPATH=0)

# Try filter for build and build2 output
env.CompilationDatabase('compile_commands_filter_build.json', COMPILATIONDB_PATH_FILTER='build/*')
env.CompilationDatabase('compile_commands_filter_build2.json', COMPILATIONDB_PATH_FILTER='build2/*')

env.VariantDir('build','src')
env.Program('build/main', 'build/test_main.c')

env.VariantDir('build2','src', duplicate=0)
env.Program('build2/main', 'build2/test_main.c')