IMP logo
IMP Manual  for IMP version 2.5.0
install_windows.md
1 Building from source code on Windows {#install_windows}
2 ====================================
3 
4 We build and test IMP on
5 Windows, built with the Microsoft Visual Studio compilers (we use Visual Studio
6 Express 2010 SP1 for 32-bit Windows, and VS Express 2012 for 64-bit).
7 One complication is that different packages are compiled
8 with different versions of Visual Studio, and mixing the different runtimes
9 (msvc*.dll) can cause odd behavior; therefore, we recommend building most
10 of the dependencies from source code using the same version of Visual Studio
11 that you're going to use to build IMP. The basic procedure is as follows:
12 
13  - Install Microsoft Visual Studio Express (it is free, but registration with
14  Microsoft is required).
15  - Get and install [cmake](http://www.cmake.org).
16  - Get [Python 2](http://www.python.org) (not Python 3)
17  (make sure you get the
18  32-bit version if you're going to build IMP for 32-bit Windows).
19  - Get and install the
20  [zlib package](http://gnuwin32.sourceforge.net/packages/zlib.htm)
21  (both the "complete package, except sources" and the "sources" installers).
22  - The package without sources can be installed anywhere; we chose the
23  default location of `C:\Program Files\GnuWin32`. The sources, however,
24  must be installed in a path that doesn't contain spaces (otherwise the
25  Boost build will fail). We chose `C:\zlib`.
26  - We found that the zconf.h header included with zlib erroneously includes
27  unistd.h, which doesn't exist on Windows, so we commented out that line
28  (in both packages).
29  - Download the [Boost source code](http://www.boost.org)
30  (we extracted it into `C:\Program Files\boost_1_53_0`), then
31  - Open a Visual Studio Command Prompt, and cd into the directory where
32  Boost was extracted
33  - Run bootstrap.bat
34  - You may need to help the compiler find the zlib header file with
35  `set INCLUDE=C:\Program Files\GnuWin32\include`
36  - Run `bjam link=shared runtime-link=shared -sNO_ZLIB=0 -sZLIB_SOURCE=C:\zlib\1.2.3\zlib-1.2.3`
37  - Get and install [SWIG for Windows](http://www.swig.org)
38  - Get the [HDF5 source code](http://www.hdfgroup.org)
39  - Make a 'build' subdirectory, then run from a command prompt in
40  that subdirectory something similar to
41  `cmake.exe -G "Visual Studio 10" -DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF -DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DHDF5_BUILD_HL_LIB:BOOL=ON -DZLIB_INCLUDE_DIR="C:\Program Files\GnuWin32\include" -DZLIB_LIBRARY="C:\Program Files\GnuWin32\lib\zlib.lib" -DBUILD_SHARED_LIBS:BOOL=ON ..`
42  - Open the resulting HDF5 solution file in Visual Studio, change to
43  Release configuration, then build the hdf5 project.
44  - (Optional) [Build CGAL from source code](http://www.cgal.org/windows_installation.html).
45  - (Optional) Download the
46  [FFTW DLLs](http://www.fftw.org/install/windows.html) and follow the
47  instructions at that website to make .lib import libraries needed for
48  Visual Studio.
49  - Copy `libfftw3-3.lib` to `fftw3.lib` to help cmake find it
50  - (Optional) Get the
51  [GSL source code](http://gnuwin32.sourceforge.net/packages/gsl.htm)
52  and build it:
53  - Open the libgsl project file in the `src\gsl\1.8\gsl-1.8\VC8`
54  subdirectory
55  - Build in Release-DLL configuration
56  - Copy the generated `libgsl.dll` and `libgslcblas.dll` to a suitable
57  location (we used `C:\Program Files\gsl-1.8\lib`)
58  - Copy the corresponding .lib files, libgsl_dll.lib and libgslcblas_dll.lib
59  (we recommend removing the _dll suffix and the lib prefix when you do
60  this so that cmake has an easier time finding them, i.e. call them
61  gsl.lib and gslcblas.lib).
62  - (Optional) Get [numpy and scipy](http://www.scipy.org) to match your
63  Python version.
64  - (Optional) Get and install
65  [libTAU](http://integrativemodeling.org/libTAU.html)
66  - Copy `libTAU.lib` to `TAU.lib` to help cmake find it.
67  - (Optional) Get the [OpenCV source code](http://opencv.org/)
68  and build it by [following these instructions](http://docs.opencv.org/doc/tutorials/introduction/windows_install/windows_install.html)
69  - Copy each `opencv_*.lib` to a similar file without the version extension
70  (e.g. copy `opencv_ml244.lib` to `opencv_ml.lib`) to help cmake find it
71  - Set PATH, INCLUDE, and/or LIB environment variables so that the compiler
72  can find all of the dependencies. (We wrote a little batch file.)
73  - Set up IMP by running something similar to
74 
75  `cmake <imp_source_directory> -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="/DBOOST_ALL_DYN_LINK /EHsc /D_HDF5USEDLL_ /DWIN32 /DGSL_DLL" -G "NMake Makefiles"`
76 
77  - Note: if building for 64-bit Windows, you may need to add `/bigobj` to `CMAKE_CXX_CFLAGS`.
78  - Then use simply 'nmake' (instead of 'make', as on Linux or Mac) to
79  build IMP. (cmake can also generate Visual Studio project files, but
80  we recommend nmake.)
81  - To use IMP or run tests, first run the `setup_environment.bat` file to set
82  up the environment so all the programs and Python modules can be found.
83  (This batch file needs to be run only once, not for each test.)