spesmilo/libbitcoin — pull request #37 by evoskuil (2014-03-12 07:41:28+00:00)
Title: Visual Studio 2013 (CTP_Nov2013) Solution

**Platform**
Due to the extensive use of C++11 features [Visual Studio 2013](http://www.visualstudio.com/downloads) and the [CTP_Nov2013](http://www.microsoft.com/en-us/download/details.aspx?id=41151) compiler are required for build. Free versions of Visual Studio are available.

**Dependencies**
I succeeded in ensuring that all dependencies could be loaded with the [nuget](http://www.nuget.org/packages/openssl/) package manager, which is an open source tool integrated into the VS2013 IDE (along with git). The update includes `packages.config` files which reference the package dependencies of each project.

The easiest setup is to place a [nuget.config](http://docs.nuget.org/docs/reference/nuget-config-file) file in a parent directory of the source projects, directing all projects to a shared package library directory. This will automatically be picked up by nuget as long as there is no local or intermediate file (e.g. created by default when nuget is first used):

```

```

The packages are all open source and can be downloaded from the VS2013 package. Upon opening a solution's package manager the user is given an option at the top of the dialog to download all dependent packages (which can take 10 minutes or so on a fast network). I've verified that this works from a clean deployment.

**Packaging Issue**
There is a problem resulting from the fact that the compiler we are using is newer than that targeted by any of the packages. Some of the package targeting conditions are not met and have to be worked-around. This should resolve itself eventually as the packages are updated. I created a github repo with a patch and instructions for each of the four package sets affected, see:

* [libssh2-nuget-targets](https://github.com/evoskuil/libssh2-nuget-targets)
* [zlib-nuget-targets](https://github.com/evoskuil/zlib-nuget-targets)
* [curl-nuget-targets](https://github.com/evoskuil/curl-nuget-targets)
* [openssl-nuget-targets](https://github.com/evoskuil/openssl-nuget-targets)

Following the above instructions will result in a good build until the package manager is opened, at which time nuget will refresh the packages. For convenience I created a simple batch file to move the files from the above repos into the correct locations (relative to your nuget repo of course):

```
@ECHO OFF
ECHO Update nuget target files for support of VS2013 and CTP_Nov2013 compilers.

ECHO Copying curl...
COPY curl-nuget-targets\curl.targets ..\nuget\curl.7.30.0.2\build\native\
COPY curl-nuget-targets\curl.redist.targets ..\nuget\curl.redist.7.30.0.2\build\native\

ECHO Copying libssh2...
COPY libssh2-nuget-targets\libssh2.targets ..\nuget\libssh2.1.4.3.3\build\native\
COPY libssh2-nuget-targets\libssh2.redist.targets ..\nuget\libssh2.redist.1.4.3.3\build\native\

ECHO Copying openssl...
COPY openssl-nuget-targets\openssl.targets ..\nuget\openssl.1.0.1.24\build\native\
COPY openssl-nuget-targets\openssl.redist.targets ..\nuget\openssl.redist.1.0.1.24\build\native\

ECHO Copying zlib...
COPY zlib-nuget-targets\zlib.targets ..\nuget\zlib.1.2.8.6\build\native\
COPY zlib-nuget-targets\zlib.redist.targets ..\nuget\zlib.redist.1.2.8.6\build\native\

PAUSE
```

**Source Updates**
I've eliminated all errors and warnings resulting from minor compiler differences. Some of these were legitimate potential issues, mostly pertaining to narrowing. Others are just compiler nits that I eliminated through explicit conversions where it was safe to do so.

There was also some disagreement between compilers regarding the interpretation of the C++11 specification, which is not surprising. These were easily worked around, but the comments should be reviewed in order to avoid re-introducing such issues in the future.

LevelDB has documented issues with Unicode, which necessitated a couple of minor changes that should be reviewed.

It was necessary to add a time-based function as a fill for Windows which I implemented conditionally (as was done for OSX).

**Build**
There is a new builds directory which contains sub-directory for x86 debug and release builds. I've tried to follow the cross-compile conventions utilized by ZMQ as closely as possible. Open the `libbitcoin.sln` file to launch the the solution and view the project.

**Use**
This is a first step, the library compiles and links properly from the example in libwallet (which is also updated). I stepped through the libwallet example and encountered a failure due to an array overflow. I'll be looking into that shortly. I'll also be creating projects for the libbitcoin examples.