Packages

From VLE

Jump to: navigation, search

Contents

Packages

Packages in VLE are autonomous project which regroup source code of DEVS models, VPZ files, documentations and datas. The goal of the packages in VLE are to propose an easily aspect to develop big models and share models between modeler. Package are introduced in VLE 0.8.

VLE 1.1 package update

Since VLE 1.0, packages can now provide shared libraries and plug-ins instead of only plug-ins. Shared libraries must be installed into the 'lib' directory of packages, plug-ins are installed into the 'plugins/simulators' directory.

If you have already developed a package you need to :

1. Update the install directory of your simulators. For example, in your src/CMakeLists.txt file, you need to change the line:

INSTALL(xxx MODULE lib RUNTIME lib ARCHIVE lib)

With:

INSTALL(xxx MODULE plugins/simulator RUNTIME plugins/simulator ARCHIVE
plugins/simulator)

2. Update all your dynamics element in VPZ. With VLE 1.0 the attribute model is not use, you need to remove it and build on plug-ins per class.

To establish a link with an another package, you need to apply several modifications of yours packages.

FindPackage(VleCheckPackage REQUIRED)
  • add the detection of the package you want (always in the root CMakelist.txt):
VleCheckPackage(Xxx package)

The script will assign:

  • Xxx_FOUND to '1' of the package is founded in VLE_HOME.
  • Xxx_INCLUDE_DIRS to VLE_HOME/pkgs/package/src
  • Xxx_LIBRARIES to the list of file founded into the VLE_HOME/pkgs/package/lib/ directory.

Home of VLE

The home directory of VLE is defined by the environment variable VLE_HOME. If the environment variable is not defined, VLE use the default path:

  • $HOME/.vle on Unix/Linux systems (eg. /home/user/.vle).
  • $HOME/vle on Win32 systems which corresponds to the variables: %HOMEDRIVE%%HOMEPATH%\vle (eg. c:\\documents and settings\\user\\vle).

The home directory of VLE have the following hierarchy:

$VLE_HOME
 ├─ pkgs           ; the directory of VLE's packages
 │   └─ firemanqss ; an example of paquet: firemanqss.
 │       ├─ build  ; One directory per package.
 │       ├─ data
 │       ├─ doc
 │       ├─ exp
 │       ├─ lib
 │       └─ src
 └─ vle.log        ; log of previous execution of VLE

If you wan to use packages with VLE, GVLE etc. you need to copy or link the directory into the $VLE_HOME/pkgs directory. For example, on Linux/Unix systems:

# We have the source of the package in the </tt>$HOME/git</tt> directory:
cd $HOME/git
git clone git://www.vle-project.org/git/firemanqss.git
 
# We link the directory of the package into the $VLE_HOME/pkgs directory:
cd $VLE_HOME/pkgs
ln -s $HOME/git/firemanqss

Hierarchy of the package

A package or project in VLE have several directory and sub-directory. Each file and directory are important. The following description is a default package in provide in VLE:

$VLE_HOME/pkgs/firemanqss
 ├─ build          ; the compilation directory (temporary directory)
 ├─ cmake          ; cmake scripts
 ├─ data           ; data of your package
 ├─ doc            ; documentation of your package
 ├─ exp            ; experience, ie. vpz, of your package
 ├─ lib            ; shared library directory (shared between packages) (temporary directory)
 ├─ plugins        ; simulators, modeling plugins
 ├─ src            ; models' sources of your package
 ├─ Authors.txt    ; authors of your package
 ├─ License.txt    ; license of your package
 ├─ News.txt       ; news about evolution of your package
 ├─ Readme.txt     ; some notes about your package
 └─ CMakeList.txt  ; a CMake script

Howto use VLE with packagesUtilisation de VLE avec un projet

The key, in command line interface:

vle -P name_of_the_directory [command] files ....

Commands are:

  • create to build a new package in the VLE_HOME/pkgs
  • configure try to run the CMake program in your package.
  • build try to compile your package.
  • test try the unit test of your package if they exist.
  • packages try to build source and binary Zip of your package.
  • depends show the depends of your packages.
  • list lists all Vpz and plugins of your packages.
  • vle -P firemanqss configure
    • execute in the build directory, the cmake command.
    • this command is equivalent to:
cd $VLE_HOME/pkgs/firemanqss
mkdir build
cmake -DCMAKE_INSTALL_PREFIX=$VLE_HOME/pkgs/firemanqss -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
  • vle -P firemanqss build
    • execute in the build directory, the make command.
    • execute in the src, the make install command.
    • this command is equivalent to:
cd $VLE_HOME/pkgs/firemanqss/build
make all
cd $VLE_HOME/pkgs/firemanqss/build/src
make install
  • vle -P firemanqss list
    • this command is equivalent to:
ls -1 $VLE_HOME/pkgs/firemanqss/lib/*.so
ls -1 $VLE_HOME/pkgs/firemanqss/exp/*.vpz
  • vle --package firemanqss package
    • build a source and binary zip file into the build directory.
    • this command is equivalent to:
cd $VLE_HOME/pkgs/firemanqss/build
make package package_source
  • vle -P firemanqss firemanqss.vpz
    • Execute the simulation
vle --package firemanqss firemanqss.vpz
vle --package firemanqss firemanqss.vpz firemanqss2.vpz
    • Execute the manager into 4 threads
vle -m -o 4 --package firemanqss firemanqss.vpz

Création de paquets sources et binaires

  • La création des paquets sources et binaires est à la charge du programme CPack. Le but de ces paquets est double :
    • Fournir un moyen simple de s'échanger des modèles ;
    • Préparer la plate-forme VLE à disposer d'un dépôt de modèles.

Notes API

  • We provide, in the vle::devs::Dynamics class, a set of functions to access files in the current package or in external package.
std::string getPackageDir() const;
std::string getPackageLibDir() const;
std::string getPackageSrcDir() const;
std::string getPackageDataDir() const;
std::string getPackageDocDir() const;
std::string getPackageExpDir() const;
std::string getPackageBuildDir() const;
std::string getPackageFile(const std::string& name) const;
std::string getPackageLibFile(const std::string& name) const;
std::string getPackageSrcFile(const std::string& name) const;
std::string getPackageDataFile(const std::string& name) const;
std::string getPackageDocFile(const std::string& name) const;
std::string getPackageExpFile(const std::string& name) const;
 
std::string getExternalPackageDir() const;
std::string getExternalPackageLibDir() const;
std::string getExternalPackageSrcDir() const;
std::string getExternalPackageDataDir() const;
std::string getExternalPackageDocDir() const;
std::string getExternalPackageExpDir() const;
std::string getExternalPackageBuildDir() const;
std::string getExternalPackageFile(const std::string& name) const;
std::string getExternalPackageLibFile(const std::string& name) const;
std::string getExternalPackageSrcFile(const std::string& name) const;
std::string getExternalPackageDataFile(const std::string& name) const;
std::string getExternalPackageDocFile(const std::string& name) const;
std::string getExternalPackageExpFile(const std::string& name) const;
  • Example:
// To get the complete path of the current package
getPackageDataDir(); // returns "$VLE_HOME/pkgs/<name>/data"
 
// To get a file in the data directory of the current package:
getPackageDataFile("file.dat"); // returns "$VLE_HOME/pkgs/<name>/data/file.dat"
This page was last modified on 18 November 2011, at 16:58. This page has been accessed 409 times.