C++ Support on Windows


#1

I’d love to see C++ support on Windows, via Visual Studio. When I set language: cpp in my .travis.yml file, I see the following error:

The language ‘cpp’ is currently unsupported on the Windows Build Environment.

Thanks, and keep up the great work!


Refactoring multi-platform .travis.yml
#2

Agreed, this would be super cool. Is there a time frame for the addition of new language settings?


#3

I am also interested in C++ support on windows for a number of my projects.


#4

Hi there. I have a test repository that compiles c/c++ on windows with mingw or visual studio using cmake, if you are interested. The builds are available here.

The .travis.yml is set to language:bash. With cpp the worker are stuck on booting. But even with this, I can compile a simple project. Obviously it should be expanded for more complex projects.


#5

Oh, that is interesting. So it does “work”, except that language: cpp is simply blocked early in the process. Unfortunately I have other builds which need language: cpp in my case so changing it to bash is not an option.

I wonder, is there a way to lift the language: cpp restriction?


#6

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?


#7

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.


#8

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


#9

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!


#10

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.


#11

make is now available on the Windows VMs


#12

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.


#13

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?


#14

@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.


#15

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


#16

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


#17

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

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

Thanks, this is working great now!


#18

@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


#19

@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
https://travis-ci.org/turtlecoin/turtlecoin/builds/451307410


#20

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.