Adding plugin to the source tree

From Yade

Scons is the program used to build yade. It scans source files when run and decides what should be compiled.

  • Decide in which package your plugin should be put (pkg/dem, pkg/fem, pkg/common, ...). You may want to keep the organization in DataClass, Engine, PreProcessor etc., but it is not necessary.
    • Adding things to core/ and lib/ should be approved on yade-dev. The procedure is different there.
    • You may put your files to extra/, but there you have to specify by hand how to compile them, in extra/SConscript.
  • Do bzr add myPlugin.cpp myPlugin.hpp so that your plugin appers in the BZR repository after commit.
  • Make sure that your file contains:
    • YADE_PLUGIN((ClassName1)(ClassName2)...) which lists all classes that can be instantiated in your plugin by the class factory (classes that are not saved to XML and are always used only from c++ don't have to be registered in this way)
    • If you require some features (see scons -h), put somewehre to the .cpp file YADE_REQUIRE_FEATURE(PYTHON) or similar. If the feature is not present, your plugin will not be built.
    • Don't include yade haders using #include"FileName.hpp", always use #include<yade/pkg-something/FileName.hpp>; the conventional exception is #include"myPlugin.hpp" inside myPlugin.cpp. We scan #include lines to figure out to which other plugins your plugin must be linked to after compilation.
  • Run scons, your plugin should be compiled and installed, in this case into /usr/local/lib/yade-svn1144/pkg-deb/ (depending on $PREFIX and $SUFFIX). If you run yade, it should find your plugin without any adjustments.
    • If you use linkStrategy=monolithic, the plugin will not be in a separate file.
  • bzr commit