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