source: nscp/bjam/boost.jam @ 3d782f8

0.4.00.4.10.4.2stable
Last change on this file since 3d782f8 was 1ff950c, checked in by Michael Medin <michael@…>, 4 years ago

Fixed build environment to work better (stand alone)

  • Property mode set to 100644
File size: 2.4 KB
Line 
1import feature : feature ;
2import project ;
3import "class" : new ;
4import targets ;
5import property-set ;
6import common ;
7import type ;
8import toolset : flags ;
9
10# Make this module into a project.
11project.initialize $(__name__) ;
12project boost ;
13
14if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
15{
16   .debug-configuration = true ;
17}
18
19rule initialized ( )
20{
21    return $(.initialized) ;
22}
23
24
25rule isEnabled ( )
26{
27    return $(.enabled) ;
28}
29
30rule isDebug ( )
31{
32    return $(.debug-configuration) ;
33}
34
35rule printEnv ( )
36{
37        echo "BOOST LIBRARIES : $(.libraries) change with --with-boost-lib=<path>" ;
38        echo "BOOST HEADERS : $(.headers) change with --with-boost=<path>" ;
39}
40
41
42# Initialize boost support.
43rule init (
44    version ? :
45    headers         # Location of header files
46    libraries *     # Location of libraries, lib and bin subdirs of STLport.
47    )
48{
49
50        if $(.initialized)
51        {
52                errors.error "Attempt the reinitialize boost!" ;
53        }
54        else
55        {
56                .initialized = true ;
57
58                .libraries = $(libraries) ;
59                .headers = $(headers) ;
60               
61            local project = [ project.current ] ;
62               
63                local has-boost = [ MATCH "^--with-boost=(.*)" : [ modules.peek : ARGV ] ] ;
64                local has-generic-hdr = [ MATCH "^--include-path=(.*)" : [ modules.peek : ARGV ] ] ;
65                if $(has-boost) {
66                        .headers = $(has-boost) ;
67                } else if $(has-generic-hdr) {
68                        .headers = $(has-generic-hdr) ;
69                }
70                local has-boost-lib = [ MATCH "^--with-boost-lib=(.*)" : [ modules.peek : ARGV ] ] ;
71                local has-generic-lib = [ MATCH "^--library-path=(.*)" : [ modules.peek : ARGV ] ] ;
72                if $(has-boost-lib) {
73                        .libraries = $(has-boost-lib) ;
74                } else if $(has-generic-lib) {
75                        .libraries = $(has-generic-lib) ;
76                }
77               
78                import toolset : flags ;
79
80                if ( ( --with-boost in  [ modules.peek : ARGV ] ) || $(has-boost) || $(has-boost-lib) ) 
81                        && ! ( --without-boost in  [ modules.peek : ARGV ] ) {
82                        .enabled = true ;
83                } else {
84                        .enabled = false ;
85                }
86                               
87                project.pop-current ;
88        }
89}
90
91alias regexp
92        : # source
93        : # requirements
94        : # default-build
95        : # usage-requirements
96                <conditional>@usage-requirements
97        ;
98
99
100rule usage-requirements ( properties * )
101{
102        local result ;
103        if ( $(.enabled) = true ) {
104                result += <define>USE_BOOST ;
105                result += <include>$(.headers) ;
106                result += <library-path>$(.libraries) ;
107        }
108        return $(result) ;
109}
Note: See TracBrowser for help on using the repository browser.