https://github.com/tpoechtrager/osxcross provides a cross compiling toolchain to build from linux for osx.
In principle a very tempting approach, but it will require some work.
I managed to get the crosscompiler working, but not much else.
For building KAsync:
I tried getting qt using the builtin macports, which worked, but lacked qtest.
After commenting qtest I ended up with moc not being found:
[I] _> ~/o/o/s/k/build on master make Scanning dependencies of target KAsync_autogen [ 16%] Automatic MOC for target KAsync Generating MOC source EWIEGA46WW/moc_future.cpp Permission denied AutoMoc: Error: moc process failed for "EWIEGA46WW/moc_future.cpp" AutoMoc: Command: /opt/local/libexec/qt5/bin/moc -I/home/mollekopf/osxcross/osxcross/src/kasync/build/src -I/home/mollekopf/osxcross/osxcross/src/kasync/build/src/KAsync_autogen/include -I/home/mollekopf/osxcross/osxcross/src/kasync/src -I/opt/local/libexec/qt5/lib/QtCore.framework -I/opt/local/libexec/qt5/lib/QtCore.framework/Headers -I/opt/local/libexec/qt5/./mkspecs/macx-clang -F /opt/local/libexec/qt5/lib -DQT_CORE_LIB -DQT_MAC_USE_COCOA -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_FROM_BYTEARRAY -DQT_NO_CAST_TO_ASCII -DQT_NO_DEBUG -DQT_NO_SIGNALS_SLOTS_KEYWORDS -DQT_NO_URL_CAST_FROM_STRING -DQT_USE_FAST_OPERATOR_PLUS -DQT_USE_QSTRINGBUILDER -D_DARWIN_C_SOURCE -D_LARGEFILE64_SOURCE -o /home/mollekopf/osxcross/osxcross/src/kasync/build/src/KAsync_autogen/EWIEGA46WW/moc_future.cpp /home/mollekopf/osxcross/osxcross/src/kasync/src/future.h AutoMoc: Command output: make[2]: *** [src/CMakeFiles/KAsync_autogen.dir/build.make:58: src/CMakeFiles/KAsync_autogen] Error 1 make[1]: *** [CMakeFiles/Makefile2:156: src/CMakeFiles/KAsync_autogen.dir/all] Error 2 make: *** [Makefile:141: all] Error 2
Some further notes:
Minimum OSX is 10.11 (given by xcode 7.3.1) aka darwin 14 git clone https://github.com/tpoechtrager/osxcross.git cd osxcross tools/gen_sdk_package_darling_dmg.sh ../Xcode_7.3.1.dmg mv MacOSX10.11.sdk.tar.xz tarballs/ ./build.sh (accept everything) add /home/mollekopf/osxcross/osxcross/target/bin to $PATH export MACOSX_DEPLOYMENT_TARGET=10.11 osxcross-macports install pstree Fix the symlinks for the .cmake files in macports: sudo ln -s /home/mollekopf/osxcross/osxcross/target/macports/pkgs/opt/local /opt/local ls -l macports/pkgs/opt/local/lib/cmake/Qt5/Qt5Config.cmake
Sample platform file:
Some potentially useful related links:
https://github.com/trezor/trezord/blob/master/CMakeLists.txt
https://github.com/tpoechtrager/osxcross/issues/80
https://github.com/macports/macports-ports/blob/master/mail/gnupg2/Portfile
https://github.com/jpochyla/macdylibbundler/tree/b85856c133d0b4794b540641646e22911ab6c537