Wireshark-dev: Re: [Wireshark-dev] Update Windows Build Instructions
From: Graham Bloice <graham.bloice@xxxxxxxxxxxxx>
Date: Mon, 5 Jan 2015 17:20:27 +0000


On 5 January 2015 at 17:03, Stephen Fisher <sfisher@xxxxxxx> wrote:
On Mon, Jan 05, 2015 at 08:26:23AM +0000, Graham Bloice wrote:

> CMake can still generate nmake files if you wish, but IMHO the normal
> route would be to generate VS solution files and then build from the
> command line with msbuild, or fire up the IDE and build from there.

I've always liked the idea of using native build environments on each
platform, such as the IDE in VC for Windows.  I assume we use nmake
files now so we can include makefile.common easily.  Is there a
straightforward way to (perhaps through a script) build solution files
for VC and keep them up-to-date from Makefile.common (or similar file)?


Yes, use CMake :-) 

There are other cross-platform build solutions such as SCons, but it's just as bad as CMake (or maybe worse, I haven't tried anything other than a toy project).

Adding a dissector to CMake is as simple as it is for nmake with the bonus that it works for both Windows and Linux (and wherever else CMake is used).  Doing anything else with the CMake build system requires a lot of head scratching as getting the required output from the arcane language of CMake files can be a battle.

I guess nmake was used in the past as a) it's nearly make, and b) the Visual Studio solution files at the time were horrible undocumented blobs that could only be read by the IDE.  Nowadays they're somewhat documented bloated XML blobs that can be built using msbuild (which is quite nice to use).  msbuild will also use multiple threads to build so is can be much quicker.  The other big advantage of VS solution files is that it should make it easier for folks to use the IDE debugger.

I would fire up a CMake build (hint, README.cmake) and try opening the solution in the VS IDE before getting too excited.  The IDE still struggles a lot when given lots of projects and files, although when it gets going it's OK for editing.  Note that adding source files or making build changes in the IDE will only be temporary as CMake will overwrite them. i.e. CMakeLists.txt (and friends) should be modified for permanent changes.

--
Graham Bloice