File: expansion.py

package info (click to toggle)
boost-build 2.0-m12-2
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 8,692 kB
  • ctags: 6,963
  • sloc: ansic: 39,914; sh: 9,086; python: 6,120; xml: 5,524; cpp: 1,467; yacc: 456; asm: 353; makefile: 184
file content (92 lines) | stat: -rw-r--r-- 2,047 bytes parent folder | download | duplicates (5)
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/python

#  Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears in
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

#  This file is template for Boost.Build tests. It creates a simple
#  project that builds one exe from one source, and checks that the exe
#  is really created.
from BoostBuild import Tester, List


t = Tester()

t.write("a.cpp", """ 
#ifdef CF_IS_OFF
int main() { return 0; }
#endif

""")

t.write("b.cpp", """ 
#ifdef CF_1
int main() { return 0; }
#endif

""")

t.write("c.cpp", """
#ifdef FOO
int main() { return 0; }
#endif

""")


t.write("Jamfile", """ 
# See if default value of composite feature 'cf'
# will be expanded to <define>CF_IS_OFF
exe a : a.cpp ;

# See if subfeature in requirements in expanded.
exe b : b.cpp : <cf>on-1 ;

# See if conditional requirements are recursively expanded.
exe c : c.cpp : <toolset>$toolset:<variant>release <variant>release:<define>FOO ;
""")

t.write("project-root.jam", """ 
import feature ;

feature.feature cf : off on : composite incidental ;

feature.compose <cf>off : <define>CF_IS_OFF ;

feature.subfeature cf on : version : 1 2 : composite optional incidental ;

feature.compose <cf-on:version>1 : <define>CF_1 ;
        
""")

t.expand_toolset("Jamfile")

t.run_build_system()
t.expect_addition(["bin/$toolset/debug/a.exe",
                   "bin/$toolset/debug/b.exe",
                   "bin/$toolset/release/c.exe",
                   ])

t.rm("bin")

# Test for issue BB60
t.write("test.cpp", """
#include "header.h"
int main() { return 0; }
""")
t.write("Jamfile", """
project
    : requirements <toolset>$toolset:<include>foo
    ;
exe test : test.cpp : <toolset>$toolset ;
""")
t.expand_toolset("Jamfile")
t.write("foo/header.h", """
""")
t.write("project-root.jam", "")
t.run_build_system()
t.expect_addition("bin/$toolset/debug/test.exe")

t.cleanup()