Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/tools/build/v2/test/library_chain.py @ 12

Last change on this file since 12 was 12, checked in by landauf, 17 years ago

added boost

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1#!/usr/bin/python
2
3#  Copyright (C) Vladimir Prus 2003. Permission to copy, use, modify, sell and
4#  distribute this software is granted provided this copyright notice appears in
5#  all copies. This software is provided "as is" without express or implied
6#  warranty, and with no claim as to its suitability for any purpose.
7
8#  Test that a chain of libraries work ok, not matter if we use static or
9#  shared linking.
10from BoostBuild import Tester, List
11import string
12
13t = Tester()
14
15t.write("Jamfile", """
16# Stage the binary, so that it will be relinked
17# without hardcode-dll-paths. That will chech that
18# we pass correct -rpath-link, even if not passing
19# -rpath.
20stage dist : main ;
21exe main : main.cpp b ;
22""")
23
24t.write("main.cpp", """
25void foo();
26
27int main() { foo(); return 0; }
28
29""")
30
31t.write("project-root.jam", """
32""")
33
34t.write("a/a.cpp", """
35void
36#if defined(_WIN32)
37__declspec(dllexport)
38#endif
39gee() {}
40void
41#if defined(_WIN32)
42__declspec(dllexport)
43#endif
44geek() {}
45""")
46
47t.write("a/Jamfile", """
48lib a : a.cpp ;
49""")
50
51t.write("b/b.cpp", """
52void geek();
53
54void
55#if defined(_WIN32)
56__declspec(dllexport)
57#endif
58foo() { geek(); }
59
60""")
61
62t.write("b/Jamfile", """
63lib b : b.cpp ../a//a ;
64""")
65
66t.run_build_system(stderr=None)
67t.expect_addition("bin/$toolset/debug/main.exe")
68t.rm(["bin", "a/bin", "b/bin"])
69
70t.run_build_system("link=static")
71t.expect_addition("bin/$toolset/debug/link-static/main.exe")
72t.rm(["bin", "a/bin", "b/bin"])
73
74# Check that <library> works for static linking.
75
76t.write("b/Jamfile", """
77lib b : b.cpp : <library>../a//a ;
78""")
79t.run_build_system("link=static")
80t.expect_addition("bin/$toolset/debug/link-static/main.exe")
81
82t.rm(["bin", "a/bin", "b/bin"])
83t.write("b/Jamfile", """
84lib b : b.cpp ../a//a/<link>shared : <link>static ;
85""")
86
87t.run_build_system()
88t.expect_addition("bin/$toolset/debug/main.exe")
89t.rm(["bin", "a/bin", "b/bin"])
90
91# Test that putting library in sources of a searched library
92# works.
93t.write("Jamfile", """
94exe main : main.cpp png ;
95lib png : z : <name>png ;
96lib z : : <name>zzz ;
97""")
98t.run_build_system("-a -n -d+2")
99t.fail_test(string.find(t.stdout(), "zzz") == -1)
100
101
102
103t.cleanup()
Note: See TracBrowser for help on using the repository browser.