Search code examples
visual-studiocmakebuildbotninja

How to use together buildbot, cmake, ninja and Visual Studio C++ compiler


My project is built by builbot using cmake and the Visual Studio C++ compiler.

Using "Visual Studio 14 2015 Win64" as generator it works but it builds slowly and I have difficulties to find the source of an error (this is another problem).

So I want to try Ninja but when I set it as the generator it selects the GNU C++ compiler. I found that I should load the vcvarsall.bat before calling Ninja but I don't understand how to do it from buildbot.


Solution

  • The solution was to:

    1. Load vcvarsall.bat as I wrote in the question and suggested by @valiano
    2. Do it using buildbot as suggested in this blog post
    3. Ensure to find the Visual C++ compiler instead of gcc using CMAKE_IGNORE_PATH as suggested in the question linked to by @Florian

    Point 2 summarizes in editing the buildbot.tac file of the worker by adding the following lines:

    from subprocess import check_output
        for v in check_output(['path\\to\\vcvarsall.bat', 
                           'x86', '&&', 'set']).strip().split('\r\n'):
            v = v.split('=', 1)
            os.environ[v[0]] = v[1]