Difference between revisions of "Compiling on Linux and Mac OS X"
(major reworking) |
(→Dependencies) |
||
Line 12: | Line 12: | ||
;[http://www.cmake.org CMake] (>=2.4.7) | ;[http://www.cmake.org CMake] (>=2.4.7) | ||
;[http://trolltech.com/products/qt Qt4] (>=4.4.0) | ;[http://trolltech.com/products/qt Qt4] (>=4.4.0) | ||
− | ;[http://eigen.tuxfamily.org/ Eigen2 | + | ;[http://eigen.tuxfamily.org/ Eigen2] (>=2.0_beta3) (more instructions [[#Installing Eigen|below]]) |
;[http://openbabel.org/ OpenBabel] (>=2.2.0) (more instructions [[#Building OpenBabel|below]]) | ;[http://openbabel.org/ OpenBabel] (>=2.2.0) (more instructions [[#Building OpenBabel|below]]) | ||
Revision as of 17:45, 26 December 2008
These instructions are intended to help users 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.
Dependencies
You should be able to find most of these dependencies in your distribution's repositories or as binary downloads for Mac from the homepages linked below. Make sure that you satisfy any version requirement given.
- Subversion
- Git (optional, but recommended)
- CMake (>=2.4.7)
- Qt4 (>=4.4.0)
- Eigen2 (>=2.0_beta3) (more instructions below)
- OpenBabel (>=2.2.0) (more instructions below)
For optional Python console/bindings:
For optional OpenGL shader support:
Installing Eigen2
Obtain the Eigen2 source and enter the eigen2 source directory. Then build using:
mkdir build
cd build
cmake ..
make install # must be run as root or with sudo
Note: If you are either unable or do not want to install Eigen globally you can install in your home directly using:
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
Building OpenBabel
Avogadro makes heavy use of code and features from the OpenBabel chemistry toolbox. Avogadro needs OpenBabel 2.2.0 or more recent. If your distribution does not have a sufficiently recent version you may obtain it by:
svn co https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/branches/openbabel-2-2-x openbabel-2.2
Once you have the source code you can build it using:
./configure
make
make install # must be run as root or with sudo
Note: If you are either unable or do not want to install OpenBabel globally you can install in your home directly using:
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
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
Note:If you are either unable or do not want to install Avogadro globally you can install in your home directory using the following instructions. The instructions assume you have built Eigen and OpenBabel in your home directory.
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
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
avogadro
On Mac OS X Avogadro will be in your Applications folder.
Note: If you've built Avogadro using the directions in the previous section then run Avogadro using:
$HOME/build/avogadro/build/avogadro/src/avogadro