Solved Write Qt code once and compile it on many platforms
-
-
For open source programs you can use for free Appveyor for Windows and Travis for Linux and OSX. From the Ubuntu host you can also cross compile for android. I never tested the OSX image compiling for iOS but should be doable.
For the chat example we set up a bare bones CI system to make sure that the code compiles everywhere but those platforms allow you to also run unit tests and automate the deploymentQt itself uses a a CI system called Coin
-
I've worked on projects where the target Operating System was RedHat Linux, another developer also working on the same system was using a Windows laptop and Windows 7 to develop and test on, the source code did not have any differences in, however we did have different project files to build for each platform.
This was a few years ago using Qt 5.6
-
@SPlatten said in Write Qt code once and compile it on many platforms:
however we did have different project files to build for each platform.
This should not be necessary, a few ifs in the project file (either qmake or cmake) should be more than enough to have 1 project for every platform.
Visual Studio merges the source structure of the IDE and the build system so sometimes it's just less of a hassle to have a separate vcproj file however it's not advisable for big projects. some careful configuration of CMake allows you to provide VS developers with perfectly usable project files
-
Sorry, my error, we didn't have multiple project files but we did have conditions in the same file for different operating system builds.
-
The Wikipedia page was not clear enough for me; rather baffling actually! I read the introduction of this page for that topic. It seems that CI is for sharing projects mostly. A sharing project or some integration to build a better app was not in question. I don't know why you pointed to that. I look forward to seeing your helpful intention about that and will talk about it more afterwards.
But as a plan B, what do you think of this please:
- Using Qt Creator on Windows for Windows programs
- If there's an interesting program on Windows, I simply copy its code and paste on the Linux Qt Creator and compile it there to have its Linux version.
- Building Android projects using the Arm7 kit on Windows for Android apps using QML.
- For other Oses, like iOS, since there isn't any MacOSX machine to my hands, I have to bow out of that purpose until I get such a machine and then on that will go for producing iOS apps.
-
@tomy Your plan B is perfectly fine.
A CI system however, automates that. You develop on your Windows machine, check in a new revision into the version control system and the CI automatically builds the Linux, mac, Android, iOS version for you.
Regards
-
You develop on your Windows machine, check in a new revision into the version control system and the CI automatically builds the Linux, mac, Android, iOS version for you.
Wow, that would be great if it were that easy as it seems. :)
A couple of questions:
1- Can it work as good as the plan B?
2- Are you sure using a CI system, say, on Windows, it's feasible to create apps for iOS too? (I mean, without a real Apple machine) -
@tomy You would probably set up multiple servers on different operating systems. But that could be in a computing center, so you would not have to care for the hardware.
Probably you can buy such things as on-demand service, I've never searched but I'm sure such service exists.
-
Thank you. I suppose I'd better get back to the plan B. ;)