v8embedded-v8

Is it possible to build Google V8 engine using Microsoft VC++ compiler?


Some time ago I used instruction from V8 developers how to build V8 using their old metabuild system GYP and Microsoft VC++ compiler (from Visual Studio). It was pretty simple: use GYP to generate .sln file, build it with Microsoft VC++ compiler. Unfortunately, this instruction is not available anymore, because Google switched to another metabuild system (called GN) and abandoned GYP.

That's not really a problem, because GN also can create sln file - but, as far as I understand, they don't support Microsoft compiler anymore. They ship and use clang to build V8 on Windows (even when you build it from Visual Studio).

So, my question is: is it possible for current trunk of V8 code to create sln file, which can be opened in Visual Studio (let's say 2017) and can be build using Microsoft C++ compiler ?


Solution

  • These are three separate questions: (1) Is it possible to use GN to generate .sln files to open in Visual Studio? (2) Is it possible to compile V8 with the MSVC compiler? (3) Is it possible to build V8 from within Visual Studio?

    (1) Yes. In short, run gn gen --ide=vs. See https://www.chromium.org/developers/gn-build-configuration.

    (2) Yes. Put is_clang = false into your args.gn (editable by running gn args out\my_build_folder), then compile with ninja as usual. This is continuously tested, so it's guaranteed to keep working (as long as the MSVC compiler is officially supported by V8).

    (3) I don't think so. You can try with the generated .sln, but the build process is fairly complicated (several stages of building one tool and then running it to generate output used by the next step), and I think the .sln mostly just contains a list of files, but no specific instructions for how to compile them.