C++ Support on Windows

Hi Everyone

This would be easy for us to address.

The big question is, what commands are standard for us to run? What is best practice? Does anyone have any links to a cpp project or two which is running on Travis to see what we need to do?

It’s probably tough to define a canonical C++ project, as the build systems vary so widely. I’m trying this one:

This is a simple C++ template project I created mostly for personal use. For Windows, I need cmake and Visual Studio, that’s it. I expect mingw might be necessary for other projects. I suspect with those three you can probably cover most use cases for Windows.

1 Like

Hi Josh,
we are currently using this configuration in our project: https://github.com/ebertolazzi/Clothoids/blob/master/.travis.yml

Hi Josh,
I’m pretty sure that the bash language spawns workers that contain the same stuff of “language: cpp”'s workers. Or at least, I can’t find differences… As a temporary workaround it should work.

EDIT (stupid 3 replies restriction :frowning_face: ): After the last @josh post, it is now possible to run the builds with language: cpp. Also cmake is on PATH! Incredible! :smile: Now the YAML is really simpler!

We have removed the restriction for c and cpp jobs on Windows.

I’m also building a new image which should fix an issue with make not being on the PATH correctly.


make is now available on the Windows VMs

1 Like

Excellent, thanks! I’ve tried this, and it is working. I have a bit more to do to complete my configuration for Windows, but it look good.

It looks like msbuild may not be in the PATH. I believe it should be installed as part of the “visualstudio2017buildtools” Chocolately package, which is installed by default. Can it be added to the PATH?

@josh It would be fantastic to also have cmake and msbuild (as noted earlier) in PATH. Currently for projects that use cmake the integration of Windows build is very simple modulo having to modify PATH to be able to run cmake.

@zeux It looks like cmake is in the PATH, but msuild is not. So we’re close. :grinning:

Oh, I missed this - thought only make is. Thanks for the heads up :slight_smile:

Following the example from @MatteoRagni, I was able to get msbuild to run with this configuration:

os: windows
  - MSBUILD_PATH="c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin"
  - ./build.bat

Thanks, this is working great now!

1 Like

@joshpeterson MSBuild is not working for our project… can you see what we did wrong? https://travis-ci.org/turtlecoin/turtlecoin/builds/451024105

EDIT: I got it to work by using MSBuild.exe

1 Like

@joshpeterson MSBuild.exe worked atleast but it is now giving More than one project error… I have searched and found that putting " " might work… but it didn’t… can you think of something what might be the issue

It feels like the command line parsing is not correct. I suspect that “/p:Configuration=Release” is not being parsed as a command line option for msbuild, but rather like it is another project name. I think the shell here is bash, so that forward slash before the “p:” is the problem.

For my project, I call msbuild from a DOS batch file, so I don’t have this issue. I’m not sure about another way to tell Travis to use cmd.exe to run your build though.

@josh any idea on how to get this done? if there isn’t any other way I will try writing the bat file

Is there a specific way to use make? cmake looks good but running make I get:
make: command not found

@dporobic: I suspect you need to ensure make is installed via some package and you will need to set the PATH to make in you YAML configuration file. I something similar for msbuild above.

Thanks for the info @josh . I’m curious to know if someone from the staff could update the list of languages here.

@andy5995 You can file a pull request using the “Edit this page on GitHub” link above the page.

1 Like