Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

No Format
def generate(env, **kw):
    if not kw.get('depsOnly', 0):
        env.Tool('addLibrary', library = ['libA'])
    env.Tool('someOtherPackageLib')
    env.Tool('addLibrary', library = env['xercesLibs'])

def exists(env):
    return 1

Both these python functions need to exist at all times. The second of these functions is for features currently not used by use so it should always be specified as shown. The first function is what creates the recursive computation of library dependencies. The first line of in the function if statement adds libA to the dependencies. The second (and more if needed) add . This line is put inside an if statement that determines if it should be added or not. The reason for this is that the dependencies of libA to other libraries created by other packages. These must be DIRECT dependencies to keep computation fast. Unnecessary listings will slow SCons down considerably. The last line of the function lists one (or more, if needed) external libraries that libA depends on DIRECTLYneed to be specified when libA is created. However, when libA is being created we can't specify that it should include libA. This would create a recursive dependency. As a result, when we want to build libA and we want to catch all the dependencies we call this function but pass an additional argument setting depsOnly = 1 so that the recrusive dependency isn't created. The second (and more if needed) add the dependencies of libA to other libraries created by other packages. These must be DIRECT dependencies to keep computation fast. Unnecessary listings will slow SCons down considerably. The last line of the function lists one (or more, if needed) external libraries that libA depends on DIRECTLY.

As stated above, when we create libA we want to link all of libA's dependencies into libA without creating a recursive dependency. In order to achieve this, we added that if statement around the addition of libA to the link line. In our SConscript file, prior to creating libA we add the dependencies with this line

No Format

libEnv.Tool('myPackageLib', depsOnly = 1)

This is identical to the example below when we want to link in libraries into the application. The only difference is that when we create libA we don't want to link in libA so we add the extra argument of depsOnly = 1.
TODO: Currently there's no way to specify which library created by a single package we wish to use. This feature will be added at a later stage since the problem has not arisen yet in ScienceTools.

...