Versions Compared

Key

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

...

While targets in packageA that use mylib can now be built correctly, to run them you will need to make sure that the operating system can find the shared object library mylib.  This is done by setting the environment variable LD_LIBRARY_PATH to include the directory where mylib is located. This could be done in the shell initialization file (such as .bashrc, or .cshrc, depending on which shell you use). 

Using a Library through the External Package Mechanism

note, this section is still in progress

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 library. In your release directory, do the following:

newpkg MyCode

edit the file

~/release/MyCode/SConscript

This SConscript calls the funciton standardSConscript(), but this is not what we want. Change the file to look like:

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"
standardExternalPackage('MyCode', **locals())

After doing scons, any package in the release will be able to call functions in mycode by doing

#include "MyCode/myheader.h"Need to add this section

Building Part of the Release

...