Building:Development Version
From Avogadro - Free cross-platform molecule editor
Contents |
Building Source Code
The following instructions are intended for users who wish to develop Avogadro. If you simply wish to build a copy of Avogadro for yourself, please see separate instructions for:
Linux
These steps are designed to allow you build Avogadro without having to install ('make install') the dependencies. For the purposes of this example we check out all entries to $HOME/src.
Optional Development Tools
There are a few development tools you might like to use in order to make development a little easier and quicker. The first is colorgcc, which is a nice Perl script that adds some color to GCC output when compiling Avogadro. The second program you should really consider is ccache, as developers we often recompile the same objects again and again. The ccache program can greatly increase the speed of recompilation by caching these object files.
Many Linux distributions will package these useful utilities and they can make both spotting the GCC errors, and recompilation, much faster. Assuming colorgcc has its symlinks in /usr/lib/colorgcc/bin/ and ccache has its in /usr/lib64/ccache/bin/ adding the following to your .bashrc will ensure they are both used. You must run CMake after these environment variables have been set to ensure they are used.
export PATH="/usr/lib/colorgcc/bin/:/usr/lib64/ccache/bin/:${PATH}"
Setting up the Environment
Avogadro searches relative to the binary location, and you can also set the environment variable AVOGADRO_PLUGINS if you want to hard code the plugin directory location. By setting these environment variables OpenBabel will use special directories for runtime plugin loading. Avogadro will search the subdirectories colors, engines, extensions and tools for suitable plugins. The environment variables can point to multiple directories separated by colons, i.e. "$HOME/.avogadro/plugins:/usr/local/lib/avogadro".
Openbabel Formats
export BABEL_LIBDIR=$HOME/src/openbabel-2.2/src/formats/.libs:$HOME/src/openbabel-2.2/src/formats/xml/.libs
Openbabel Data Files
export BABEL_DATADIR=$HOME/src/openbabel/data
Dependencies
Building Eigen2 (Optional)
cd $HOME/src
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2 eigen2
Building Openbabel (Optional)
This will build the TRUNK version of OpenBabel and allow you to use OpenBabel from the build directory rather than having to install it.
cd $HOME/src
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
cd openbabel-2.2
./configure
make -j3
Building Avogadro
For more details on working with Git, GitHub and contibuting patches please see Working_With_Git.
cd $HOME/src
git clone git://github.com/cryos/avogadro.git
mkdir $HOME/build/avogadro
cd $HOME/build/avogadro
cmake \
-DOPENBABEL2_INCLUDE_DIR=$HOME/src/openbabel-2.2/include \
-DOPENBABEL2_LIBRARIES=$HOME/src/openbabel-2.2/src/.libs/libopenbabel.so \
-DOPENBABEL2_VERSION_MET=true \
-DEIGEN2_INCLUDE_DIR=$HOME/src/eigen2 \
$HOME/src/avogadro
make -j3
Running
$HOME/build/avogadro/bin/avogadro