| 1 | import feature : feature ;
|
|---|
| 2 | import project ;
|
|---|
| 3 | import "class" : new ;
|
|---|
| 4 | import targets ;
|
|---|
| 5 | import property-set ;
|
|---|
| 6 | import common ;
|
|---|
| 7 | import type ;
|
|---|
| 8 | import toolset : flags ;
|
|---|
| 9 |
|
|---|
| 10 | # Make this module into a project.
|
|---|
| 11 | project.initialize $(__name__) ;
|
|---|
| 12 | project boost ;
|
|---|
| 13 |
|
|---|
| 14 | if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
|
|---|
| 15 | {
|
|---|
| 16 | .debug-configuration = true ;
|
|---|
| 17 | }
|
|---|
| 18 |
|
|---|
| 19 | rule initialized ( )
|
|---|
| 20 | {
|
|---|
| 21 | return $(.initialized) ;
|
|---|
| 22 | }
|
|---|
| 23 |
|
|---|
| 24 |
|
|---|
| 25 | rule isEnabled ( )
|
|---|
| 26 | {
|
|---|
| 27 | return $(.enabled) ;
|
|---|
| 28 | }
|
|---|
| 29 |
|
|---|
| 30 | rule isDebug ( )
|
|---|
| 31 | {
|
|---|
| 32 | return $(.debug-configuration) ;
|
|---|
| 33 | }
|
|---|
| 34 |
|
|---|
| 35 | rule 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.
|
|---|
| 43 | rule 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 |
|
|---|
| 91 | alias regexp
|
|---|
| 92 | : # source
|
|---|
| 93 | : # requirements
|
|---|
| 94 | : # default-build
|
|---|
| 95 | : # usage-requirements
|
|---|
| 96 | <conditional>@usage-requirements
|
|---|
| 97 | ;
|
|---|
| 98 |
|
|---|
| 99 |
|
|---|
| 100 | rule 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 | }
|
|---|