Wednesday, November 07, 2018

Compiling QuantLib with Visual Studio 2017 and boost 1.68

This post is a self-reminder.
Once QuantLib binaries are created as described below - you should reference .NET assembly (NQuantLib.dll) and have native .Dll (NQuantLibc.dll) to be added as a Context file with "Copy always" attribute in "Copy to Output directory".
Compiling QuantLib for Visual Studio 2017
1.     Make sure VS 2017 setup installed with Windows 8.1 SDK:

2.     Download pre-compiled boost library for VC 14 (x64 version) from
  Install boost binaries boost_1_68_0-msvc-14.1-64.exe to C:\Boost\boost_1_68_0
3.    Add C:\Boost\boost_current.props file (e.g. download from, e.g.:

5.    Unpack SWIG to C:\SWIG\swigwin-3.0.12
6.    Add C:\SWIG\swigwin-3.0.12 to system PATH environment variable
7.    Unpack QuantLib to C:\QuantLib\QuantLib-1.13
8.    Unpack QuantLib-SWIG to C:\QuantLib\QuantLib-SWIG-1.13
9.    Modify  C:\QuantLib\QuantLib-1.13\QuantLib.props by including the following section:

10.  Enable (uncomment) QL_ENABLE_THREAD_SAFE_OBSERVER_PATTERN in ql\userconfig.hpp file
11.  Build QuantLib.sln
12.  Run the swig.cmd file located in QuantLib-SWIG\CSharp folder
13.  Modify C:\QuantLib\QuantLib-SWIG-1.13\CSharp\QuantLib.props by including the following section:

14.  Build C:\QuantLib\QuantLib-SWIG-1.13\CSharp\QuantLib.sln
15.  Use the following residuals:
·         C:\QuantLib\QuantLib-SWIG-1.13\CSharp\cpp\bin\vc141\x64\Debug\NQuantLibc.dll
·         C:\QuantLib\QuantLib-SWIG-1.13\CSharp\cpp\bin\vc141\x64\Debug\QuantlibWrapper.pdb
·         C:\QuantLib\QuantLib-SWIG-1.13\CSharp\csharp\bin\vc141\x64\Debug\NQuantLib.dll
·         C:\QuantLib\QuantLib-SWIG-1.13\CSharp\csharp\bin\vc141\x64\Debug\NQuantLib.pdb