1

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.

Kleag
  • 642
  • 7
  • 14
  • This answer may be helpful: https://stackoverflow.com/questions/31262342/cmake-g-ninja-on-windows-specify-x64 – valiano Dec 20 '17 at 18:59
  • 1
    Possible duplicate of [Environment variable used by CMake to detect Visual C++ compiler tools for Ninja](https://stackoverflow.com/questions/43069632/environment-variable-used-by-cmake-to-detect-visual-c-compiler-tools-for-ninja) – Florian Dec 20 '17 at 19:50
  • @valiano: I could start the builbot-worker for command line like stated in the answer you point to but then how to do it when starting it as a service like explained here: http://trac.buildbot.net/wiki/RunningBuildbotOnWindows#Service ? – Kleag Jan 11 '18 at 14:20
  • @Kleag sorry, I'm not familiar with it – valiano Jan 11 '18 at 18:39
  • I progressed using both the answers you pointed, valiano and @florian. I completed with the following blog post: https://blog.quickmediasolutions.com/2015/06/04/using-visual-c-express-with-buildbot.htmlhttps://blog.quickmediasolutions.com/2015/06/04/using-visual-c-express-with-buildbot.html . Now, the configuration runs. But it fails later on on the first cmake external project with an error when detecting the cxx compiler. This is a different, while related problem. So I should probably set that as the answer ? – Kleag Jan 31 '18 at 15:51
  • Which version of CMake do use? The external project support is continuously improved. And there are several questions/answers already for external projects not finding their compiler. Since that can have a lot of reasons, it's probably best to put it in another question (including a extract of the external project's error log file). – Florian Jan 31 '18 at 20:20

1 Answers1

1

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]
Kleag
  • 642
  • 7
  • 14