BoccaSimpleDependence

Depending simply on an external library and header.
Fast start
You can specify external libraries and headers (non-SIDL/babel) that your components or classes depend on via make.vars.user. Eventually, setting values in make.vars.user will be possible from the configure script or boccca command line, but for now they must be set manually. Here's how (as of r1097).

You can specify extra compilation flags on any of three scopes:
  • per component.
  • for all components/classes.
  • project wide.

Assume you have created a project X and a c++ component Y in /tmp. The locations of make.vars.user you can customize are:
/tmp/X/make.vars.user
/tmp/X/components/make.vars.user
/tmp/X/components/X.Y/make.vars.user


Generally, you should set flags at the most specific scope applicable.
Edit /tmp/X/components/X.Y/make.vars.user and you will find (among others)
INCLUDES =
LIBS =
CXXFLAGS_USER= $(BOCCA_IO_FLAGS)


Set the includes and libs as you would normally, and if you want to turn off default printing of errors from components for production, delete or comment out the use of BOCCA_IO_FLAGS.
e.g
INCLUDES=-I/opt/pkg/include
LIBS=-L/opt/pkg/lib -lpkgElement
CXXFLAGS_USER=


Detailed explanation
All three make.vars.user files get included in the make when building, from least specific to most.
/tmp/X/make.vars.user ; # project-wide is read first
/tmp/X/components/make.vars.user ; # all components is read next
/tmp/X/components/X.Y/make.vars.user ; is read last as each component is built.

Notes:
  • The variables in the project-side and components/ make.vars.user are prefixed with project_ and components_ respectively. If you redefine the same value in more than one file, the last file's definition wins.
  • Take great care if defining project_LIBS or components_LIBS, as the same libraries will then be linked to all components. This works ok for some dynamic loading scenarios and not others and is often difficult to debug if it goes wrong. If at all possible, a single external library should be wrapped in one class or component for maximum portability.
  • If possible, define linkage to external libtool libraries (.la) rather than directly to binaries (.so, .a).
  • If defining LIBS (or project_LIBS, components_LIBS) to contain .o files, take care that each .o file goes to exactly one component. Otherwise duplicate symbol problems will result at runtime in most cases, which is very often hard to debug.

Created by: baallan last modification: Tuesday 23 of October, 2007 [19:04:37 UTC] by baallan

The original document is available at http://www.cca-forum.org/wiki/tiki-index.php?page=BoccaSimpleDependence