|
| 1 | +# macOS instructions |
| 2 | + |
| 3 | +For MEGA Desktop App development we are targeting macOS Big Sur, although we are providing |
| 4 | +packages for other versions as well; please check the main README file for a definitive |
| 5 | +list. |
| 6 | + |
| 7 | +# Tools |
| 8 | + |
| 9 | +Downloading the latest stable versions of these tools should generally be Ok. |
| 10 | + |
| 11 | +## Xcode & CMake |
| 12 | + |
| 13 | +Install latest XCode via App Store using your Apple account. |
| 14 | + |
| 15 | +For MEGA Desktop development, we have a working headless build system via CMake |
| 16 | +which we are using the build the installer packages, however, for day-to-day |
| 17 | +development we are primarily using QMake as a team, due to having good Qt |
| 18 | +tooling support and a working system for all the supported platforms. That being |
| 19 | +said, we are using CMake right now to build the 3rdParty dependencies required |
| 20 | +for both SDK and MEGA Desktop and then switching over to QMake + Qt Creator for |
| 21 | +developer convenience. |
| 22 | + |
| 23 | +Please download and copy CMake.app into /Applications (or custom location) using the macOS |
| 24 | +dmg Installer from: |
| 25 | +https://cmake.org/download/ |
| 26 | + |
| 27 | +It is useful to add CMake to the system path in the installer wizard. (for current user is |
| 28 | +fine), so run the following command: |
| 29 | +``` |
| 30 | +$ sudo "/Applications/CMake.app/Contents/bin/cmake-gui" --install |
| 31 | +``` |
| 32 | + |
| 33 | +## YASM (latest version from upstream) |
| 34 | + |
| 35 | +Download and install YASM which is required to build ffmpeg dependency. |
| 36 | +Follow these steps: |
| 37 | +``` |
| 38 | +$ git clone https://github.com/yasm/yasm/ |
| 39 | +$ cd yasm |
| 40 | +$ cmake . |
| 41 | +$ cmake --build . |
| 42 | +$ sudo cmake --install |
| 43 | +``` |
| 44 | + |
| 45 | +# Third-Party dependencies |
| 46 | + |
| 47 | +## Qt SDK (5.12.11) |
| 48 | + |
| 49 | +Install Qt Open Source and Qt Creator using the Qt Online Installer from: |
| 50 | +https://www.qt.io/download-qt-installer |
| 51 | + |
| 52 | +You will have to create an account, even if you only install the Community Editions. |
| 53 | +Install Qt 5.12.11 for macOS; only macOS components are needed during installation. |
| 54 | +A good installation path is `~/Qt`. |
| 55 | + |
| 56 | +## VCPKG |
| 57 | + |
| 58 | +Along with Qt, MEGA Desktop and the MEGA SDK require another dozen or more |
| 59 | +3rdParty libraries to cover all the functionality exposed to our users. We are |
| 60 | +using Microsoft's VCPKG C++ Library Manager for managing our dependencies and we |
| 61 | +employ it automagically from our CMake scripts. You don't have to install it |
| 62 | +manually. |
| 63 | + |
| 64 | +A notable exception from this rule, is the PDFIUM library, which is used to |
| 65 | +create thumbnails for PDF documents. This library is not available in VCPKG for |
| 66 | +the moment, thus we are using a patched version from upstream Chromium Depot |
| 67 | +Tools for the moment. Download our pre-built version from: |
| 68 | +https://mega.nz/file/M1JCRCRa#Ne5sbVD2yZaCt9ijcCaKXs3m_ayfrw0ZovJMdERXRlU |
| 69 | + |
| 70 | +Start decompressing the zip archive as you proceed to the next step. |
| 71 | + |
| 72 | +# Get the source |
| 73 | + |
| 74 | +Open macOS Terminal and clone the Desktop repository: |
| 75 | +``` |
| 76 | +$ mkdir ~/mega/ |
| 77 | +$ cd ~/mega/ |
| 78 | +$ git clone --recursive https://github.com/meganz/MEGAsync.git desktop |
| 79 | +``` |
| 80 | + |
| 81 | +The MEGA SDK is fetched recursively from https://github.com/meganz/sdk.git |
| 82 | + |
| 83 | +# Build everything |
| 84 | + |
| 85 | +This step, will check-out all the 3rdParty dependencies via VCPKG and then |
| 86 | +proceed to build those, the SDK and MEGA Desktop in that order, via CMake. |
| 87 | + |
| 88 | +``` |
| 89 | +$ cd ~/mega/desktop/contrib/cmake |
| 90 | +$ cmake -DEXTRA_ARGS="-DCMAKE_PREFIX_PATH=~/Qt/5.12.11/clang_64" -DTARGET=MEGAsync -DTRIPLET=x64-osx-mega -P build_from_scratch.cmake |
| 91 | +``` |
| 92 | + |
| 93 | +In a short while, but before the build stops because of missing PDFIUM library, you should |
| 94 | +notice `~/mega/3rdparty_desktop/vcpkg` directory being created. You can start copying |
| 95 | +the extracted pdfium subdirectory to the vcpkg directory. |
| 96 | + |
| 97 | +In case the build fails anyway, just run the cmake command again, once pdfium is copied. |
| 98 | + |
| 99 | +# Development using Qt Creator |
| 100 | + |
| 101 | +Now you can open open `src/MEGASync/MEGASync.pro` to start editing and building. Set it up |
| 102 | +as any other Qt QMake based project, using the Qt 5.12.11 kit you installed and set |
| 103 | +matching target architecture. |
| 104 | + |
| 105 | +When building using the QMake project, both the application and the SDK are |
| 106 | +being rebuilt since the latter has its own QMake project files in the |
| 107 | +sub-project at bindings/qt/sdk.pri. Whereas the 3rdParty libs remain the ones |
| 108 | +being already built by CMake. |
| 109 | + |
| 110 | +You might have to generate the initial set of language files so they are found |
| 111 | +by the build system onwards. To do that, in Qt Creator, in the application menu, |
| 112 | +go to Tools -> External -> Linguist and click on Release Translations action. |
| 113 | +You can achieve the same, from the command-line: |
| 114 | +``` |
| 115 | +$ cd ~/mega/desktop/src |
| 116 | +$ ~/Qt/5.12.11/clang_64/bin/lrelease MEGASync/MEGASync.pro |
| 117 | +``` |
0 commit comments