Define C++ as the programming language
definie multiple operating systems – os: linux – os: osx – os: windows
Defines for the Linux Operating System what Distro (and what apt repository) to use, in this case we use Ubuntu Xenial.
Tell the Travis-CI Virtual machine what compiler to use
- Linux: things to be executed to setup the build system Virtual Machine. Here Install the Build and Runtime dependencies for the Program Jamulus that is an open source project. Usually done with apt-get
- OSX: here we use brew (that is preinstalled in the Travis-CI Virtual Machine. we also install the qt5 Libraries.
- Windows: here it gets a bit more complicated. Thanks to the fact, that the Travis-CI runs in some sort of Unix Shell we can use curl to get the required packages (qt-installer and asiosdk2 Libraries). Then we move the ASIO Libraries to the project (those are copyrighted so you can not put them in the github repository because of the licnese) then we run the qt-installer with the script qt-installer-windows.qs that does unattendant/automatic installation.
the commands used to build the project. Travis-CI automatically clones the repository from github and changes to this directory. so you can just run qmake Jamulus.pro (qmake project file of the Project) and then make it (qmake will generate the Makefile that then is used by make)
- Linux: we run qmake Jamulus.pro and make
- OSX: we run qmake -spec macx-xcode Jamulus.pro and xcodebuild -scheme Jamulus build thats the osx/xcode way of compiling qt5 projects
- Windows: then we run cmd /C with all the steps we need
cmd.exe /C 'cd && "C:\Qt\5.12.3\msvc2017\bin\qtenv2.bat" && cd && "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86 && cd "C:\Users\travis\build\braindef\jamulus" && cd && qmake Jamulus.pro && nmake'cd shows us the current path. then we run qtenv2.bat that sets the environment variables for qt5 (&& concats two commands, that is required because otherwise the %path% variable would otherwise get lost). Then we run vcvarsall.bat that sets the environmentvariables for Microsoft Visual Studio (MSVC is preinstalled in the Travis-CI Virtual Machines). Then we run cd C:\…..\braindef\jamulus to get back into the github repository, since the qtenv2.bat changes the directory. then we can run qmake Jamulus.pro and nmake like on the other two operating systems. nmake is the make command from Visual Studio.
Then if you pay at least 60$ per month for a commercial Travis-CI Service then you could deploy the compiled binaries directly to the github-repository under releases. Since I dont have that much money I did not test
The complete files to download:
you must put the first file to .travis.yml in the root of your github repository and the second file qt-installer-windows.qs too.
Create Travis-CI Account:
go to travis-ci.org (do not confuse with travis-ci.com thats the paid one and you need to select the right) and click on “sign up”. if you are already logged in with your github account then you must confirm the travis-ci.org application in github.