Difference between revisions of "Compiling on Linux and Mac OS X"
m (→Building Avogadro) |
m (→Building Avogadro) |
||
Line 114: | Line 114: | ||
cd $HOME/build/avogadro | cd $HOME/build/avogadro | ||
cmake \ | cmake \ | ||
− | -DOPENBABEL2_INCLUDE_DIR=$HOME/src/openbabel/include \ | + | -DOPENBABEL2_INCLUDE_DIR=$HOME/src/openbabel-2.2/include \ |
− | -DOPENBABEL2_LIBRARIES=$HOME/src/openbabel/src/.libs/libopenbabel.so \ | + | -DOPENBABEL2_LIBRARIES=$HOME/src/openbabel-2.2/src/.libs/libopenbabel.so \ |
-DOPENBABEL2_VERSION_MET=true $HOME/src/avogadro | -DOPENBABEL2_VERSION_MET=true $HOME/src/avogadro | ||
make -j3 | make -j3 |
Revision as of 16:57, 26 December 2008
These instructions are inteded to help users to build Avogadro from the latest code. Be aware that Avogadro may fail to build or work properly at any given time when built using the instructions below.
For the adventurous, there are also Windows Visual Studio 2008 instructions that may or may not work.
Generally, users should first try the binary installers or packages available on the download page, made using a released version of Avogadro.
Contents
Dependencies
It is likely that Subversion, Git, CMake and Qt4 will be available from your distribution's repositories, or in binary form on the Mac.
How should I install Avogadro?There are two different ways to install Avogadro, depending on your needs and your user privileges. If you have superuser rights and want to provide Avogadro for all users on your computer, choose Method A to install Avogadro globally (to /usr/local). |
Method A: Install Avogadro for all users
Installing Eigen
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2
cd eigen2
mkdir build
cd build
cmake ..
make install # must be run as root or with sudo
Building OpenBabel
Avogadro makes heavy use of code and features from the OpenBabel chemistry toolbox. To ensure you have the latest OpenBabel code you should build it from the code repository. It is sufficient to use OpenBabel 2.2.0 or more recent:
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
cd openbabel
./configure
make
make install # must be run as root or with sudo
Building Avogadro
Avogadro's version control system is now Git, with hosting provided by GitHub. If you would rather not install Git it is possible to download a tar or zip file containing the latest sources from here by clicking on the download link. Generally you will want to clone the git repository,
git clone git://github.com/cryos/avogadro.git
cd avogadro
mkdir build
cd build
cmake ..
make -j3
make install # must be run as root or with sudo
Running
avogadro
On Mac OS X Avogadro will be in your Applications folder.
Method B: Install Avogadro into your home diretory
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.
Setting up the Environment
If you set these environment variables Avogadro and 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". All of them are optional, if they are installed then there is no need to set any environment variables.
export AVOGADRO_PLUGINS=$HOME/build/avogadro/libavogadro/src #Avogadro Plugins
export BABEL_LIBDIR=$HOME/src/openbabel/src/formats/.libs:$HOME/src/openbabel/src/formats/xml/.libs #Openbabel Formats
export BABEL_DATADIR=$HOME/src/openbabel/data #Openbabel Data Files
Installing Eigen
cd $HOME/src
svn co svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2 eigen2
cd eigen2
mkdir $HOME/build/eigen2
cd $HOME/build/eigen2
cmake $HOME/src/eigen2
make -j3
Building OpenBabel
This will build the relatively stable 2.2 branch 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
#svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/trunk openbabel # You could also use the trunk, but trunk is quite unstable and not necessary at the moment
cd openbabel-2.2
./configure
make -j3
Building Avogadro
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 $HOME/src/avogadro
make -j3
Running
$HOME/svn/avogadro/build/avogadro/src/avogadro