Difference between revisions of "Compiling on Windows"

From Avogadro - Free cross-platform molecule editor
Jump to: navigation, search
m
 
(15 intermediate revisions by 4 users not shown)
Line 1: Line 1:
 
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.  
 
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.
+
;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/2010 instructions that may or may not work. For various steps in the process, there may be downloadable binaries on the web. However, for completeness we build all dependencies.
 
There are also [[Compiling_on_Linux_and_Mac_OS_X|instructions for Linux and Mac OS X]] available.
 
  
= Windows Visual Studio 2008 (Express) =
+
* [[Compiling_on_Windows_with_MSVC_2008]]
+
* [[Compiling_on_Windows_with_MSVC_2010]]
== Dependencies ==
 
  
;[http://tortoisesvn.tigris.org/ TortoiseSVN] (Subversion for Windows)
+
There are also [[Compiling_on_Linux_and_Mac_OS_X|instructions for Linux and Mac OS X]] available.
;[http://www.cmake.org CMake] (>=2.6.0)
 
;[[#Building Qt4|Qt4]] (>=4.4.0)
 
;[[#Building Eigen 2|Eigen]]
 
;[http://www.boostpro.com/products/free Boost libraries] (>=1.36.0)
 
;[[#Building OpenBabel 2|OpenBabel]]
 
;[http://code.google.com/p/msysgit/ msysgit] (Git for Windows, optional)
 
 
 
For the optional Python console/bindings:
 
;[http://www.riverbankcomputing.co.uk/software/pyqt/download PyQt4]
 
;[http://www.riverbankcomputing.co.uk/software/sip/download SIP]
 
;[http://www.boost.org/users/download/ Boost]
 
 
 
For optional OpenGL shader support:
 
;[http://glew.sourceforge.net/ GLEW]
 
 
 
=== Building Qt4 ===
 
 
 
Follow the instructions for [http://wiki.qtcentre.org/index.php?title=Qt4_with_Visual_Studio Qt4 with Visual Studio].  Extract and build Qt4 in the <code>c:\qt\<version></code> directory (eg. <code>c:\qt\4.4.3</code> 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 <nowiki>c:\eigen2</nowiki>.
 
 
 
#Checkout Eigen trunk <code>svn://anonsvn.kde.org/home/kde/trunk/kdesupport/eigen2</code> to the <nowiki>c:\eigen2</nowiki> directory.
 
 
 
You should now have the Eigen headers in <code>c:\eigen2\Eigen</code>
 
 
 
=== Building OpenBabel ===
 
 
 
#Checkout OpenBabel trunk <code>https://openbabel.svn.sourceforge.net/svnroot/openbabel/openbabel/trunk</code> to the <nowiki>c:\openbabel</nowiki> directory.
 
 
 
==== Running cmake ====
 
===== Using the Visual Studio 2008 Command Prompt =====
 
 
 
Since we are using cmake 2.6, the installed [http://www.boostpro.com/products/free boost libraries] will be found automatically.
 
 
 
cd c:\openbabel
 
mkdir build
 
cd build
 
cmake -DZLIB_INCLUDE_DIR=c:\openbabel\include -DZLIB_LIBRARY=c:\openbabel\windows-vc2005\zlib1.lib
 
-DLIBXML2_INCLUDE_DIR=c:\openbabel\include -DLIBXML2_LIBRARIES=c:\openbabel\windows-vc2005\libxml2.lib
 
-DLIBRARY_OUPUT_PATH=c:\openbabel\output -DEXECUTABLE_OUPUT_PATH=c:\openbabel\output -G "Visual Studio 9 2008" ..
 
 
 
===== Using the CMake graphical user interface =====
 
 
 
[[Image:Cmake.jpg|thumb|openbabel CMake 2.6 setting for windows]]
 
 
 
# Open the CMake GUI: Start > All programs > CMake 2.6 > cmake-gui(beta)
 
# Set the "Where is the source code" field to <code>c:/openbabel</code>
 
# Set the "Where to build the binaries" field to <code>c:/openbabel/build</code>
 
# Press the "Configure" button
 
# A new dialog will appear where you can select the build environment: Visual Studio 9 2008
 
# Set the combo box (on the right of the search field) to "Grouped View"
 
# Edit the ZLIB and LIBXML2 fields so they resemble the screenshot
 
 
 
 
 
==== Building ====
 
 
 
# Open the <code>c:\openbabel\build\openbabel.sln</code> solution
 
# Select the '''Release''' solution configuration.
 
# Build the Solution (F7)
 
 
 
You should now have all files files in <code>c:\openbabel\output\Release</code>.
 
 
 
== Building Avogadro ==
 
 
 
#Download Avogadro trunk from <code>http://github.com/cryos/avogadro/zipball/master</code> and uncompress it to the <nowiki>c:\avogadro</nowiki> directory.
 
# Open the Visual Studio 2008 Command Prompt.
 
# Create the Avogadro vs2008 solution:
 
#: <code>set PATH=%PATH%;c:\qt4\<version>\bin</code>
 
#: <code>cd c:\avogadro</code>
 
#: <code>mkdir build</code>
 
#: <code>cd build</code>
 
#: <code>..\scripts\cmake-vs2005.bat</code>
 
# Select the '''Release''' solution configuration.
 
# Open the Avogadro vs2008 solution <code>c:\avogadro\build\avogadro.sln</code>
 
#Select all the targets except: '''ALL_BUILD''', '''avogadro-app''', '''INSTALL''', '''uninstall''', '''update-translations''', '''ZERO_CHECK'''.
 
#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.
 
#Build the Solution
 
 
 
== Running Avogadro ==
 
 
 
Copy all needed files to one directory and run avogadro.exe from there.
 
 
 
# openbabel-2.dll, all the formats (*.obf) and data files
 
# avogadro.dll + tools, extensions, colors & engines
 
# MSVC runtime dll's
 
# python25.dll
 
# Qt dll's
 
# PyQt4 *.pyd's
 
# ...
 
 
 
== Building the Installer ==
 
''Requires [http://nsis.sourceforge.net/ NSIS] (nullsoft scriptable install system)''
 
 
 
#Place all files (including plugins, dependencies [Qt4 | OpenBabel], etc.) in scripts\installer\dist
 
#Right Click <code>setup.nsi</code> and choose '''Compile NSIS Script'''
 
  
This will create the AvogadroSetup.exe file.
+
[[Category:Developer]]

Latest revision as of 10:17, 19 June 2012

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/2010 instructions that may or may not work. For various steps in the process, there may be downloadable binaries on the web. However, for completeness we build all dependencies.

There are also instructions for Linux and Mac OS X available.