]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/test/libjpeg.py
import new upstream nautilus stable release 14.2.8
[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.
5# (See accompanying file LICENSE_1_0.txt or copy at
6# http://www.boost.org/LICENSE_1_0.txt)
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
47# Default initialization - static library
48t.rm('bin')
49t.write("Jamroot.jam", """
50path-constant here : . ;
51using libjpeg ;
52exe test : test.cpp /libjpeg//libjpeg : : <link>static <link>shared ;
53""")
54
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''')
61t.run_build_system()
62t.expect_addition('bin/mock/debug/test.exe')
63t.expect_addition('bin/mock/debug/link-static/test.exe')
64
65# Default initialization - shared library
66t.rm('bin')
67t.write("Jamroot.jam", """
68path-constant here : . ;
69using libjpeg ;
70exe test : test.cpp /libjpeg//libjpeg : : <link>static <link>shared ;
71""")
72
73MockToolset.set_expected(t, common_stuff + '''
74action('$main.o --shared-lib=jpeg -o $config.exe')
75action('-c -x c++ $jpeg.h.cpp -o $jpeg.h.o')
76action('-c -x c++ $test.cpp -o $test.o')
77action('$test.o --shared-lib=jpeg -o $test')
78''')
79t.run_build_system()
80t.expect_addition('bin/mock/debug/test.exe')
81t.expect_addition('bin/mock/debug/link-static/test.exe')
82
83# Initialization in explicit location - static library
84t.rm('bin')
85t.write("Jamroot.jam", """
86path-constant here : . ;
87using libjpeg : : <name>mylibjpeg <include>$(here)/libjpeg <search>$(here)/libjpeg ;
88exe test : test.cpp /libjpeg//libjpeg : : <link>static <link>shared ;
89""")
90
11fdf7f2 91t.write('libjpeg/jpeglib.h', 'libjpeg')
7c673cae
FG
92
93MockToolset.set_expected(t, common_stuff + '''
94action('$main.o -L./libjpeg --static-lib=mylibjpeg -o $config.exe')
95action('-c -x c++ $test.cpp -I./libjpeg -o $test.o')
96action('$test.o -L./libjpeg --static-lib=mylibjpeg -o $test')
97''')
98t.run_build_system()
99t.expect_addition('bin/mock/debug/test.exe')
100t.expect_addition('bin/mock/debug/link-static/test.exe')
101
102# Initialization in explicit location - shared library
103t.rm('bin')
104t.write("Jamroot.jam", """
105path-constant here : . ;
106using libjpeg : : <name>mylibjpeg <include>$(here)/libjpeg <search>$(here)/libjpeg ;
107exe test : test.cpp /libjpeg//libjpeg : : <link>static <link>shared ;
108""")
109
110MockToolset.set_expected(t, common_stuff + '''
111action('$main.o -L./libjpeg --shared-lib=mylibjpeg -o $config.exe')
112action('-c -x c++ $test.cpp -I./libjpeg -o $test.o')
113action('$test.o -L./libjpeg --shared-lib=mylibjpeg -o $test')
114''')
115t.run_build_system()
116t.expect_addition('bin/mock/debug/test.exe')
117t.expect_addition('bin/mock/debug/link-static/test.exe')
118
119t.cleanup()