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