Windows build » History » Version 46

pospelov, 12 Sep 2013 15:44

1 1 herck
h1. Windows build
2 1 herck
3 9 pospelov
Experimental compilation under Windows using Mingw or Microsoft Visual Studio.
4 33 pospelov
For -whose who wnats to see the devil- developers only.
5 1 herck
6 13 pospelov
7 6 pospelov
h5. Install packages for happier life
8 1 herck
9 6 pospelov
* Atlassian SourceTree (v0.9.2.3) 
10 6 pospelov
> https://www.atlassian.com/software/sourcetree/overview
11 6 pospelov
* Kate from KDE 
12 6 pospelov
> http://download.kde.org/stable/kdewin/installer/kdewin-installer-gui-latest.exe.mirrorlist 
13 1 herck
* far manager
14 1 herck
> http://www.farmanager.com/download.php?l=en
15 9 pospelov
* WinSCP
16 9 pospelov
> http://winscp.net/eng/index.php
17 45 pospelov
* Dependency Walker
18 45 pospelov
> http://www.dependencywalker.com/
19 9 pospelov
20 14 pospelov
First assure compilation of MinGW, then switch to Visual Studio recipe
21 9 pospelov
22 9 pospelov
h2. Mingw build
23 9 pospelov
24 6 pospelov
h5. Install Qt, cmake
25 1 herck
26 25 pospelov
* Install Qt 5.1.0
27 6 pospelov
> http://qt-project.org/downloads
28 18 pospelov
> Add to PATH C:\Qt\Tools\mingw48_32\bin;C:\Qt\Tools\mingw48_32\lib;C:\Qt\5.1.0\mingw48_32\bin;C:\Qt\Tools\QtCreator\bin
29 19 pospelov
>> this will allow usage of mingw from any command line
30 1 herck
31 1 herck
* install cmake
32 1 herck
> http://www.cmake.org/cmake/resources/software.html by running cmake-2.8.11.2-win32-x86.exe
33 1 herck
34 27 pospelov
h5. Install MinGW 
35 25 pospelov
36 27 pospelov
* We need full MinGW suite to compile latest libgsl. MinGW from Qt installtion want help.
37 30 pospelov
> download mingw-get-setup.exe installation manager from http://www.mingw.org/
38 30 pospelov
> run installer, there will be some pre selection of packages (from MinGW Base system, MSYS and GCC), should be enough
39 34 pospelov
> in the menu do Installation/Apply changes, then accept default C:\MinGW as an installation directory
40 25 pospelov
41 16 pospelov
h5. Install Python and Co
42 16 pospelov
43 16 pospelov
* Install Python
44 16 pospelov
> install through http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi into C:/Python27
45 16 pospelov
46 16 pospelov
* install numpy 
47 16 pospelov
> from unofficial http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy   by running   numpy-unoptimized-1.7.1.win32-py2.7.‌exe
48 16 pospelov
49 16 pospelov
* install matplotlib 
50 1 herck
> from http://matplotlib.org/downloads.html  by running matplotlib-1.2.1.win32-py2.7.exe
51 44 pospelov
>> matplotlib can require dateutil, pyparsing from http://www.lfd.uci.edu/~gohlke/
52 6 pospelov
53 1 herck
> (alternative install Anaconda pack (python + mingw + numpy) from http://continuum.io/downloads ) Not checked!
54 1 herck
55 1 herck
h5. Comment about installation of additional libraries
56 1 herck
> All further installations should end up in C:\opt\local
57 1 herck
58 25 pospelov
h5. Install gsl
59 1 herck
60 35 pospelov
* use previously installed MinGW to compile gsl
61 25 pospelov
> create empty directory c:\gsl-1.16
62 25 pospelov
> download source gsl-1.16.tar.gz from ftp://ftp.gnu.org/gnu/gsl/ 
63 25 pospelov
> copy unpacked directory to C:\mingw\msys\1.0\home\pospelov
64 31 pospelov
> run c:\mingw\msys\msys.bat which will bring command line prompt
65 25 pospelov
> there, navigate to c:\mingw\msys\1.0\home\pospelov\gsl-1.16
66 25 pospelov
> compile
67 25 pospelov
>> ./configure --enable-static=yes --enable-shared=yes --prefix=/c/gsl-1.16
68 25 pospelov
>> make
69 25 pospelov
>> make install
70 28 pospelov
> copy directory "C:\gsl-1.16\include\gsl"  to "C:\opt\local\include\gsl"
71 28 pospelov
> copy files libgsl-0.dll and libgslcblas-0.dll into "C:\opt\local\lib"
72 25 pospelov
73 25 pospelov
h5. Install fftw3 
74 25 pospelov
75 12 pospelov
> from http://www.fftw.org/install/windows.html download  fftw-3.3.3-dll32.zip
76 6 pospelov
> unpack archive somewhere
77 6 pospelov
> copy fftw3.h to C:\opt\local\include
78 6 pospelov
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local\lib
79 15 pospelov
80 15 pospelov
h5. install BOOST
81 6 pospelov
82 6 pospelov
* install zlib and bzip2
83 6 pospelov
> from http://www.zlib.net/ into C:/opt/local/source/zlib-1.2.8
84 6 pospelov
> from http://www.bzip.org/downloads.html into C:/opt/local/source/bzip2-1.0.6
85 6 pospelov
86 6 pospelov
* Download and compile boost_1_54_0 
87 6 pospelov
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
88 6 pospelov
> cd <BOOSTDIR>
89 6 pospelov
> bootstrap.bat mingw
90 6 pospelov
> b2 install --prefix=c:/opt/local toolset=gcc -sBZIP2_SOURCE="C:\opt\local\source\bzip2-1.0.6"   -sZLIB_SOURCE="C:\opt\local\source\zlib-1.2.8" address-model=32 variant=release link=static,shared threading=single,multi
91 6 pospelov
> Move c:/opt/local/include/boost_1.54/boost directory into c:/opt/local/include/boost
92 6 pospelov
93 6 pospelov
94 1 herck
h5. %PATH%
95 17 pospelov
96 17 pospelov
* Add c:\home\pospelov\development\git\BornAgain\lib;c:\opt\local\lib to PATH
97 6 pospelov
98 6 pospelov
h5. Where we are?
99 1 herck
100 39 pospelov
* At this point Qt creator Release, Debug builds are working 
101 39 pospelov
> Core + Fit + UnitTests + FunctionalTests (not App, GUI)
102 6 pospelov
103 39 pospelov
* cmake Release, Debug builds 
104 20 pospelov
> cmake -G "MinGW Makefiles"  ../BornAgain
105 1 herck
> mingw32-make -j4
106 20 pospelov
> mingw32-make check
107 39 pospelov
>> or cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ../BornAgain
108 20 pospelov
109 20 pospelov
h2. MS Visual Studio build
110 20 pospelov
111 20 pospelov
112 20 pospelov
h5. Install VS.NET2012
113 20 pospelov
> Install En language pack
114 20 pospelov
> install "stop build on error" plugin http://visualstudiogallery.msdn.microsoft.com/91aaa139-5d3c-43a7-b39f-369196a84fa5
115 20 pospelov
116 20 pospelov
h5. Comment about installation of additional libraries
117 1 herck
> All further installations should end up in C:\opt\local_vc110
118 20 pospelov
119 1 herck
h5. Install gsl 
120 1 herck
121 41 pospelov
* download gsl-1.16-vc11.zip from http://gladman.plushost.co.uk/oldsite/computing/gnu_scientific_library.php
122 38 pospelov
* Read build instructions containing in the archive
123 41 pospelov
> succeeded only for static build using "gslhdrs step" mentioned in gsl.vc11.readme
124 1 herck
125 29 pospelov
h5. Install fftw3
126 29 pospelov
127 22 pospelov
> from http://www.fftw.org/install/windows.html download  fftw-3.3.3-dll32.zip
128 22 pospelov
> unpack archive somewhere
129 1 herck
> copy fftw3.h to C:\opt\local_vc110\include
130 1 herck
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local_vc110\lib
131 1 herck
> generate corresponding lib file
132 1 herck
>> run "VS2012 x86 native tools command prompt"
133 23 pospelov
>>  run there "lib /def:libfftw3-3.def" to generate lib file
134 23 pospelov
135 23 pospelov
h5. install BOOST
136 23 pospelov
137 23 pospelov
* install zlib and bzip2
138 23 pospelov
> from http://www.zlib.net/ into C:/opt/local_vc110/source/zlib-1.2.8
139 24 pospelov
> from http://www.bzip.org/downloads.html into C:/opt/local_vc110/source/bzip2-1.0.6
140 23 pospelov
>> Patch bzip2 installation (MSVC specific!)
141 23 pospelov
>> Namely delete first line ("LIBRARY   LIBBZ2") from file libbz2.def
142 40 pospelov
>> This will remove unnecessary dependency from external bzip2 during later linking of boost libraries into other project
143 23 pospelov
144 23 pospelov
* Download and compile boost_1_54_0 
145 23 pospelov
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
146 23 pospelov
> cd <BOOSTDIR>
147 1 herck
> bootstrap.bat
148 1 herck
> b2 install --prefix=c:/opt/local_vc110 -sBZIP2_SOURCE="C:\opt\local_vc110\source\bzip2-1.0.6"   -sZLIB_SOURCE="C:\opt\local_vc110\source\zlib-1.2.8" variant=release   link=static,shared threading=multi
149 1 herck
> Move c:/opt/local_vc110/include/boost_1.54/boost directory into c:/opt/local_vc110/include/boost
150 1 herck
151 1 herck
h5. %PATH%
152 1 herck
153 1 herck
* Add c:\opt\local_vc110\lib to PATH
154 38 pospelov
155 38 pospelov
156 38 pospelov
h5. Working with MSVC2012
157 38 pospelov
158 38 pospelov
* generate project file
159 1 herck
> cmake -G "Visual Studio 11" -DCMAKE_INCLUDE_PATH=C:/opt/local_vc110/include -DCMAKE_LIBRARY_PATH=C:/opt/local_vc110/lib ../BornAgain
160 38 pospelov
> Open BornAgain.sln in Visual Studio
161 38 pospelov
>> There will be several projects in the solution (INSTALL, ZERO_CHECK, etc), all are necessary. Select build type "Release" and do "BUILD/Build Solution"
162 39 pospelov
>> Functional tests can be runned additionally by building "check" project
163 38 pospelov
164 38 pospelov
h5. Where we are?
165 38 pospelov
166 39 pospelov
* MSVC2012 Release, Debug builds are working for Core + Fit + UnitTests + FunctionalTests 
167 45 pospelov
168 45 pospelov
169 45 pospelov
h2. Windows installer
170 45 pospelov
171 45 pospelov
* Installer can be generated using both, MinGW and MSVC builds.
172 45 pospelov
* For the generation CMake -> CPack -> NSIS combination is used.
173 45 pospelov
* After build is complete, installer is generated using command
174 45 pospelov
> CPack -C Release
175 45 pospelov
* Only MSVC build based installer have been validated so far.
176 45 pospelov
177 45 pospelov
178 45 pospelov
179 45 pospelov
h5. Generating installer
180 45 pospelov
181 45 pospelov
* Install NSIS
182 45 pospelov
> install NSIS from http://nsis.sourceforge.net/Download
183 45 pospelov
184 45 pospelov
* generate MSVC solution, build solution in Release mode and then generate installer
185 45 pospelov
> cmake -G "Visual Studio 11" -DCMAKE_INCLUDE_PATH=C:/opt/local_vc110/include -DCMAKE_LIBRARY_PATH=C:/opt/local_vc110/lib ../BornAgain
186 45 pospelov
> Run Build Solution from MSVC
187 45 pospelov
> CPack -C Release
188 46 pospelov
189 46 pospelov
h5. How to use installer
190 46 pospelov
191 46 pospelov
* Install Python + Numpy + matplotlib
192 46 pospelov
* Download installer from the link below this page, run it
193 46 pospelov
* Navigate to installation directory and double click on Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py