LibTPS uses CMake for cross-platform builds.
Before Compiling:
- Download and install subversion (http://subversion.tigris.org/)
- Download the libtps source via
$ subversion: svn checkout svn+ssh:
- Download and install CMake (http://www.cmake.org/cmake/resources/software.html)
Compiling and Installing:
- Change to the directory in which you want to build libtps
- run CMake (how you do this depends on how you installed CMake)
- Option 1: Run the CMake Application
- Option 2 (*nix): from the command line:
- Option 3 (*nix): from the command line:
$ ccmake path/to/libtps/main/source/directory
Configure the options in CMake and then compile and install the library. By default, the library will install to /usr/local on *nix systems such as linux or OS X.
To use libtps with a C/C++ code first include the libtps header file somewhere in the code.
Then to compile, we use a command something like the following:
This assumes that we have used the default install location /usr/local/. If we specify an install location, we would use a command more like the following:
$ c++ example.cpp -I/my/path/include -L/my/path/lib -ltps
Here, -I specifies a path in which to look for header files and -L specifies a path in which to look for libraries.
Sometimes we need to link with the underlying simulation wrapper. For example, to use LibTPS with LAMMPS, we would use a command like the following
$ mpic++ example.cpp -ltps -llammps
Here, we assume that the name of the LAMMPS library is "lammps" and that libtps.a and liblammps.a live in a globa library search path like /usr/local/lib.
To use LibTPS from python include a line like:
Before Python can find the tps module, you must do one of two things:
- Option 1: install the module files (tps.py tps.pyc _tps.so from {TPS_BUILD_DIR}/lib) in a global python search path (example /Library/Python/2.5/site-packages on OS X).
- Option 2: set the PYTHONPATH variable. See the scripts in the {TPS_BUILD_DIR}/bin folder for help setting the variable. You can set the python path variable by running the scripts before you start python. This can also be automated. For example, in OS X, you can tell bash to automatically run the script by using adding the command
$ source path/to/tps/bin/pythonpath.sh
to the .bash_profile file in your home directory.