1#!/usr/local/bin/python3.8
2
3# Copyright (C) Vladimir Prus 2006.
4# Distributed under the Boost Software License, Version 1.0. (See
5# accompanying file LICENSE_1_0.txt or copy at
6# http://www.boost.org/LICENSE_1_0.txt)
7
8import BoostBuild
9
10t = BoostBuild.Tester(use_test_config=False)
11
12
13t.write("jamroot.jam", """
14project : requirements <threading>multi <variant>debug:<link>static ;
15# Force link to be relevant
16project : requirements <link>shared:<define>TEST_DLL ;
17
18build-project sub ;
19build-project sub2 ;
20build-project sub3 ;
21build-project sub4 ;
22""")
23
24t.write("sub/jamfile.jam", """
25exe hello : hello.cpp : -<threading>multi ;
26""")
27
28t.write("sub/hello.cpp", """
29int main() {}
30""")
31
32t.write("sub2/jamfile.jam", """
33project : requirements -<threading>multi ;
34exe hello : hello.cpp ;
35""")
36
37t.write("sub2/hello.cpp", """
38int main() {}
39""")
40
41t.write("sub3/hello.cpp", """
42int main() {}
43""")
44
45t.write("sub3/jamfile.jam", """
46exe hello : hello.cpp : "-<variant>debug:<link>static" ;
47""")
48
49t.write("sub4/hello.cpp", """
50int main() {}
51""")
52
53t.write("sub4/jamfile.jam", """
54project : requirements "-<variant>debug:<link>static" ;
55exe hello : hello.cpp ;
56""")
57
58t.run_build_system()
59
60t.expect_addition("sub/bin/$toolset/debug*/link-static*/hello.exe")
61t.expect_addition("sub2/bin/$toolset/debug*/link-static*/hello.exe")
62t.expect_addition("sub3/bin/$toolset/debug*/threading-multi*/hello.exe")
63t.expect_addition("sub4/bin/$toolset/debug*/threading-multi*/hello.exe")
64
65t.rm(".")
66
67# Now test that path requirements can be removed as well.
68t.write("jamroot.jam", """
69build-project sub ;
70""")
71
72t.write("sub/jamfile.jam", """
73project : requirements <include>broken ;
74exe hello : hello.cpp : -<include>broken ;
75""")
76
77t.write("sub/hello.cpp", """
78#include "math.h"
79int main() {}
80""")
81
82t.write("sub/broken/math.h", """
83Broken
84""")
85
86
87t.run_build_system()
88
89t.expect_addition("sub/bin/$toolset/debug*/hello.exe")
90
91t.cleanup()
92