]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
3 | # Copyright 2003, 2004, 2005 Vladimir Prus | |
4 | # Distributed under the Boost Software License, Version 1.0. | |
5 | # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) | |
6 | ||
7 | # Attempt to declare a generator for creating OBJ from RC files. That generator | |
8 | # should be considered together with standard CPP->OBJ generators and | |
9 | # successfully create the target. Since we do not have a RC compiler everywhere, | |
10 | # we fake the action. The resulting OBJ will be unusable, but it must be | |
11 | # created. | |
12 | ||
13 | import BoostBuild | |
14 | ||
15 | t = BoostBuild.Tester() | |
16 | ||
17 | t.write("jamroot.jam", """ | |
18 | import rcc ; | |
19 | """) | |
20 | ||
21 | t.write("rcc.jam", """ | |
22 | import type ; | |
23 | import generators ; | |
24 | import print ; | |
25 | ||
26 | # Use 'RCC' to avoid conflicts with definitions in the standard rc.jam and | |
27 | # msvc.jam | |
28 | type.register RCC : rcc ; | |
29 | ||
30 | rule resource-compile ( targets * : sources * : properties * ) | |
31 | { | |
32 | print.output $(targets[1]) ; | |
33 | print.text "rc-object" ; | |
34 | } | |
35 | ||
36 | generators.register-standard rcc.resource-compile : RCC : OBJ ; | |
37 | """) | |
38 | ||
39 | t.write("rcc.py", """ | |
40 | import b2.build.type as type | |
41 | import b2.build.generators as generators | |
42 | ||
43 | from b2.manager import get_manager | |
44 | ||
45 | # Use 'RCC' to avoid conflicts with definitions in the standard rc.jam and | |
46 | # msvc.jam | |
47 | type.register('RCC', ['rcc']) | |
48 | ||
49 | generators.register_standard("rcc.resource-compile", ["RCC"], ["OBJ"]) | |
50 | ||
51 | get_manager().engine().register_action( | |
52 | "rcc.resource-compile", | |
53 | '@($(STDOUT):E=rc-object) > "$(<)"') | |
54 | """) | |
55 | ||
56 | t.write("jamfile.jam", """ | |
57 | obj r : r.rcc ; | |
58 | """) | |
59 | ||
60 | t.write("r.rcc", """ | |
61 | """) | |
62 | ||
63 | t.run_build_system() | |
b32b8144 | 64 | t.expect_content("bin/$toolset/debug*/r.obj", "rc-object") |
7c673cae FG |
65 | |
66 | t.cleanup() |