next up previous
Next: Modeling and simulation with Up: A Discrete EVent system Previous: About this manual

Building and Installing

The Adevs package is organized into the following directory structure:
adevs-x.y.z
           +->docs
           +->examples
           +->include
           +->src
           +->test
           +->util
The Adevs package consists almost entirely of template classes, and these are implemented entirely within the header files located in the include directory. The only exceptions to this are the random number generators, the Java language bindings, and some rarely used aspects of the parallel simulation engine. Therefore, if you do not want to use these features, its sufficient for your program to simply include adevs.h and, of course, to make sure that your compiler can find the include directory that adevs.h is in.

If you do want to use features not implemented in the header files, then a static library that containing these additional features needs to be built and, if desired, you will need to build the Java libraries. To do this, start by entering the src directory. To build the Adevs library, which contains the random number generator and some features used by the parallel simulator, execute the command 'make' (if you are using a *nix type system) or 'build' if you are using Windows. For Windows, the batch file will create a static link library called adevs.lib. For *nix type systems, the makefile will create a static link library called libadevs.a.

If you are building on a Windows system, make sure that you execute the batch file from the Visual C++ command prompt. This will ensure the batch file can find the compiler, linker, etc. For *nix type systems, make sure you have installed a recent version of the GNU C++ compiler and make. You may need to edit the makefile (i.e., the file Makefile) to set compiler flags, etc. though the defaults should work in most cases.

To build the Java language bindings, you need to have the Sun (now Oracle?) JDK installed or something that is compatible with it. On a Windows system, from the src directory enter the adevs_jni directory and then execute the command 'build'. This will create three files: adevs.jar, java_adevs.dll, and java_adevs.lib. To build and run your Java programs, you will need to put adevs.jar into your classpath and java_adevs.lib into your java.library.path (or make sure it is in your regular PATH for finding executables and dynamic link libraries).

On a *nix type system, stay in the src directory and execute the command 'make java_adevs'. This will create two files: adevs.jar and libjava_adevs.so. As before, you need to put adevs.jar into your classpath and libjava_adevs.so into your java.library.path or make sure it is in your regular LD_LIBRARY_PATH (or whatever you use) for locating dynamic link libraries.

If you want to run the test suite (which is in no way required to use the software), then first you need to build the library file and install Tcl (the test scripts need Tcl to run; if you can run `tclsh' then you already have a working copy of Tcl). If you want to test the Java bindings, you will need to build those too. There are three sets of tests that can be executed: one for the serial simulation engine, one for the parallel simulation engine, and one for the Java language bindings. To run the basic set of tests for the serial simulation engine, use 'make check_cpp'. To run those tests and the ones for the serial engines use 'make check_par'. To run the Java test cases, use 'make java_test'. You can run all of these test by simply executing 'make'. The makefile will abort as soon as any test fails or (more likely) run to completion and thereby indicate that all of the tests were passed.

The test cases can be a bit of a bear to run on a Windows computer. If you need to edit compiler settings, executable directives, etc. to make it work, then modify the file make.common. For *nix type systems using the GNU tools the test cases should work out of the box. Otherwise, edit make.common to fix things for your development environment.


next up previous
Next: Modeling and simulation with Up: A Discrete EVent system Previous: About this manual
rotten 2011-01-23