开发者

how can i build a static library from files autogenerated by running a perl script within the SConscript

开发者 https://www.devze.com 2023-02-23 08:04 出处:网络
Here is what i need to do in scons, and at present I\'m not able to get this to work correctly. Firstly I need to run perl script 1.This generates a series of cpp files.

Here is what i need to do in scons, and at present I'm not able to get this to work correctly.

Firstly I need to run perl script 1. This generates a series of cpp files. Then I need to run perl script 2. This generates another series of cpp files. Then I need to take the cpp files that have been created as a result of executing the 2 perl scripts and build a static library from them.

I use a custom builder to execute the perl scripts. I don't want to manually define the target list, as this can change depending on the file that the perl s开发者_如何学Ccripts uses to generate the source files.

ny help would be much appreciated. Thanks, D


For running the perl scripts you just need to use standard python code:

import subprocess
subprocess.call(['perl', ...args...])

For building static lib, try something like this:

env = Environment()
env.StaticLibrary('example', Glob('*.cpp'))

where Glob('*.cpp') generates a list of all .cpp files. If you already have some customized environment just use is instead of env in my sample.

0

精彩评论

暂无评论...
验证码 换一张
取 消