Difference between revisions of "Compiling on Windows"

From Avogadro - Free cross-platform molecule editor
Jump to: navigation, search
Line 10: Line 10:
 
;[http://www.cmake.org CMake] (>=2.6.0)
 
;[http://www.cmake.org CMake] (>=2.6.0)
 
;[[#Building Qt4|Qt4]] (>=4.4.0)
 
;[[#Building Qt4|Qt4]] (>=4.4.0)
;[[#Building Eigen 2|Eigen]]
+
;[[#Building Eigen|Eigen]]
;[[#Building OpenBabel 2|OpenBabel]]
+
;[[#Building OpenBabel|OpenBabel]]
 
;[http://code.google.com/p/msysgit/ msysgit] (Git for Windows, optional)
 
;[http://code.google.com/p/msysgit/ msysgit] (Git for Windows, optional)
  

Revision as of 14:27, 25 December 2008

These instructions are to allow users to build Avogadro from the very latest code. Be aware that Avogadro may fail to build or work properly at any given time when built from the instructions below.

Compiling Avogadro for Windows is a complex task and it is recommended that you download the pre-made installer found on the download page. For the adventurous, here are Windows Visual Studio 2008 instructions that may or may not work.

Windows Visual Studio 2008 (Express)

Dependencies

TortoiseSVN (Subversion for Windows)
CMake (>=2.6.0)
Qt4 (>=4.4.0)
Eigen
OpenBabel
msysgit (Git for Windows, optional)

Building Qt4

Follow the instructions for Qt4 with Visual Studio. Extract and build Qt4 in the c:\qt\<version> directory (eg. c:\qt\4.4.3 for version 4.4.3).

Building Eigen

There is no need to build Eigen since it's a template library consisting of headers. We simply extract the files to c:\eigen2.

  1. Checkout Eigen trunk svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2 to the c:\eigen2 directory.

You should now have the Eigen headers in c:\eigen2\Eigen

Building OpenBabel

  1. Checkout OpenBabel trunk https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/trunk to the c:\openbabel directory.
  2. Open the OpenBabel vs2005 solution c:\openbabel\windows-vc2005\openbabelOBF.sln
  3. Build all the targets except FastSearch, OBConsole, OBCSharp, OBGUI, OBJava and OBPythonOBF (grab some coffee this can take a while).

Building Avogadro

  1. Download Avogadro trunk from http://github.com/cryos/avogadro/zipball/master and uncompress it to the c:\avogadro directory.
  2. Open the Visual Studio 2005 Command Prompt.
  3. Create the Avogadro vs2005 solution:
    set PATH=%PATH%;c:\qt4\<version>\bin
    cd c:\avogadro
    mkdir build
    cd build
    ..\scripts\cmake-vs2005.bat
  4. Select the Release solution configuration.
  5. Open the Avogadro vs2005 solution c:\avogadro\build\avogadro.sln
  6. Add obconv.lib to the Additional Dependencies of the avogadro-app target (Right click->Properties->Linker->Input)
  7. Add obconv.lib to the Additional Dependencies of the animationextension target
  8. Add obfprt.lib oberror.lib to the Additional Dependencies of the autoopttool target
  9. Add obfprt.lib obconv.lib to the Additional Dependencies of the drawtool target
  10. Add obfprt.lib oberror.lib to the Additional Dependencies of the forcefieldextension target
  11. Add obconv.lib to the Additional Dependencies of the gamessextension target
  12. Select all the targets except: ALL_BUILD, avogadro-app, INSTALL, uninstall, update-translations, ZERO_CHECK.
  13. Disabled Embed Manifest (Right Click->Properties->Manifest Tool->Input and Output, set Embed Manifest to No, Click OK). Embed Manifest causes plugins to no properly load on older versions of Windows.
  14. Build the Solution

Running Avogadro

Currently this is tricky. I have not found an easy way to make this work real nice. The problem is that all the DLLs (and OpenBabel's .obf files) are all over the place and I'm not good enough at vs2005 to know how to specify these additional paths. The way I do it is by copying all the dll files to the c:\avogadro\build\avogadro\src\release directory and run avogadro.exe from there.

Building the Installer

Requires NSIS (nullsoft scriptable install system)

  1. Place all files (including plugins, dependencies [Qt4 | OpenBabel], etc.) in scripts\installer\dist
  2. Right Click setup.nsi and choose Compile NSIS Script

This will create the AvogadroSetup.exe file.