1 Building from source code on Windows {#install_windows}
2 ====================================
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 the 32-bit Windows `.exe` installer, and
7 VS Express 2012
for the 64-bit `.exe` installer;
for the
8 [Anaconda packages](https:
9 both 32-bit and 64-bit,
10 we use VS 2008 SP1
for Python 2.7 and VS 2015
for Python 3.5).
11 One complication is that different packages are compiled
12 with different versions of Visual Studio, and mixing the different runtimes
13 (`msvc*.dll`) can cause odd behavior; therefore, we recommend building most
14 of the dependencies from source code
using the same version of Visual Studio
15 that you
're going to use to build %IMP.
17 We recommend building within the Anaconda environment, since many of the
18 dependencies are already built, and the procedure is scripted so it is more
21 - Install the right version of Microsoft Visual Studio Express (it is free,
22 but registration with Microsoft is required). Current Anaconda policy is
23 to build packages using the same version of Visual Studio that was used
24 to build Python. This means VS 2008 for Python 2.7 and VS 2015 for
25 Python 3.5, for example.
26 - Get and install [Miniconda](https://conda.io/miniconda.html) or the
27 full Anaconda environment.
28 - Install necessary conda packages for development:
29 `conda install conda-build unxutils`
30 - Then for each package `foo` you can start a Visual Studio command prompt,
31 `cd` to the directory above the `foo` directory containing the
32 [conda build recipe](https://docs.conda.io/projects/conda-build/en/latest/concepts/recipe.html)
34 `conda build --python=2.7 foo`
35 - Feel free to refer to
36 [our conda recipes](https://github.com/salilab/conda-recipes)
37 for IMP and all needed dependencies. In particular, each recipe contains
38 a `meta.yaml` file that applies any needed patches to make things work
39 on Windows, and a `bld.bat` file that automates the build itself.
41 If you want to build outside of the Anaconda environment, the basic procedure
42 we employed is as follows:
44 - Install Microsoft Visual Studio Express (it is free, but registration with
45 Microsoft is required).
46 - Get and install [cmake](https://cmake.org).
47 - Get [Python](https://www.python.org)
48 (make sure you get the
49 32-bit version if you're going to build %IMP
for 32-bit Windows).
52 (both the
"complete package, except sources" and the
"sources" installers).
53 - The
package without sources can be installed anywhere; we chose the
54 default location of `C:\Program Files\GnuWin32`. The sources, however,
55 must be installed in a path that doesn
't contain spaces (otherwise the
56 Boost build will fail). We chose `C:\zlib`.
57 - We found that the zconf.h header included with zlib erroneously includes
58 unistd.h, which doesn't exist on Windows, so we commented out that line
60 - Download the [Boost source code](http:
61 (we extracted it into `C:\Program Files\boost_1_53_0`), then
62 - Open a Visual Studio Command Prompt, and cd into the directory where
65 - You may need to help the compiler find the zlib header file with
66 `set INCLUDE=C:\Program Files\GnuWin32\include`
67 - Run `bjam link=shared runtime-link=shared -sNO_ZLIB=0 -sZLIB_SOURCE=C:\zlib\1.2.3\zlib-1.2.3`
68 - Get and install [SWIG
for Windows](http:
69 - Get the [HDF5 source code](https:
70 - Make a
'build' subdirectory, then run from a command prompt in
71 that subdirectory something similar to
72 `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 ..`
73 - Open the resulting HDF5 solution file in Visual Studio, change to
74 Release configuration, then build the hdf5 project.
75 - (Optional) [Build CGAL from source code](http:
76 - (Optional) Download the
78 instructions at that website to make .lib
import libraries needed
for
80 - Copy `libfftw3-3.lib` to `fftw3.lib` and `libfftw3-3.dll` to `fftw3.dll` to help cmake find it
82 [GSL source code](http:
84 - Open the libgsl project file in the `src\gsl\1.8\gsl-1.8\VC8`
86 - Build in Release-DLL configuration
87 - Copy the generated `libgsl.dll` and `libgslcblas.dll` to a suitable
88 location (we used `C:\Program Files\gsl-1.8\lib`)
89 - Copy the corresponding .lib files, libgsl_dll.lib and libgslcblas_dll.lib
90 (we recommend removing the _dll suffix and the lib prefix when you
do
91 this so that cmake has an easier time finding them, i.e. call them
92 gsl.lib and gslcblas.lib).
93 - (Optional) Get [numpy and scipy](http:
95 - (Optional) Get and install
97 - Copy `libTAU.lib` to `TAU.lib` to help cmake find it.
98 - (Optional) Get the [OpenCV source code](http:
99 and build it by [following these instructions](https:
100 - Copy each `opencv_*.lib` to a similar file without the version extension
101 (e.g. copy `opencv_ml244.lib` to `opencv_ml.lib`) to help cmake find it
102 - Set PATH, INCLUDE, and/or LIB environment variables so that the compiler
103 can find all of the dependencies. (We wrote a little batch file.)
104 - Set up %IMP by running something similar to
106 `cmake <imp_source_directory> -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS=
"/DBOOST_ALL_DYN_LINK /EHsc /D_HDF5USEDLL_ /DH5_BUILT_AS_DYNAMIC_LIB /DWIN32 /DGSL_DLL" -G
"NMake Makefiles"`
108 - Note: you may need to add `/bigobj` to `CMAKE_CXX_CFLAGS`, particularly
109 if building
for 64-bit Windows.
110 - Then use simply
'nmake' (instead of
'make', as on Linux or Mac) to
111 build %IMP. (cmake can also generate Visual Studio project files, but
113 - To use %IMP or run tests, first run the `setup_environment.bat` file to set
114 up the environment so all the programs and Python modules can be found.
115 (This batch file needs to be run only once, not
for each test.)