]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | #!/usr/bin/python |
2 | ||
11fdf7f2 | 3 | # Copy-paste-modify from zlib.py |
7c673cae FG |
4 | # Copyright (C) 2013 Steven Watanabe |
5 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
6 | # (See accompanying file LICENSE.txt or copy at |
7 | # https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
8 | |
9 | import BoostBuild | |
10 | import MockToolset | |
11 | ||
12 | t = BoostBuild.Tester(arguments=['toolset=mock', '--ignore-site-config', '--user-config='], pass_toolset=0) | |
13 | ||
14 | MockToolset.create(t) | |
15 | ||
7c673cae FG |
16 | # Generic definitions that aren't configuration specific |
17 | common_stuff = ''' | |
18 | source_file('test.cpp', 'test.cpp') | |
19 | source_file('main.cpp', 'int main() {}') | |
11fdf7f2 | 20 | source_file('lzma.h.cpp', '#include <lzma.h>\\n') |
7c673cae FG |
21 | action('-c -x c++ $main.cpp -o $main.o') |
22 | ''' | |
23 | t.write('test.cpp', 'test.cpp') | |
24 | ||
25 | # Default initialization - static library | |
26 | t.rm('bin') | |
27 | t.write("Jamroot.jam", """ | |
28 | path-constant here : . ; | |
11fdf7f2 TL |
29 | using lzma ; |
30 | exe test : test.cpp /lzma//lzma : : <link>static <link>shared ; | |
7c673cae FG |
31 | """) |
32 | ||
33 | MockToolset.set_expected(t, common_stuff + ''' | |
11fdf7f2 TL |
34 | action('$main.o --static-lib=lzma -o $config.exe') |
35 | action('-c -x c++ $lzma.h.cpp -o $lzma.h.o') | |
7c673cae | 36 | action('-c -x c++ $test.cpp -o $test.o') |
11fdf7f2 | 37 | action('$test.o --static-lib=lzma -o $test') |
7c673cae FG |
38 | ''') |
39 | t.run_build_system() | |
40 | t.expect_addition('bin/mock/debug/test.exe') | |
41 | t.expect_addition('bin/mock/debug/link-static/test.exe') | |
42 | ||
43 | # Default initialization - shared library | |
44 | t.rm('bin') | |
45 | t.write("Jamroot.jam", """ | |
46 | path-constant here : . ; | |
11fdf7f2 TL |
47 | using lzma ; |
48 | exe test : test.cpp /lzma//lzma : : <link>static <link>shared ; | |
7c673cae FG |
49 | """) |
50 | ||
51 | MockToolset.set_expected(t, common_stuff + ''' | |
11fdf7f2 TL |
52 | action('$main.o --shared-lib=lzma -o $config.exe') |
53 | action('-c -x c++ $lzma.h.cpp -o $lzma.h.o') | |
7c673cae | 54 | action('-c -x c++ $test.cpp -o $test.o') |
11fdf7f2 | 55 | action('$test.o --shared-lib=lzma -o $test') |
7c673cae FG |
56 | ''') |
57 | t.run_build_system() | |
58 | t.expect_addition('bin/mock/debug/test.exe') | |
59 | t.expect_addition('bin/mock/debug/link-static/test.exe') | |
60 | ||
61 | # Initialization in explicit location - static library | |
62 | t.rm('bin') | |
63 | t.write("Jamroot.jam", """ | |
64 | path-constant here : . ; | |
11fdf7f2 TL |
65 | using lzma : : <name>mylzma <include>$(here)/lzma <search>$(here)/lzma ; |
66 | exe test : test.cpp /lzma//lzma : : <link>static <link>shared ; | |
7c673cae FG |
67 | """) |
68 | ||
11fdf7f2 | 69 | t.write('lzma/lzma.h', 'lzma') |
7c673cae FG |
70 | |
71 | MockToolset.set_expected(t, common_stuff + ''' | |
11fdf7f2 TL |
72 | action('$main.o -L./lzma --static-lib=mylzma -o $config.exe') |
73 | action('-c -x c++ $test.cpp -I./lzma -o $test.o') | |
74 | action('$test.o -L./lzma --static-lib=mylzma -o $test') | |
7c673cae FG |
75 | ''') |
76 | t.run_build_system() | |
77 | t.expect_addition('bin/mock/debug/test.exe') | |
78 | t.expect_addition('bin/mock/debug/link-static/test.exe') | |
79 | ||
80 | # Initialization in explicit location - shared library | |
81 | t.rm('bin') | |
82 | t.write("Jamroot.jam", """ | |
83 | path-constant here : . ; | |
11fdf7f2 TL |
84 | using lzma : : <name>mylzma <include>$(here)/lzma <search>$(here)/lzma ; |
85 | exe test : test.cpp /lzma//lzma : : <link>static <link>shared ; | |
86 | """) | |
87 | ||
88 | MockToolset.set_expected(t, common_stuff + ''' | |
89 | action('$main.o -L./lzma --shared-lib=mylzma -o $config.exe') | |
90 | action('-c -x c++ $test.cpp -I./lzma -o $test.o') | |
91 | action('$test.o -L./lzma --shared-lib=mylzma -o $test') | |
92 | ''') | |
93 | t.run_build_system() | |
94 | t.expect_addition('bin/mock/debug/test.exe') | |
95 | t.expect_addition('bin/mock/debug/link-static/test.exe') | |
96 | ||
97 | # Initialization in explicit location - both static and shared libraries | |
98 | t.rm('bin') | |
99 | t.write("Jamroot.jam", """ | |
100 | path-constant here : . ; | |
101 | using lzma : : <name>mylzma <include>$(here)/lzma <search>$(here)/lzma ; | |
102 | exe test : test.cpp /lzma//lzma | |
103 | : <link>shared:<define>SHARED : <link>static <link>shared ; | |
7c673cae FG |
104 | """) |
105 | ||
106 | MockToolset.set_expected(t, common_stuff + ''' | |
11fdf7f2 TL |
107 | action('$main.o -L./lzma --static-lib=mylzma -o $config.exe') |
108 | action('$main.o -L./lzma --shared-lib=mylzma -o $config.exe') | |
109 | action('-c -x c++ $test.cpp -I./lzma -o $test-static.o') | |
110 | action('-c -x c++ $test.cpp -I./lzma -DSHARED -o $test-shared.o') | |
111 | action('$test-static.o -L./lzma --static-lib=mylzma -o $test') | |
112 | action('$test-shared.o -L./lzma --shared-lib=mylzma -o $test') | |
7c673cae FG |
113 | ''') |
114 | t.run_build_system() | |
115 | t.expect_addition('bin/mock/debug/test.exe') | |
116 | t.expect_addition('bin/mock/debug/link-static/test.exe') | |
117 | ||
118 | t.cleanup() |