Windows 7 Notes
Version 2 of the uma::bson library was developed almost exclusively on a Parallels Virtual Machine running Windows 7 64 bit OS with Microsoft Visual Studio 2010 building 32 bit applications. The main issue with version 1 of the library was that there were some issues related to memory corruption on Windows 32 bit builds, and the primary objective of version 2 was to fully support Windows 32 and 64 bit builds. The API itself has been redesigned and refactored as noted on the project pages. The following instructions should help you to download the build the library on a Windows machine.
- Download the latest version (tested with 1.4.5) of the Poco library and unarchive as \usr\local\poco. Open the various 32 bit MSVS 2010 projects under Foundation, XML, and Util and build the shared libraries for debug and release targets.
- Download and install the latest (tested with 4.8.4) Qt library for VS 2010 (pre-built binary packages are sufficient).
- Optionally download and install the Qt Visual Studio Addin, and Qt Creator
- Optionally download the current MongoDB binary distribution and unarchive as \usr\local\mongodb. We use the bsondump.exe utility to perform validation on the test bson output as part of the unit test suite.
Most of the instructions on this page assume the following:
- Poco library base directory is \usr\local\poco
- Qt library base directory is \Qt\4.8.4 which is the default install location.
- uma::bson sources checked out to %homepath%\Documents\projects\mongoviewer\bson
Build & Test
A couple of scripts have been provided under the bin folder in the source distribution to help build and run the unit test suite. The bin\win32.bat file is the script that we use to quickly build the API and run the unit test suite. The bin\win64.bat file is set up to build and run the unit test suite for 64 bit builds (see instructions for building 64 bit version of Qt and Poco on the version 1 page).
Launch the Visual Studio Command Prompt for x86 command prompt tool from the VS 2010 menu.
Setting up Qt Creator
Launch Qt Creator and go to Tools->Options. Select the “Build & Run” tab and manually add a new Qt version using the qmake executable that was installed with Qt 4.8.4 (Path should be \Qt\4.8.4\bin\qmake.exe)
Open the bson.pro and test.pro files from the uma::bson project in Qt Creator. It would be best to create a new session (named BSON perhaps), switch to the session and then open the projects. This will save the dependency on the bson.pro project for test.pro project.
Configure the bson and test projects as shown in the screen captures.
bson project set up
Test project build settings
Test project run settings
Note that you will need to modify the PATH variable to include \usr\local\poco\bin (or bin64 if you are building 64 bit library)
Changing Build Type
These are the steps to be performed to move between 64 bit and 32 bit builds:
- In the projects tab in Qt Creator, select the appropriate “Qt version:” setting.
- Rebuild all the sources. If using the batch files, it would be safest to run it from the appropriate command prompt tool from VS 2010/2.
rmdir /s /q build
rmdir /s /q build