[Scons-users] 答复: 答复: [scons-users] Replacing Builder while perserving Scanner

yangsc yangsc2009 at gmail.com
Mon Jun 16 22:15:22 EDT 2014


Hi Dirk,

 

This is exactly the way I want for my building. By setting the classicCPP-Scanner and my own builder now It can handle the implicit dependency-relation and build with my function.

Thanks a lot.

发件人: Scons-users [mailto:scons-users-bounces at scons.org] 代表 Dirk B?chle
发送时间: 2014年6月15日 22:53
收件人: 'SCons users mailing list'
主题: Re: [Scons-users] 答复: [scons-users] Replacing Builder while perserving Scanner

 

On 15.06.2014 14:56, yangsc wrote:

Thank you,

 

I’v read the scanner object, but my problem is I want to use the default C-Scanner to proceed my ‘.input’ file and I don’t want to write my own scanner because the preprocesser derictive is the same as in C.

 

It seems scons have flexibility to write user’s own scanner, but I just want a way to reuse some already existed scanner for building the dependency graph, and then use my own builder to build the source file into target file.


Thanks a lot for the clarifying comments. I don't see a way to simply re-use the existing CScanner, because it it used in a different context...you want to call your own Builder, and not simply put "*.input" files as sources into a standard Object/Library/Program Builder.
So, the easiest thing for you is probably to use the same approach as the "swig.py" Tool, and add your own Scanner as follows:

    import SCons.Scanner
    env = Environment()
    expr = '^[ \t]*#[ \t]*(?:include|import)[ \t]*(<|")([^>"]+)(>|")'
    scanner = SCons.Scanner.ClassicCPP("MyInputScan", ".input", "CPPPATH", expr)

    env.Append(SCANNERS = scanner)

    ...

Best regards,

Dirk

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://four.pairlist.net/pipermail/scons-users/attachments/20140617/712a8b8e/attachment-0001.html>


More information about the Scons-users mailing list