Difference between revisions of "Compiling on Windows with MSVC 2010"
(2 intermediate revisions by one other user not shown) | |||
Line 10: | Line 10: | ||
= Windows Visual Studio 2010 (Express) = | = Windows Visual Studio 2010 (Express) = | ||
+ | |||
+ | ;NOTE April 2011: Python 2.7.x can't be build using version 10, these instructions are for avogadro without python support. | ||
NOTE: The redistributable manifest and the version Avogadro compile against do not match. This means that the redistributable's manifest must be altered in order to successfully use the redistributable DLLs. Go to "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" and edit the file called "Microsoft.VC90.CRT.manifest". I used the version string, | NOTE: The redistributable manifest and the version Avogadro compile against do not match. This means that the redistributable's manifest must be altered in order to successfully use the redistributable DLLs. Go to "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" and edit the file called "Microsoft.VC90.CRT.manifest". I used the version string, | ||
Line 119: | Line 121: | ||
nmake install | nmake install | ||
− | You should now have the library files in <nowiki>C:\src\openbabel\bin</nowiki>. The include path is <nowiki>C:\src\openbabel\include</nowiki>. | + | You should now have the library files in <nowiki>C:\src\openbabel\bin</nowiki>. The include path is <nowiki>C:\src\openbabel\include\openbabel-2.0</nowiki>. |
== Building Avogadro == | == Building Avogadro == | ||
Line 156: | Line 158: | ||
* Build the '''glew_shared''' target | * Build the '''glew_shared''' target | ||
− | + | [[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 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.
Contents
DebugView
DebugView is a small program that allows you to view qDebug() output.
Windows Visual Studio 2010 (Express)
- NOTE April 2011
- Python 2.7.x can't be build using version 10, these instructions are for avogadro without python support.
NOTE: The redistributable manifest and the version Avogadro compile against do not match. This means that the redistributable's manifest must be altered in order to successfully use the redistributable DLLs. Go to "C:\Program Files\Microsoft Visual Studio 9.0\VC\redist\x86\Microsoft.VC90.CRT" and edit the file called "Microsoft.VC90.CRT.manifest". I used the version string,
version="9.0.21022.8"
After I changed that then the DLLs were successfully loaded and the mysterious error message stopped popping up. This was with the standard "free" version downloaded in January 2009.
Dependencies
Required:
For optional OpenGL shader support:
For the optional Python console/bindings:
- PyQt4
- SIP
- Boost libraries (tested with >=1.36.0, older versions likely work fine)
- Boost
Building Qt4 (required)
The instructions below are based on Qt4 with Visual Studio. Extract and build Qt4 in the C:\src\qt-<version> directory (e.g. C:\src\qt-4.7.2 for version 4.7.2).
Compiling Qt takes some time and can require +10GB free disk space. Below are some options to run configure.exe that reduce compile time and disk space requirements.
-release or -debug : default is -debug-and-release which takes more disk spcace. Unused (by Avogadro) Qt components: -no-webkit -no-phonon -no-phonon-backend -no-qt3support
A full compile & installation could look like (in command prompt):
cd c:\src\qt-4.7.2 configure.exe -opensource -no-webkit -release ... Do you accept the terms of the license? y nmake nmake install
- Add C:\src\qt-4.7.2\lib to your PATH. (Control Panel->System->Advanced Tab->Environment Variables)
- Make sure qmake.exe is somewhere in your PATH (needed to build PyQt)
Building Eigen (required)
Download Eigen 2 here. There is no need to build Eigen since it's a template library consisting of headers only. We simply extract the files to C:\src\eigen-2.0.15. You should now have the Eigen headers in C:\src\eigen-2.0.15\Eigen
Building OpenBabel (required)
zlib 1.2.5
- Download zlib-1.2.5.zip here
- Extract to C:\src\zlib-1.2.5
- In the command prompt:
cd c:\src\zlib-1.2.5 mkdir build cd build del ..\zconf.h cmake -DCMAKE_BUILD_TYPE=Release .. nmake copy zconf.h ..
The zlib library files are now in C:\src\zlib-1.2.5\build. The zlib.h header file is in C:\src\zlib-1.2.5.
libxml2 2.7.7 (recommended, MSVC 2010)
- Download libxml2-sources-2.7.7.tar.gz here
- Extract to C:\src\libxml2-2.7.7
- In command prompt:
cd c:\src\libxml2-2.7.7\win32 cscript configure.js compiler=msvc prefix=c:\src\libxml2 iconv=no zlib=yes include=c:\src\zlib-1.2.5 lib=c:\src\zlib-1.2.5\build
- Edit Makefile.msvc
- line 75: remove /OPT:NOWIN98
- line 94: change "zdll.lib" to "zlib.lib"
- In command prompt again:
nmake /f Makefile.msvc nmake /f Makefile.msvc install
boost libraries (recommended)
Although boost is an optional dependency for OpenBabel, it is recommended to compile with boost. OpenBabel only needs headers from the boost libraries and extracting the source package to C:\src is enough for now. If you intend to build Avogadro with python support you need build boost python later (see below).
Running cmake
Download openbabel 2.3.0 if you haven't already and extract it to C:\src
Using the Visual Studio 2010 Command Prompt
Since we are using cmake 2.6, the installed boost libraries will be found automatically. If you downloaded the boost source, make sure to also set Boost_INCLUDE_DIR. OpenBabel only uses headers from boost, there is no need to compile any boost libraries before building OpenBabel.
First, copy the contents of C:\openbabel-2.3.0\windows-vc2008\include to C:\openbabel-2.3.0\include.
cd c:\openbabel-2.3.0 mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release -DZLIB_INCLUDE_DIR=c:\src\zlib-1.2.5 -DZLIB_LIBRARY=c:\src\zlib-1.2.5\build\zlib.lib -DLIBXML2_INCLUDE_DIR=c:\src\libxml2\include -DLIBXML2_LIBRARIES=c:\src\libxml2\lib\libxml2.lib -DXDR_LIBRARY=C:\src\openbabel-2.3.0\windows-vc2008\libs\i386\xdr.lib -DCMAKE_INSTALL_PREFIX=c:\src\openbabel -G "NMake Makefiles" .. nmake nmake install
You should now have the library files in C:\src\openbabel\bin. The include path is C:\src\openbabel\include\openbabel-2.0.
Building Avogadro
For a minimal build (no python & GLSL shaders), you can now proceed to build Avogadro. If you want python and/or GLSL shader support, build these dependencies first and come back to this step later.
Download Avogadro trunk or a stable version and uncompress it to the C:\src\avogadro directory.
- Edit the scripts\cmake-msvc2010.bat file to make sure all paths are correct.
- Open the Visual Studio 2010 Command Prompt.
cd C:\src\avogadro mkdir build cd build ..\scripts\cmake-msvc2010.bat nmake
Running Avogadro & Building the Installer
The easiest way to run avogadro is to build a binary zip file or NSIS installer.
If you have set the CPACK_BINARY_ZIP or CPACK_BINARY_NSIS variable when running cmake (see scripts/cmake-msvc2008.bat), all you have to do is:
- In command prompt:
nmake PACKAGE
If there are any errors, check the cmake/modules/AvoCPack.cmake file in the avogadro directory and ensure that all paths are correct.
This will generate a zip file or .exe installer in your build dir. Simply extract or install and run avogadro.exe.
GLSL Shader Support (Optional)
- GLEW-1.5.1: http://ovh.dl.sourceforge.net/sourceforge/glew/glew-1.5.1-src.zip
- Extract to C:\src
- Open C:\src\glew\build\vc6\glew.sln (note: This will convert the VC6.0 solution...)
- Select Release configuration
- Build the glew_shared target