Difference between revisions of "Compiling on Linux and Mac OS X"
(The binary is now in the bin directory in the build location) |
(Updated the Eigen dep) |
||
Line 10: | Line 10: | ||
;[http://www.cmake.org CMake] (>=2.6.0) | ;[http://www.cmake.org CMake] (>=2.6.0) | ||
;[http://trolltech.com/products/qt Qt4] (>=4.4.0) | ;[http://trolltech.com/products/qt Qt4] (>=4.4.0) | ||
− | ;[http://eigen.tuxfamily.org/ Eigen2] (=2. | + | ;[http://eigen.tuxfamily.org/ Eigen2] (>=2.0) (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 08:19, 30 April 2009
These instructions are intended to help users and contributors 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, although building on Windows is much more problematic.
Generally, if you do not need the latest Avogadro features and are not interested in developing Avogadro, you should first try the binary installers or packages available on the download page. These are built using a released version of Avogadro which has received more testing than the current head of Git at any given moment.
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. Be careful to satisfy the version requirements.
- Git (optional, but recommended)
- CMake (>=2.6.0)
- Qt4 (>=4.4.0)
- Eigen2 (>=2.0) (more instructions below)
- OpenBabel (>=2.2.0) (more instructions below)
For the optional Python console/bindings:
For optional OpenGL shader support:
Installing Eigen2
You can obtain the Eigen2 source here.
Assuming you have the sources, it can be build and installed as follows:
cd eigen2
mkdir $HOME/build/eigen2
cd $HOME/build/eigen2
cmake $HOME/src/eigen2
make
sudo make install
Note: If you are either unable or do not want to install Eigen globally you can skip the final make install step.
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 using:
cd $HOME/src
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:
cd openbabel-2.2
./configure
make -j2
sudo make install
Note: If you are either unable or do not want to install OpenBabel globally you can skip the final make install step.
Building Avogadro
Avogadro uses Git for version control, 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. Click on the download link, unpack the file and adjust the instructions as necessary. It is generally a good idea to clone the repository if you intend to contribute or regularly build the latest sources. For more details about Git and Avogadro please see Working_With_Git.
cd $HOME/src
git clone git://github.com/cryos/avogadro.git
mkdir -p $HOME/build/avogadro
cd $HOME/build/avogadro
cmake $HOME/src/avogadro
make -j2
sudo make install
Note:If you are either unable or do not want to install Avogadro globally you can run in from your home directory using the following instructions. The instructions assume you have built Eigen and OpenBabel in your home directory too.
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_TRANSLATIONS=$HOME/build/avogadro/avogadro/src #Avogadro Translations
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
These instructions assume that the OpenBabel sources are compiled in your home directory but not installed.
cd $HOME/src
git clone git://github.com/cryos/avogadro.git
mkdir -p $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 -j2
Running
avogadro
On Mac OS X Avogadro will be in your Applications folder.
Note: If you have built Avogadro using the directions in the previous section then run Avogadro using:
$HOME/build/avogadro/bin/avogadro