Windows build » History » Version 47

Version 46 (pospelov, 12 Sep 2013 15:44) → Version 47/98 (pospelov, 20 Sep 2013 09:40)

h1. Windows build

Experimental compilation under Windows using Mingw or Microsoft Visual Studio or Mingw. Studio.
For -whose who wants wnats to see the devil- developers only.

In the next sections we explain

* Bulding of BornAgain using using Microsoft Visual Studio 2012 (MSVC2012)
> Works fully for: Core + Fit + UnitTests + FunctionalTests + App + GUI
* Making Windows installer package using results of MSVC2012 build
* Bulding of BornAgain using using Mingw
> Works partially: Core + Fit + UnitTests + FunctionalTests

Before we start



h5. Install optional packages for happier life

* Atlassian SourceTree (v0.9.2.3)
> https://www.atlassian.com/software/sourcetree/overview
* Kate from KDE
> http://download.kde.org/stable/kdewin/installer/kdewin-installer-gui-latest.exe.mirrorlist
* far manager
> http://www.farmanager.com/download.php?l=en
* WinSCP
> http://winscp.net/eng/index.php
* Dependency Walker
> http://www.dependencywalker.com/



First assure compilation of MinGW, then switch to Visual Studio recipe

h2. MSVC2012 Mingw build

h5. Install VS.NET2012 Qt, cmake

* Install Visual Studio using our VS.NET2012 package Qt 5.1.0
> Install En language pack http://qt-project.org/downloads
> 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
>> this will allow usage of mingw from any command line

*
install "stop build on error" plugin http://visualstudiogallery.msdn.microsoft.com/91aaa139-5d3c-43a7-b39f-369196a84fa5 cmake
> http://www.cmake.org/cmake/resources/software.html by running cmake-2.8.11.2-win32-x86.exe


h5. Install Qt, cmake MinGW

* We need full MinGW suite to compile latest libgsl. MinGW from Qt installtion want help.
> download mingw-get-setup.exe installation manager from http://www.mingw.org/
> run installer, there will be some pre selection of packages (from MinGW Base system, MSYS and GCC), should be enough
> in the menu do Installation/Apply changes, then accept default C:\MinGW as an installation directory


h5. Install Python and Co

* Install Qt 5.1.1 Python
> Dwonload and install Qt 5.1.1 for Windows 32-bit (VS 2012) through http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi into C:/Python27

* install numpy
>
from http://qt-project.org/downloads unofficial http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy by running numpy-unoptimized-1.7.1.win32-py2.7.‌exe

* install matplotlib
> from http://matplotlib.org/downloads.html by running matplotlib-1.2.1.win32-py2.7.exe
>> matplotlib can require dateutil, pyparsing from http://www.lfd.uci.edu/~gohlke/

> (alternative install Anaconda pack (python + mingw + numpy) from http://continuum.io/downloads ) Not checked!

h5. Comment about installation of additional libraries
> All further installations should end up in C:\opt\local

h5. Install gsl

* use previously installed MinGW
to C:\Qt compile gsl
> Add create empty directory c:\gsl-1.16
> download source gsl-1.16.tar.gz from ftp://ftp.gnu.org/gnu/gsl/
> copy unpacked directory
to PATH C:\mingw\msys\1.0\home\pospelov
> run c:\mingw\msys\msys.bat which will bring command line prompt
> there, navigate to c:\mingw\msys\1.0\home\pospelov\gsl-1.16
> compile
>> ./configure --enable-static=yes --enable-shared=yes --prefix=/c/gsl-1.16
>> make
>> make install
> copy directory "C:\gsl-1.16\include\gsl"
C:\Qt\5.1.1\msvc2012\bin to "C:\opt\local\include\gsl"
> Create environment variable copy files libgsl-0.dll and libgslcblas-0.dll into "C:\opt\local\lib"

h5. Install fftw3

> from http://www.fftw.org/install/windows.html download
QTDIR=C:\Qt\5.1.1\msvc2012 fftw-3.3.3-dll32.zip
> unpack archive somewhere
> copy fftw3.h to C:\opt\local\include
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local\lib


h5. install BOOST

* install zlib and bzip2
> from http://www.zlib.net/ into C:/opt/local/source/zlib-1.2.8
> from http://www.bzip.org/downloads.html into C:/opt/local/source/bzip2-1.0.6

* Download and compile boost_1_54_0
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
> cd <BOOSTDIR>
> bootstrap.bat mingw
> 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
> Move c:/opt/local/include/boost_1.54/boost directory into c:/opt/local/include/boost

h5. %PATH%

* Add c:\home\pospelov\development\git\BornAgain\lib;c:\opt\local\lib to PATH

h5. Where we are?

* At this point Qt creator Release, Debug builds are working
> Core + Fit + UnitTests + FunctionalTests (not App, GUI)

*
cmake Release, Debug builds
> cmake -G "MinGW Makefiles" ../BornAgain

> http://www.cmake.org/cmake/resources/software.html by running cmake-2.8.11.2-win32-x86.exe

mingw32-make -j4
> mingw32-make check
>> or cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ../BornAgain

h2. MS Visual Studio build

h5. Install VS.NET2012
> Install En language pack
> install "stop build on error" plugin http://visualstudiogallery.msdn.microsoft.com/91aaa139-5d3c-43a7-b39f-369196a84fa5

h5.
Comment about installation of additional libraries
> All further installations should end up in C:\opt\local_vc110

h5. Install gsl

* download gsl-1.16-vc11.zip from http://gladman.plushost.co.uk/oldsite/computing/gnu_scientific_library.php
* Read build instructions containing in the archive
> succeeded only for static build using "gslhdrs step" mentioned in gsl.vc11.readme
>> for shared build there were undefined symbols in dll needed for minimization


h5. Install fftw3

> from http://www.fftw.org/install/windows.html download fftw-3.3.3-dll32.zip
> unpack archive somewhere
> copy fftw3.h to C:\opt\local_vc110\include
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local_vc110\lib
> generate corresponding lib file
>> run "VS2012 x86 native tools command prompt"
>> run there "lib /def:libfftw3-3.def" to generate lib file

h5. install BOOST

* install zlib and bzip2
> from http://www.zlib.net/ into C:/opt/local_vc110/source/zlib-1.2.8
> from http://www.bzip.org/downloads.html into C:/opt/local_vc110/source/bzip2-1.0.6
>> Patch bzip2 installation (MSVC specific!)
>> Namely delete first line ("LIBRARY LIBBZ2") from file libbz2.def
>> This will remove unnecessary dependency from external bzip2 during later linking of boost libraries into other project

* Download and compile boost_1_54_0
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
> cd <BOOSTDIR>
> bootstrap.bat
> 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
> Move c:/opt/local_vc110/include/boost_1.54/boost directory into c:/opt/local_vc110/include/boost

h5. %PATH%

* Add c:\opt\local_vc110\lib to PATH

h5. Working with MSVC2012

* generate project file
> cmake -G "Visual Studio 11" -DCMAKE_INCLUDE_PATH=C:/opt/local_vc110/include -DCMAKE_LIBRARY_PATH=C:/opt/local_vc110/lib ../BornAgain
> Open BornAgain.sln in Visual Studio
>> There will be several projects in the solution (INSTALL, ZERO_CHECK, etc), all are necessary. Select build type "Release" and do "BUILD/Build Solution"
>> Functional tests can be runned additionally by building "check" project

h5. Where we are?

* MSVC2012 Release, Debug builds are working for Core + Fit + UnitTests + FunctionalTests

h2. Windows installer

* Installer can be generated using both, MinGW and MSVC builds.
* For the generation CMake -> CPack -> NSIS combination is used.
* After build is complete, installer is generated using command
> CPack -C Release
* Only MSVC build based installer have been validated so far.

h5. Generating installer

* Install NSIS
> install NSIS from http://nsis.sourceforge.net/Download

* generate MSVC solution, build solution in Release mode and then generate installer
> cmake -G "Visual Studio 11" -DCMAKE_INCLUDE_PATH=C:/opt/local_vc110/include -DCMAKE_LIBRARY_PATH=C:/opt/local_vc110/lib ../BornAgain
> Run Build Solution from MSVC
> CPack -C Release

h5. How to use installer

* Install Python + Numpy + matplotlib
* Download installer from the link below this page, run it
* Navigate to installation directory and double click on Examples/python/ex001_CylindersAndPrisms/CylindersAndPrisms.py

h2. Mingw build

h5. Install Qt, cmake

* Install Qt 5.1.0
> http://qt-project.org/downloads
> 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
>> this will allow usage of mingw from any command line

* install cmake
> http://www.cmake.org/cmake/resources/software.html by running cmake-2.8.11.2-win32-x86.exe

h5. Install MinGW

* We need full MinGW suite to compile latest libgsl. MinGW from Qt installtion want help.
> download mingw-get-setup.exe installation manager from http://www.mingw.org/
> run installer, there will be some pre selection of packages (from MinGW Base system, MSYS and GCC), should be enough
> in the menu do Installation/Apply changes, then accept default C:\MinGW as an installation directory

h5. Install Python and Co

* Install Python
> install through http://www.python.org/ftp/python/2.7.5/python-2.7.5.msi into C:/Python27

* install numpy
> from unofficial http://www.lfd.uci.edu/~gohlke/pythonlibs/#numpy by running numpy-unoptimized-1.7.1.win32-py2.7.‌exe

* install matplotlib
> from http://matplotlib.org/downloads.html by running matplotlib-1.2.1.win32-py2.7.exe
>> matplotlib can require dateutil, pyparsing from http://www.lfd.uci.edu/~gohlke/

> (alternative install Anaconda pack (python + mingw + numpy) from http://continuum.io/downloads ) Not checked!

h5. Comment about installation of additional libraries
> All further installations should end up in C:\opt\local

h5. Install gsl

* use previously installed MinGW to compile gsl
> create empty directory c:\gsl-1.16
> download source gsl-1.16.tar.gz from ftp://ftp.gnu.org/gnu/gsl/
> copy unpacked directory to C:\mingw\msys\1.0\home\pospelov
> run c:\mingw\msys\msys.bat which will bring command line prompt
> there, navigate to c:\mingw\msys\1.0\home\pospelov\gsl-1.16
> compile
>> ./configure --enable-static=yes --enable-shared=yes --prefix=/c/gsl-1.16
>> make
>> make install
> copy directory "C:\gsl-1.16\include\gsl" to "C:\opt\local\include\gsl"
> copy files libgsl-0.dll and libgslcblas-0.dll into "C:\opt\local\lib"

h5. Install fftw3

> from http://www.fftw.org/install/windows.html download fftw-3.3.3-dll32.zip
> unpack archive somewhere
> copy fftw3.h to C:\opt\local\include
> copy libfftw3-3.dll and libfftw3-3.def to C:\opt\local\lib

h5. install BOOST

* install zlib and bzip2
> from http://www.zlib.net/ into C:/opt/local/source/zlib-1.2.8
> from http://www.bzip.org/downloads.html into C:/opt/local/source/bzip2-1.0.6

* Download and compile boost_1_54_0
> from http://sourceforge.net/projects/boost/files/boost/1.54.0/ and unpack
> cd <BOOSTDIR>
> bootstrap.bat mingw
> 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
> Move c:/opt/local/include/boost_1.54/boost directory into c:/opt/local/include/boost

h5. %PATH%

* Add c:\home\pospelov\development\git\BornAgain\lib;c:\opt\local\lib to PATH

h5. Where we are?

* At this point Qt creator Release, Debug builds are working
> Core + Fit + UnitTests + FunctionalTests (not App, GUI)

* cmake Release, Debug builds
> cmake -G "MinGW Makefiles" ../BornAgain
> mingw32-make -j4
> mingw32-make check
>> or cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Debug ../BornAgain