Versions Compared

Key

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

...

What if you want to make an external library available to all the packages in your release? It would be tedious to modify each new package you develop as in the section above. A better solution is to create an external package that interfaces to your the library. In your release directory, do the following:

...

Code Block
languagepython
titlesconstools_standard_external_package
# Do not delete following line, it must be present in 
# SConscript file for any SIT project
Import('*')
import os
from os.path import join as pjoin
from SConsTools.standardExternalPackage import standardExternalPackage
#
# For the standard external packages which contain includes, libraries, 
# and applications it is usually sufficient to call standardExternalPackage()
# giving some or all parameters.
#
PREFIX = os.path.expanduser('~username/mycode')
INCDIR = "include"
LIBDIR = "lib"
PKGLIBS = "mylib"
standardExternalPackage('MyCode', **locals())

This is the only file that need by in the MyCode package. After doing scons, any package in the release will be able to call functions in mycode by doing

...

INCDIR = os.path.expanduser('~username/mycode/include')
LIBDIR = os.path.expanduser('~username/mycode/lib')

It the external package has Many external packages are more than just a library. They have stand alone programs or tools to run, you . You can add these using the BINDIR parameter.  If an external package like MyCode were to in turn depend on another external package, that package could be defined in the same SConScript file and the DEPS parameter could be used when defining MyCode with standardExternalPackage.. An example of using these options can be seen in SConscript file for the hdf5 package. One can do

...