]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/test/library_chain.py
d04f465a4c05ce23b199bf9bd620d0a23dc19412
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
14 t
= BoostBuild
.Tester(use_test_config
=False)
16 # Stage the binary, so that it will be relinked without hardcode-dll-paths.
17 # That will check that we pass correct -rpath-link, even if not passing -rpath.
18 t
.write("jamfile.jam", """\
20 exe main : main.cpp b ;
23 t
.write("main.cpp", """\
28 t
.write("jamroot.jam", "")
30 t
.write("a/a.cpp", """\
43 t
.write("a/jamfile.jam", "lib a : a.cpp ;")
45 t
.write("b/b.cpp", """\
54 t
.write("b/jamfile.jam", "lib b : b.cpp ../a//a ;")
56 t
.run_build_system(["-d2"], stderr
=None)
57 t
.expect_addition("bin/$toolset/debug*/main.exe")
58 t
.rm(["bin", "a/bin", "b/bin"])
60 t
.run_build_system(["link=static"])
61 t
.expect_addition("bin/$toolset/debug/link-static*/main.exe")
62 t
.rm(["bin", "a/bin", "b/bin"])
65 # Check that <library> works for static linking.
66 t
.write("b/jamfile.jam", "lib b : b.cpp : <library>../a//a ;")
68 t
.run_build_system(["link=static"])
69 t
.expect_addition("bin/$toolset/debug/link-static*/main.exe")
71 t
.rm(["bin", "a/bin", "b/bin"])
73 t
.write("b/jamfile.jam", "lib b : b.cpp ../a//a/<link>shared : <link>static ;")
76 t
.expect_addition("bin/$toolset/debug*/main.exe")
78 t
.rm(["bin", "a/bin", "b/bin"])
81 # Test that putting a library in sources of a searched library works.
82 t
.write("jamfile.jam", """\
83 exe main : main.cpp png ;
84 lib png : z : <name>png ;
88 t
.run_build_system(["-a", "-d+2"], status
=None, stderr
=None)
89 # Try to find the "zzz" string either in response file (for Windows compilers),
90 # or in the standard output.
91 rsp
= t
.adjust_names("bin/$toolset/debug*/main.exe.rsp")[0]
92 if os
.path
.exists(rsp
) and ( string
.find(open(rsp
).read(), "zzz") != -1 ):
94 elif string
.find(t
.stdout(), "zzz") != -1:
99 # Test main -> libb -> liba chain in the case where liba is a file and not a
100 # Boost.Build target.
103 t
.write("jamroot.jam", "")
104 t
.write("a/jamfile.jam", """\
109 t
.write("a/a.cpp", """\
111 __declspec(dllexport)
116 t
.run_build_system(subdir
="a")
117 t
.expect_addition("a/dist/a.dll")
119 if ( os
.name
== 'nt' or os
.uname()[0].lower().startswith('cygwin') ) and \
120 BoostBuild
.get_toolset() != 'gcc':
121 # This is a Windows import library -- we know the exact name.
122 file = "a/dist/a.lib"
124 file = t
.adjust_names("a/dist/a.dll")[0]
126 t
.write("b/jamfile.jam", "lib b : b.cpp ../%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")