I have successfully compiled the ramreduceleveldb branch on vc11 x86 (msvs2012 express). The method outlined can be reproduced on vc9/10 (msvs 2008/2010) with no extra changes to either projects (leveldbwin and armoryengine_msvs2005). Keep in mind that to since the compile relies on a library compilation of leveldbwin, you need to compile armory with the same compiler as you used for leveldb. (Don't go around building leveldb with vc9 and then linking it to an armory project built with vc11)
Note: this is a compile of armoryengine_msvs2005 project only, not the SWIG to python part, which is trivial in this case from what I understand of the project (i don't know squat about python and swig). The compile is untested, I simply went as far as yielding a ArmoryEngine_MSVS2005.dll (no main declared in this branch)Step #1: leveldbGrab leveldbwin from the google project page:
https://code.google.com/p/leveldbwin/1) Pick the project of your liking in the build folder (msvc9 or msvc10). I used msvc10 and converted the project to msvc11 since this is my compiler.
1.a) To compile you need ATL. If you're using an express version of msvc, you'll have to install WinDDK 7.1 (Driver Development Kit):
http://www.microsoft.com/en-us/download/details.aspx?id=11800. Make sure you grab 7.1 and not 8.0 or WinSDK as those do not support ATL anymore. Skip this step if you have a pay version of msvs.
2) In the configuration manager, pick Release (for the static lib compilation). Don't bother compiling test, you don't need it. I used snappy for compilation, so no defines to drop at this point.
3) Right click each project (leveldb and snappy), go to "Config properties -> C/C++ -> Code generation". Make sure Runtime Library is set as Multi Threader (/MT). This defines whether the C librairies used to compile are statically or dynamically linked. My understanding of this project is that you'd rather not distribute msvc runtime binaries so stick to static compile.
4) Rebuild the project, pick up leveldb.lib in ./_exports/Release and shove it where you want to have it for the armory compile (either make a new folder for it or directly link to it from the project)
Step #2: ArmoryHere is the list of all the modifications I did to the code and the project to get it to compile:
changes to armory bitcoin for msvc compilation:
# added compiler directives in binarydata.h to not manually define int types on vc10+
# added compiler directives in log.h to not overload logstream and children class >> operator with
both size_t and unsigned int arguments in msvc. They're considered the same and the compiler will
complain about method redefinition.
# added leveldb include folder to msvc project
# excluded FileDataPtr and BlockUtilsTest from msvc project (not in the branch but in the msvc project)
# added leveldb_wrapper.cpp to project
# added StoreBlockObj.cpp to project
# NowTimeInt wasn't defined for win32 (log.h). Defined it by copying the non win32 code and including
. This version of time returns the amount of seconds since the unix epoch on my machine
(win7 x64 sp1). It's safe to assume all version of windows will behave in such fashion as this library is
wrapped around a WinAPI call on Windows.
# added new folder to hold static leveldb.lib
# added leveldb.lib to addional dependencies
# changed project from .exe to .dll as there is no main defined (probably cause there is no test code)
# got rid of build events for armoryengine_msvs2005.sln
# make sure you're using Multi Threaded (/MT) for the runtime library.
# rebuild only the armoryengine_msvs2005 project so that it doesn't trigger errors with the custom build events failing to grab guardian or py2exe.
voila
Note: I first tried to dynamically link leveldb to armory, but it failed to export leveldb::DestroyDB properly. The issue disappeared with the static link so I stuck to that for now. On top of that leveldbwin has no x64 build setup, so I'll consider making my own compile of leveldb to allow for dynamic linking and x64 releases.
There are about 100 warnings, 90% of them are related to possible data loss due to assignment without type casting. The rest seems to be msvc complaining about unsafe routines. Both cases are irrelevant.