Windows build » History » Version 47

pospelov, 20 Sep 2013 09:40

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