Dilvish wrote:
Vezzra wrote:
... but then you need to install Python first, so we are back at square one...
Maybe I'm not properly understanding the context here -- I would think that anyone looking to compile FO could be expected to install python.
Not necessarily. Python isn't required to build FO, and you don't even need a python installation on your computer to run it, because FO ships with it's own python package. This python package of course is included with the SDK, but it's not set up in a way you can use this python environment from within the MSVC IDE.
This problem can be solved by copying a proper python.exe into the project's root directory. You can then set up a custom build event that executes a python script using this python.exe. It will use the python package included with the FO SDK as it's execution context, so the entire python standard library is at your disposal. So in theory the only thing that needs to be done is include the python.exe for python 2.7.3 in the SDK, set up a proper python script and template for version.cpp and you're done.
BUT: I tried that, and the problem I ran into (with my extremly limited knowledge of the MSVC IDE) was that I failed to set up a custom build step or build event in a way that it was triggered every time you start the build process. What I came up with would only work when source files of the "Common" project (to which Version.cpp belongs) had been modified. As soon as you have a new revision that has no file modified that belong to the "Common" project, "Common" is considered up-to-date and it's not being rebuild (and with that no custom build steps or build events are triggered).
Adding the custom build step/event to the "FreeOrion" project was even worse, as it resulted in "Common" being built
before any custom build steps/events for the "FreeOrion" project fired. I tried several things, but nothing worked. And I found no way to add execution of a custom script on the solution level, but that's exactly what would be required. Maybe someone more knowledgeable of the MSVC IDE can help with that.