File: path_features.py

package info (click to toggle)
boost-build 2.0-m11-2
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 4,624 kB
  • ctags: 2,387
  • sloc: ansic: 12,978; python: 5,209; xml: 4,782; cpp: 555; yacc: 456; sh: 237; makefile: 71
file content (78 lines) | stat: -rwxr-xr-x 1,831 bytes parent folder | download | duplicates (3)
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
#!/usr/bin/python

from BoostBuild import Tester
t = Tester()

t.write("project-root.jam", "import gcc ;")
t.write("Jamfile", "lib a : a.cpp : <include>. ;")
t.write("a.cpp", """
#include <a.h>
void
# ifdef _WIN32
__declspec(dllexport)
# endif 
foo() {}
""")
t.write("a.h", "//empty file\n")

t.write("d/Jamfile", "exe b : b.cpp ..//a ; ")
t.write("d/b.cpp", """
    void foo();
    int main() { foo(); }
""")

t.run_build_system(subdir="d")

# Now test the path features with condition work as well
t.write("Jamfile", "lib a : a.cpp : <variant>debug:<include>.  ;")
t.rm("bin")
t.run_build_system(subdir="d")

# Test path features with condtion in usage requirements
t.write("Jamfile", "lib a : a.cpp : <include>. : : <variant>debug:<include>. ;")
t.write("d/b.cpp", """
#include <a.h>
void foo();
int main() { foo(); }
""")
t.rm("d/bin")
t.run_build_system(subdir="d")

# Test that absolute paths inside requirements are ok. The problem
# appear only when building targets in subprojects.
t.write("project-root.jam", "")
t.write("Jamfile", "build-project x ; ")
t.write("x/Jamfile", """
local pwd = [ PWD ] ;
project : requirements <include>$(pwd)/x/include ;
exe m : m.cpp : <include>$(pwd)/x/include2 ;
""")
t.write("x/m.cpp", """
#include <h1.hpp>
#include <h2.hpp>

int main() {}
""")
t.write("x/include/h1.hpp", "\n")
t.write("x/include2/h2.hpp", "\n")

t.run_build_system()
t.expect_addition("x/bin/$toolset/debug/m.exe")

# Test that "&&" in path features is handled correctly.
t.rm("bin")
t.write("Jamfile", "build-project sub ;")
t.write("sub/Jamfile", """
exe a : a.cpp : <include>../h1&&../h2 ;
""")
t.write("sub/a.cpp", """
#include <header.h>
int main() { return OK; }
""")
t.write("h2/header.h", """
const int OK = 0;
""")
t.run_build_system()
t.expect_addition("sub/bin/$toolset/debug/a.exe")        

t.cleanup()