Compiling a Qt application for Mac OS X on Linux - c++

I'm developing a Qt application and I need to support Linux, Windows and Mac OS X. The only problem however is that I do not own a Mac. Is it possible to compile my application for Mac OS X on Linux and package it in a .dmg file?
I'm also worried with the fact that my application depends on OpenSSL, can I compile OpenSSL for Mac OS X on my Linux machine?
Thank you.

How do you want to support Mac if you can't even test if your software works?
Cross-compilation for OS X: I doubt there is any solution out there (I'd love to learn about it if it is), you'd need the whole SDK and toolchain for that.
For the .dmg file creation part, there is another question here:
How to build a dmg Mac OS X file (on a non-Mac platform)?
There should be no need to bundle openssl, as it's part of every OS X installation.
If you want to support Mac you need to Mac, access to one (remote, rented etc.), or someone who does it for you. I don't think you have another choice.
As the accepted answer in
How to Compile for OS X in Linux or Windows?
suggests, you can go for Macports in case you develop free software. It does the compiling on the user's machine (think FreeBSD ports or Gentoo's emerge). Still, that will require testing.

Related

How to compile C++ for Mac OS X using Visual Studio on Windows and CMake

I read that Visual Studio now supports cross-platform development. I'm using CMake to compile for Windows and Ubuntu (using WSL) so far. However there doesn't seem to be any information on how to actually accomplish the cross-compilation using Visual Studio to target Mac OS X. Is it doable with the CMakeSettings.json? According to this article, you can choose Linux-Debug and Linux-Release as configurationType but in Visual Studio 2017 Enterprise the Linux options aren't even available for me, neither is Mac OS X.
I might just setup a virtual machine as suggested in this post which seems to be the most convenient solution to get the job done.
Apparently you can't.
I ended up installing a virtual machine with Mac OS X and successfully compiled my code inside it using shared folders to make my Windows host source code available to the guest. This is certainly more reliable and sane to do than some hacky cross-compilation project. The latter still doesn't guarantee that the code will successfully run and not unexpectedly crash on the cross-compilation target operating system.
Alternatively, if you can get your hands on an (old) Macbook or so you can use that and enable network sharing to your main machine (e.g. a Windows PC). This way you can grab freshly compiled binaries directly from your Macbook using Windows and you're set with compiling your macOS builds.

Do I have to be on a specific OS to compile for a specific OS when using Qt?

When I was using pyqt it was necessary to compile for mac on a mac, instead of being able to export a build for mac from linux (or windows, or whatever)
Now that I'm using straight c++ development, does this fact change at all? Or must I still compile for a given OS on the given OS?
Ideally I'd love to be able to just pick a platform and compile for it. Unity3d does this, but I imagine I'm comparing apples and oranges at this point.
Is this possible? Or do I got to find a friend with a mac? Cuz I don't have no friends... ;)
Typically yes, you have to. In some cases you can cross-compile, for example, this is available stock for android apps, as there is no Qt SDK that can run on android cross-compilation is the only option. You can also build a custom Qt to cross-compile to another OS. This is not available by default, it requires a custom build.
However, when it comes to ios or macos cross-compilation is not an option, as far as I know there is no way around but to compile under macos.

Requiring OS X >= Lion for an application

One of the open source software I'm contributing to has recently started using features that are only available on OS X 10.7 and later. We'd like to detect at startup time (or preferably before the program is even started, if some DMG metadata allows for that) if a user is using an older version of OS X and display a message telling him to upgrade his OS (or use an older version of our software).
What is the best way to do this? I'm not an OS X developer so please keep it as simple as possible :)
You can do it using methods in the C std library. This question explains how Getting the OS version in Mac OS X using standard C
As mentioned in the comments this was deprecated in 10.8. This question explains a work around for the time being How do I determine the OS version at runtime in OS X or iOS (without using Gestalt)?

Decent cross-compiler for Mac OS X targets

I'm developing an SDL application in C++, and some of my consumers have asked for a version that runs on Mac OS X. I am wondering if anyone knows of a good cross-compiler for Mac OS X targets, and maybe a Mac OS X emulator (maybe a virtual HDD for Virtual Box?) so that I can actually test it myself.The emulator is not 100% necessary though, as it's probably illegal and I can understand if nobody's willing.
I'm using a PC (Windows XP) for my host machine, and I don't have the funding to go and purchase a Mac, sadly.
The easiest, and most common, solution is the other way: use a Mac platform with Windows installed either as dual boot or in a virtual machine.
That way you will benefit of 100% of both worlds and never be bothered whenever a Mac system update is delivered.
Bonus: You can install Linux as well.

What hardware / software do I need to port my C++/wxWidgets app to the MAC?

I have a C++/wxWidgets codebase and I'm starting to think about porting it across to Linux and the Mac OS X.
What hardware / software do I need (or is recommended) to code on the Mac platform? Currently I use Visual Studio to develop in and Innosetup to do my packaging.
The Mac equivalent of Visual Studio is Xcode (assuming you have a Mac :-), which includes the Mac port of gcc.
http://developer.apple.com/xcode/
For Mac development, the simplest and easiest solution is to use Xcode on Mac OS X.
You might be able to virtualize that on your Windows box, or install it as second OS depending on your hardware, but the path of least resistance is to develop with an actual Mac in front of you.
You can use IMCROSS to set up an environment for targeting Windows and MacOS X from Linux.