]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/library_chain.py
8ac2115988d11d7cb368d93e464dcd850e6b25cc
3 # Copyright 2003, 2004, 2005, 2006 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)
7 # Test that a chain of libraries works ok, no matter if we use static or shared
15 t
= BoostBuild
.Tester(use_test_config
=False)
17 # Stage the binary, so that it will be relinked without hardcode-dll-paths.
18 # That will check that we pass correct -rpath-link, even if not passing -rpath.
19 t
.write("jamfile.jam", """\
21 exe main : main.cpp b ;
24 t
.write("main.cpp", """\
29 t
.write("jamroot.jam", "")
31 t
.write("a/a.cpp", """\
44 t
.write("a/jamfile.jam", "lib a : a.cpp ;")
46 t
.write("b/b.cpp", """\
55 t
.write("b/jamfile.jam", "lib b : b.cpp ../a//a ;")
57 t
.run_build_system(["-d2"], stderr
=None)
58 t
.expect_addition("bin/$toolset/debug*/main.exe")
59 t
.rm(["bin", "a/bin", "b/bin"])
61 t
.run_build_system(["link=static"])
62 t
.expect_addition("bin/$toolset/debug/link-static*/main.exe")
63 t
.rm(["bin", "a/bin", "b/bin"])
66 # Check that <library> works for static linking.
67 t
.write("b/jamfile.jam", "lib b : b.cpp : <library>../a//a ;")
69 t
.run_build_system(["link=static"])
70 t
.expect_addition("bin/$toolset/debug/link-static*/main.exe")
72 t
.rm(["bin", "a/bin", "b/bin"])
74 t
.write("b/jamfile.jam", "lib b : b.cpp ../a//a/<link>shared : <link>static ;")
77 t
.expect_addition("bin/$toolset/debug*/main.exe")
79 t
.rm(["bin", "a/bin", "b/bin"])
82 # Test that putting a library in sources of a searched library works.
83 t
.write("jamfile.jam", """\
84 exe main : main.cpp png ;
85 lib png : z : <name>png ;
89 t
.run_build_system(["-a", "-d+2"], status
=None, stderr
=None)
90 # Try to find the "zzz" string either in response file (for Windows compilers),
91 # or in the standard output.
92 rsp
= t
.adjust_names("bin/$toolset/debug*/main.exe.rsp")[0]
93 if os
.path
.exists(rsp
) and ( open(rsp
).read().find("zzz") != -1 ):
95 elif t
.stdout().find("zzz") != -1:
100 # Test main -> libb -> liba chain in the case where liba is a file and not a
101 # Boost.Build target.
104 t
.write("jamroot.jam", "")
105 t
.write("a/jamfile.jam", """\
110 t
.write("a/a.cpp", """\
112 __declspec(dllexport)
117 t
.run_build_system(subdir
="a")
118 t
.expect_addition("a/dist/a.dll")
120 if sys
.platform
== 'win32':
121 # This is a Windows import library.
122 file = t
.adjust_name("a.implib")
124 file = t
.adjust_name("a.dll")
126 t
.write("b/jamfile.jam", "lib b : b.cpp ../a/dist/%s ;" % file)
128 t
.write("b/b.cpp", """\
130 __declspec(dllimport)
134 __declspec(dllexport)
139 t
.write("jamroot.jam", "exe main : main.cpp b//b ;")
141 t
.write("main.cpp", """\
143 __declspec(dllimport)
150 t
.expect_addition("bin/$toolset/debug*/main.exe")