prebuilt.jam

来自「boost库提供标准的C++ API 配合dev c++使用,功能更加强大」· JAM 代码 · 共 54 行

JAM
54
字号
#  Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
#  distribute this software is granted provided this copyright notice appears in
#  all copies. This software is provided "as is" without express or implied
#  warranty, and with no claim as to its suitability for any purpose.

#  This module defines a special generator, which handles targets with
#  <file> property. It allows to use prebuilt targets.

import "class" : new ;
import generators ; 
import feature : feature ;

feature file : : free path ;

class prebuilt-file-generator : generator 
{    
    import feature type errors path ;
    import regex : match ;
    import "class" : new ;
        
    rule __init__ ( )
    {        
        generator.__init__ prebuilt-file-generator : : * : <file> ;    
    }
        
    rule run ( project name ? : property-set : sources * )
    {
        local properties = [ $(property-set).raw ] ;
        local filename = [ feature.get-values <file> : $(properties) ] ;
        local type = [ type.type $(filename) ] ;
        if ! $(type) 
        {
            errors.error "Unknown type for prebuilt target " $(name) in $(project) ;
        }
        
        local t = [ new file-target $(filename:S=:D=) : $(type) : $(project) ] ;
        $(t).set-path [ path.parent $(filename) ] ;
        # By default, Boost.Build determines the suffix of file from its type.
        # Since we already have file, specify suffix explicitly.
        $(t).suffix [ regex.match .(.*) : $(filename:S) ] ;
                               
        $(t).action [ new null-action $(t) : $(property-set) ] ;
        
        $(t).suffix [ MATCH .(.*) : $(name:S) ] ;
        return $(t) ;            
        
    }
}

generators.register [ new prebuilt-file-generator ] ;



⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?