0

Let's say I have two SConscripts:

SConstruct
  SConscript a
  SConscript b

SConscript a generates a pkg-config file (for something foreign which has none). I have an alias for this (substitution, installing etc.), pkg_alias. SConscript b invokes env.ParseConfig(...) and builds app, and therefore it's important that the file already was generated (otherwise pkg-config would complain).

So what I need is a dependency like this: app -> parse -> pkg_alias.

Is it possible to express this?

Like subdir_env.Depends(subdir_env, 'pkg_alias') when subdir_env is the one that attempts to ParseConfig.

wal-o-mat
  • 7,158
  • 7
  • 32
  • 41

1 Answers1

0

Im assuming this

app -> parse -> pkg_alias

means that app depends on parse, and parse depends on pkg_alias.

If you are calling pkg-config via the Command() builder, then SCons will create a target for it that can be used for dependencies. The problem is that I dont think you can make ParseConfig() depend on the pkg-config target, since ParseConfig() is executed before any targets are built. Actually the SConstruct and all SConscript's are evaluated before building any targets.

Instead, you could call pkg-config directly via Python without using the Command() builder, then call ParseConfig() all before building the targets. Then the app will be built according to what is in the env.

Just in case, you can get everything in the same env as follows:

Invoke the SConscript's with the SConscript() function. When you do this, you can create an Environment in the SConstruct and export it to the SConscripts as follows:

SConstruct

env = Environment()
SConscript('suba/SConscript', exports='env', duplicate=0)
SConscript('subb/SConscript', exports='env', duplicate=0)

suba/Sconscript

Import('env')

Then, anything you do in any of the scripts will be done on the same environment.

Brady
  • 10,207
  • 2
  • 20
  • 59
  • Ok, I see the problem: `ParseConfig` is executed before the first target is built, and since building the file `pkg-config` depends on *is* a target, this will fail. I think I try your recommendation to make this a target via the `Command` builder, but I'm not sure how to modify the environment within this. I will try tomorrow. – wal-o-mat Jun 05 '13 at 21:04