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