Windows build » History » Version 61

pospelov, 07 Nov 2014 15:48

1 1 herck
h1. Windows build
2 1 herck
3 61 pospelov
[[Obsolete instruction for MSVC 2012]]
4 61 pospelov
5 47 pospelov
Experimental compilation under Windows using Microsoft Visual Studio or Mingw.
6 52 herck
For -those who want to see the devil- developers only.
7 1 herck
8 47 pospelov
In the next sections we explain
9 1 herck
10 52 herck
* Building of BornAgain using Microsoft Visual Studio 2012 (MSVC2012)
11 51 pospelov
> Works fully for Debug/Release versions of: Core + Fit + UnitTests + FunctionalTests + App + GUI
12 47 pospelov
* Making Windows installer package using results of MSVC2012 build
13 52 herck
* Building of BornAgain using using Mingw
14 51 pospelov
> Works partially for Debug/Release vesions of: Core + Fit + UnitTests + FunctionalTests
15 1 herck
16 47 pospelov
Before we start
17 47 pospelov
18 47 pospelov
h5. Install optional packages for happier life
19 47 pospelov
20 6 pospelov
* Atlassian SourceTree (v0.9.2.3) 
21 6 pospelov
> https://www.atlassian.com/software/sourcetree/overview
22 1 herck
* Kate from KDE 
23 45 pospelov
> http://download.kde.org/stable/kdewin/installer/kdewin-installer-gui-latest.exe.mirrorlist 
24 9 pospelov
* far manager
25 14 pospelov
> http://www.farmanager.com/download.php?l=en
26 9 pospelov
* WinSCP
27 1 herck
> http://winscp.net/eng/index.php
28 6 pospelov
* Dependency Walker
29 1 herck
> http://www.dependencywalker.com/
30 1 herck
31 1 herck
32 47 pospelov
h2. MSVC2012 build
33 1 herck
34 47 pospelov
h5. Install VS.NET2012
35 47 pospelov
36 47 pospelov
* Install Visual Studio using our VS.NET2012 package
37 47 pospelov
> Install En language pack
38 57 pospelov
>> Switch En ON by going into TOOLS/optionen -> Umgebung/Internationale Einstellungen ;)
39 47 pospelov
> install "stop build on error" plugin http://visualstudiogallery.msdn.microsoft.com/91aaa139-5d3c-43a7-b39f-369196a84fa5
40 47 pospelov
41 49 pospelov
h5. Install Qt
42 20 pospelov
43 47 pospelov
* Install Qt 5.1.1
44 49 pospelov
> Download and install Qt 5.1.1 for Windows 32-bit (VS 2012) from http://qt-project.org/downloads to C:\Qt
45 47 pospelov
> Add to PATH  C:\Qt\5.1.1\msvc2012\bin
46 1 herck
> Create environment variable  QTDIR=C:\Qt\5.1.1\msvc2012
47 47 pospelov
48 49 pospelov
h5. Install cmake
49 1 herck
50 50 pospelov
* install cmake from http://www.cmake.org/cmake/resources/software.html by running cmake-2.8.11.2-win32-x86.exe
51 1 herck
52 50 pospelov
h5. Install NSIS
53 50 pospelov
54 50 pospelov
* NSIS will be used after compilation for the generation of installation package
55 50 pospelov
> install NSIS from http://nsis.sourceforge.net/Download
56 50 pospelov
57 50 pospelov
58 48 pospelov
h5. Install Python and Co
59 48 pospelov
60 56 pospelov
* install 32bit Python version 2.7
61 56 pospelov
> install through http://www.python.org/ftp/python/2.7.6/python-2.7.6.msi into default C:/Python27
62 48 pospelov
63 48 pospelov
* install numpy 
64 56 pospelov
> e.g. numpy-1.8.0-win32-superpack-python2.7.exe from http://sourceforge.net/projects/numpy/files/NumPy/
65 48 pospelov
66 1 herck
* install matplotlib 
67 56 pospelov
> e.g. matplotlib-1.3.1.win32-py2.7.exe from http://matplotlib.org/downloads.html
68 54 pospelov
69 54 pospelov
* matplotlib also depends on a number of packages: pyparsing, dateutil, six
70 54 pospelov
> install them from unofficial http://www.lfd.uci.edu/~gohlke/pythonlibs by running
71 54 pospelov
>> pyparsing-2.0.1.win32-py2.7.exe
72 54 pospelov
>> python-dateutil-2.2.win32-py2.7.exe
73 54 pospelov
>> six-1.5.2.win32-py2.7.exe
74 48 pospelov
75 48 pospelov
* Optional installation of debug version of python libraries
76 48 pospelov
> Instruction was found at http://upp-mirror.googlecode.com/svn-history/r3552/trunk/bazaar/Py/install.txt
77 48 pospelov
> Download Python source
78 48 pospelov
> Open <path to source>/PCbuild/pcbuild.sln in MSVC2012
79 48 pospelov
> Compile, some of projects will fail, no matter
80 48 pospelov
> PCbuild folder will contain the files
81 48 pospelov
>> python27_d.dll, python27_d.lib, python27_d.pdb, python27_d.exp
82 48 pospelov
> copy the dll to C:\Python27 and the remaining 3 files to C:\Python27\libs
83 1 herck
84 1 herck
Alternative
85 55 pospelov
* You can use some all-in-one Python pack which contain all required Python libraries
86 55 pospelov
> We have tested successfully PythonXY pack from http://code.google.com/p/pythonxy/
87 1 herck
88 1 herck
h5. Comment about installation of additional libraries
89 1 herck
> All further installations should end up in C:\opt\local_vc110
90 1 herck
91 1 herck
h5. Install gsl 
92 1 herck
93 60 herck
* download gsl-1.16-vc11.zip from http://brgladman.org/oldsite/computing/gnu_scientific_library.php
94 60 herck
* download gsl-1.16.tar.gz from http://www.gnu.org/software/gsl/ and extract
95 1 herck
* Read build instructions containing in the archive
96 1 herck
> succeeded only for static build using "gslhdrs step" mentioned in gsl.vc11.readme
97 1 herck
>> for shared build there were undefined symbols in dll needed for minimization
98 60 herck
* move headers and generated libraries to C:\op\local_vc110\{include|lib}
99 1 herck
100 1 herck
h5. Install fftw3
101 1 herck
102 1 herck
> from http://www.fftw.org/install/windows.html download  fftw-3.3.3-dll32.zip
103 1 herck
> unpack archive somewhere
104 1 herck
> copy fftw3.h to C:\opt\local_vc110\include
105 1 herck
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local_vc110\lib
106 1 herck
> generate corresponding lib file
107 59 herck
>> open "VS2012 x86 native tools command prompt"
108 1 herck
>>  run there "lib /def:libfftw3-3.def" to generate lib file
109 1 herck
110 1 herck
h5. install BOOST
111 1 herck
112 1 herck
* install zlib and bzip2
113 1 herck
> from http://www.zlib.net/ into C:/opt/local_vc110/source/zlib-1.2.8
114 1 herck
> from http://www.bzip.org/downloads.html into C:/opt/local_vc110/source/bzip2-1.0.6
115 1 herck
>> Patch bzip2 installation (MSVC specific!)
116 1 herck
>> Namely delete first line ("LIBRARY   LIBBZ2") from file libbz2.def
117 1 herck
>> This will remove unnecessary dependency from external bzip2 during later linking of boost libraries into other project
118 1 herck
119 1 herck
* Download and compile boost_1_54_0 
120 1 herck
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
121 58 pospelov
> Run VS2012 x86 native tools command prompt
122 1 herck
> cd <BOOSTDIR>
123 1 herck
> bootstrap.bat
124 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
125 1 herck
> Move c:/opt/local_vc110/include/boost_1.54/boost directory into c:/opt/local_vc110/include/boost
126 1 herck
127 1 herck
h5. %PATH%
128 1 herck
129 1 herck
* Add c:\opt\local_vc110\lib to PATH
130 1 herck
131 1 herck
132 1 herck
h5. Working with MSVC2012
133 1 herck
134 1 herck
* generate project file
135 50 pospelov
> Create build directory BornAgain-build and run there cmake command from command line
136 1 herck
> cmake -G "Visual Studio 11" -DCMAKE_INCLUDE_PATH=C:/opt/local_vc110/include -DCMAKE_LIBRARY_PATH=C:/opt/local_vc110/lib ../BornAgain
137 1 herck
> Open BornAgain.sln in Visual Studio
138 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"
139 1 herck
>> Functional tests can be runned additionally by building "check" project
140 50 pospelov
>> Installation procedure can be tested by building INSTALL project
141 1 herck
142 1 herck
143 1 herck
h2. Windows installer
144 1 herck
145 51 pospelov
Installer can be generated using result of MSVC build
146 51 pospelov
For the generation CMake -> CPack -> NSIS combination is used.
147 51 pospelov
148 51 pospelov
h5. How to create installer
149 51 pospelov
150 51 pospelov
* After build is complete, installer is generated by running in the build directory the command
151 1 herck
> CPack -C Release
152 1 herck
* Only MSVC build based installer have been validated so far.
153 1 herck
154 1 herck
155 51 pospelov
h5. How to use installer on another PC
156 1 herck
157 1 herck
* Install Python + Numpy + matplotlib
158 1 herck
* Download installer from the link below this page, run it
159 51 pospelov
* Navigate to the installation directory and double click on Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py
160 51 pospelov
* Navigate to the installation directory and double click on coregui.exe
161 1 herck
162 47 pospelov
163 1 herck
h2. Mingw build
164 47 pospelov
165 51 pospelov
* With Mingw we are able to compile(Core + Fit + UnitTests + FunctionalTests)
166 51 pospelov
> No App, GUI compilation is possible for the moment due to ROOT
167 47 pospelov
168 51 pospelov
169 51 pospelov
h5. Install Qt
170 51 pospelov
171 51 pospelov
* Install Qt 5.1.1 for Windows 32-bit (MinGW 4.8, OpenGL)
172 51 pospelov
> from ttp://qt-project.org/downloads into C:\Qt
173 1 herck
> 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
174 47 pospelov
>> this will allow usage of mingw from any command line
175 47 pospelov
176 51 pospelov
h5. Install cmake
177 47 pospelov
178 51 pospelov
* install cmake as explained
179 51 pospelov
180 47 pospelov
h5. Install MinGW 
181 47 pospelov
182 51 pospelov
* We need full MinGW suite to compile latest libgsl. MinGW from Qt installation want help.
183 47 pospelov
> download mingw-get-setup.exe installation manager from http://www.mingw.org/
184 47 pospelov
> run installer, there will be some pre selection of packages (from MinGW Base system, MSYS and GCC), should be enough
185 47 pospelov
> in the menu do Installation/Apply changes, then accept default C:\MinGW as an installation directory
186 47 pospelov
187 47 pospelov
h5. Install Python and Co
188 47 pospelov
189 51 pospelov
* as explained
190 47 pospelov
191 47 pospelov
h5. Comment about installation of additional libraries
192 47 pospelov
> All further installations should end up in C:\opt\local
193 47 pospelov
194 47 pospelov
h5. Install gsl
195 47 pospelov
196 47 pospelov
* use previously installed MinGW to compile gsl
197 47 pospelov
> create empty directory c:\gsl-1.16
198 47 pospelov
> download source gsl-1.16.tar.gz from ftp://ftp.gnu.org/gnu/gsl/ 
199 47 pospelov
> copy unpacked directory to C:\mingw\msys\1.0\home\pospelov
200 47 pospelov
> run c:\mingw\msys\msys.bat which will bring command line prompt
201 47 pospelov
> there, navigate to c:\mingw\msys\1.0\home\pospelov\gsl-1.16
202 47 pospelov
> compile
203 47 pospelov
>> ./configure --enable-static=yes --enable-shared=yes --prefix=/c/gsl-1.16
204 47 pospelov
>> make
205 47 pospelov
>> make install
206 47 pospelov
> copy directory "C:\gsl-1.16\include\gsl"  to "C:\opt\local\include\gsl"
207 47 pospelov
> copy files libgsl-0.dll and libgslcblas-0.dll into "C:\opt\local\lib"
208 47 pospelov
209 1 herck
h5. Install fftw3 
210 47 pospelov
211 47 pospelov
> from http://www.fftw.org/install/windows.html download  fftw-3.3.3-dll32.zip
212 1 herck
> unpack archive somewhere
213 1 herck
> copy fftw3.h to C:\opt\local\include
214 47 pospelov
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local\lib
215 47 pospelov
216 47 pospelov
h5. install BOOST
217 47 pospelov
218 47 pospelov
* install zlib and bzip2
219 47 pospelov
> from http://www.zlib.net/ into C:/opt/local/source/zlib-1.2.8
220 47 pospelov
> from http://www.bzip.org/downloads.html into C:/opt/local/source/bzip2-1.0.6
221 47 pospelov
222 47 pospelov
* Download and compile boost_1_54_0 
223 47 pospelov
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
224 47 pospelov
> cd <BOOSTDIR>
225 47 pospelov
> bootstrap.bat mingw
226 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
227 47 pospelov
> Move c:/opt/local/include/boost_1.54/boost directory into c:/opt/local/include/boost
228 47 pospelov
229 47 pospelov
230 47 pospelov
h5. %PATH%
231 47 pospelov
232 47 pospelov
* Add c:\home\pospelov\development\git\BornAgain\lib;c:\opt\local\lib to PATH
233 47 pospelov
234 51 pospelov
h5. Running Mingw build
235 47 pospelov
236 51 pospelov
* Create build directory and run there
237 47 pospelov
> cmake -G "MinGW Makefiles"  ../BornAgain
238 47 pospelov
> mingw32-make -j4
239 47 pospelov
> mingw32-make check
240 47 pospelov
>> or cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ../BornAgain
241 51 pospelov
242 51 pospelov
* Generate installer
243 51 pospelov
> CPack -C Release