David
David

Reputation: 1

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

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 scripts uses to generate the source files.

ny help would be much appreciated. Thanks, D

Upvotes: 0

Views: 371

Answers (1)

pajton
pajton

Reputation: 16246

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.

Upvotes: 0

Related Questions