Imported Upstream version 1.72.0
[platform/upstream/boost.git] / tools / check_build / test / Jamfile
1 # Copyright 2017 Peter Dimov
2 #
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
5
6 import modules ;
7 import sequence ;
8 import set ;
9 import project ;
10 import virtual-target ;
11 import testing ;
12 import ac ;
13
14 project : requirements -<link>static ; # from tools/Jamfile
15
16 if "--debug-check-build" in [ modules.peek : ARGV ]
17 {
18     .info-enabled = 1 ;
19 }
20
21 local rule .info ( messages * )
22 {
23     if $(.info-enabled)
24     {
25         ECHO "info:" $(messages) ;
26     }
27 }
28
29 local all-libraries = [ MATCH .*libs/(.*)/build/.* :
30     [ glob ../../../libs/*/build/Jamfile.v2 ]
31     [ glob ../../../libs/*/build/Jamfile ] ] ;
32
33 all-libraries = [ sequence.unique $(all-libraries) ] ;
34
35 # The function_types library has a Jamfile, but it's used for maintenance
36 # purposes, there's no library to build and install.
37
38 all-libraries = [ set.difference $(all-libraries) : function_types ] ;
39
40 #ECHO all-libraries: $(all-libraries) ;
41
42 rule alias-sources-impl ( project name : property-set : sources * )
43 {
44     local target-graph ;
45
46     for local s in $(sources)
47     {
48         target-graph += [ virtual-target.traverse $(s) : include-sources : include-roots ] ;
49     }
50
51     # Remove targets created by the main target
52
53     local result ;
54
55     for local t in $(target-graph)
56     {
57         if [ $(t).root ] && ! ( $(t) in $(sources) ) && ( [ $(t).type ] = STATIC_LIB || [ $(t).type ] = SHARED_LIB )
58         {
59             result += $(t) ;
60         }
61     }
62
63     .info "$(name):" ;
64
65     for local t in $(result)
66     {
67         .info "  " [ $(t).name ] ;
68     }
69
70     return $(result) ;
71 }
72
73 path-constant ROOT : ../../.. ;
74
75 for local lib in $(all-libraries)
76 {
77     local path = [ NORMALIZE_PATH /$(ROOT)/libs/$(lib)/build ] ;
78     generate library-$(lib) : $(path)//stage : <generating-rule>@alias-sources-impl ;
79 }
80
81 for local lib in $(all-libraries)
82 {
83     local python-dep ;
84
85     if $(lib) in python mpi graph_parallel
86     {
87         python-dep = /python//python ;
88     }
89
90     run main.cpp : : : [ ac.check-library library-$(lib) : <library>library-$(lib) <library>$(python-dep) : <build>no ] : $(lib) ;
91 }