3 # Copyright 2003 Dave Abrahams
4 # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
12 t = BoostBuild.Tester(use_test_config=False)
14 t.write("jamroot.jam", "")
15 t.write("jamfile.jam", """\
17 stage dist : a a.h auxilliary/1 ;
24 must_export_something;
27 t.write("auxilliary/1", "")
30 t.expect_addition(["dist/a.dll", "dist/a.h", "dist/1"])
33 # Regression test: the following was causing a "duplicate target name" error.
34 t.write("jamfile.jam", """\
35 project : requirements <hardcode-dll-paths>true ;
37 stage dist : a a.h auxilliary/1 ;
38 alias dist-alias : dist ;
44 # Test the <location> property.
45 t.write("jamfile.jam", """\
47 stage dist : a : <variant>debug:<location>ds <variant>release:<location>rs ;
51 t.expect_addition("ds/a.dll")
53 t.run_build_system(["release"])
54 t.expect_addition("rs/a.dll")
57 # Test the <location> property in subprojects. Thanks to Kirill Lapshin for the
60 t.write("jamroot.jam", "path-constant DIST : dist ;")
61 t.write("jamfile.jam", "build-project d ;")
62 t.write("d/jamfile.jam", """\
64 stage dist : a : <location>$(DIST) ;
66 t.write("d/a.cpp", "int main() {}\n")
69 t.expect_addition("dist/a.exe")
73 # Workaround a BIG BUG: the response file is not deleted, even if application
74 # *is* deleted. We will try to use the same response file when building from
75 # subdir, with very bad results.
77 t.run_build_system(subdir="d")
78 t.expect_addition("dist/a.exe")
81 # Check that 'stage' does not incorrectly reset target suffixes.
82 t.write("a.cpp", "int main() {}\n")
83 t.write("jamroot.jam", """\
85 type.register MYEXE : : EXE ;
86 type.set-generated-target-suffix MYEXE : <optimization>off : myexe ;
89 # Since <optimization>off is in properties when 'a' is built and staged, its
90 # suffix should be "myexe".
91 t.write("jamfile.jam", """\
97 t.expect_addition("dist/a.myexe")
99 # Test 'stage's ability to traverse dependencies.
100 t.write("a.cpp", "int main() {}\n")
101 t.write("l.cpp", """\
104 __declspec(dllexport)
108 t.write("jamfile.jam", """\
111 stage dist : a : <install-dependencies>on <install-type>EXE <install-type>LIB ;
113 t.write("jamroot.jam", "")
117 t.expect_addition("dist/a.exe")
118 t.expect_addition("dist/l.dll")
120 # Check that <use> properties are ignored the traversing target for staging.
121 t.copy("l.cpp", "l2.cpp")
122 t.copy("l.cpp", "l3.cpp")
123 t.write("jamfile.jam", """\
126 lib l : l.cpp : <use>l2 <dependency>l3 ;
128 stage dist : a : <install-dependencies>on <install-type>EXE <install-type>LIB ;
133 t.expect_addition("dist/l3.dll")
134 t.expect_nothing("dist/l2.dll")
136 # Check if <dependency> on 'stage' works.
138 t.write("jamroot.jam", """\
139 stage a1 : a1.txt : <location>dist ;
140 stage a2 : a2.txt : <location>dist <dependency>a1 ;
142 t.write("a1.txt", "")
143 t.write("a2.txt", "")
144 t.run_build_system(["a2"])
145 t.expect_addition(["dist/a1.txt", "dist/a2.txt"])
147 # Regression test: check that <location>. works.
149 t.write("jamroot.jam", "stage a1 : d/a1.txt : <location>. ;")
150 t.write("d/a1.txt", "")
153 t.expect_addition("a1.txt")
155 # Test that relative paths of sources can be preserved.
157 t.write("jamroot.jam", "install dist : a/b/c.h : <install-source-root>. ;")
158 t.write("a/b/c.h", "")
161 t.expect_addition("dist/a/b/c.h")
163 t.write("jamroot.jam", "install dist : a/b/c.h : <install-source-root>a ;")
164 t.write("a/b/c.h", "")
167 t.expect_addition("dist/b/c.h")
170 t.write("build/jamroot.jam", """\
171 install dist : ../a/b/c.h : <location>../dist <install-source-root>../a ;
173 t.write("a/b/c.h", "")
175 t.run_build_system(subdir="build")
176 t.expect_addition("dist/b/c.h")
178 t.write("jamroot.jam", "install dist2 : a/b/c.h : <install-source-root>a ;")
179 t.write("a/b/c.h", "")
180 t.write("sub/jamfile.jam", "alias h : ..//dist2 ;")
182 t.run_build_system(subdir="sub")
183 t.expect_addition("dist2/b/c.h")
185 # Test that when installing .cpp files, we do not scan include dependencies.
187 t.write("jamroot.jam", "install dist : a.cpp ;")
188 t.write("a.cpp", '#include "a.h"')
192 t.expect_addition("dist/a.cpp")
197 t.expect_nothing("dist/a.cpp")
199 # Test that <name> property works, when there is just one file in sources.
201 t.write("jamroot.jam", "install dist : a.cpp : <name>b.cpp ;")
202 t.write("a.cpp", "test file")
205 t.expect_addition("dist/b.cpp")