MEGA Desktop
repository·master·Indexed 23 days ago
https://github.com/meganz/megasyncAn automated synchronization and backup tool that maintains bidirectional replication between local folders and the MEGA Cloud Drive. Supported on Windows 10+, macOS Catalina 10.15+, and various Debian- and RedHat-based Linux distributions. The project utilizes the MEGA C++ SDK for server communication and employs VCPKG for dependency management, with build support via CMake and Qt Creator.
What's inside megasync
- MEGA Desktop is an automated syncing and backup application that replicates folders between your local computer and your MEGA Cloud Drive. It performs bidirectional synchronization: changes made on your device (including renaming, moving, and deleting) are reflected in the MEGA Cloud Drive, and changes made in the Cloud Drive are reflected in your local synced folders.
Use the MEGA C++ SDK for server access
masterMEGAsync relies on the
MEGA C++ SDKto handle all functionality requiring communication with MEGA servers. The SDK provides the core capabilities of MEGA's client applications, including end-to-end encryption (User Controlled Encryption) and secure data transfers. If you are building custom tools or analyzing the security of MEGA products, you should use the SDK directly rather than attempting to replicate the protocol.SDK Repository:
https://github.com/meganz/sdk
License: Simplified (2-clause) BSD License.Understand the Qt patch directory structure
masterThe
contrib/build_qt/patchesdirectory contains patches applied to Qt submodules before building. Patches are organized by Qt version, then by submodule, and finally by a filename convention that determines application order and target platform.Patch Filename Convention
To control when and how a patch is applied, use the following naming pattern:
<order>.<os>.<name><order>: A 2-digit, zero-padded numerical value (e.g.,00,01). Patches are applied in ascending order.<os>: Specifies the target platform:all: Applied to all platforms.win: Applied only to Windows builds.macx: Applied only to macOS builds.
<name>: The descriptive name of the patch including its extension (e.g.,.diffor.patch).
<Qt Version> ├───<qt submodule> │ <order>.<os>.<name> │ <order>.<os>.<name> │ [...] │ ├───<qt submodule> │ <order>.<os>.<name> │ <order>.<os>.<name> │ [...] [...]Understand the testing framework used in MEGAsync
masterMEGAsync uses two primary frameworks for its automated testing and unit testing suites:
- Catch2: A modern, C++-native framework used for running automated tests on MEGAsync modules.
- Trompeloeil: A thread-safe header-only mocking framework used for mocking in automated tests.
Build the MEGAsync Desktop App
masterOnce configured, use CMake to build the
MEGAsynctarget. You can specify eitherDebugorReleaseconfigurations.Example (Debug build):
cmake --build 'c:\mega\build-x64' --config Debug --target MEGAsyncThe resulting executable will be located in
.\src\MEGASync\<Configuration>\(e.g.,.\src\MEGASync\Debug\).Build instructions for MEGA Desktop
masterTo build the MEGA Desktop application from source, refer to the platform-specific documentation:
- Windows: See
README.win.md - macOS: See
README.mac.md - Linux: See
README.linux.md
- Windows: See
Configure MEGAsync in Qt Creator
masterFor IDE-based development, you can use Qt Creator. After opening the root
CMakeLists.txt, you must manually add theVCPKG_ROOTvariable to the CMake configuration:- Open the
CMakeLists.txtin Qt Creator. - In the "Initial Configuration" tab, add a new key:
VCPKG_ROOT. - Set the value to your VCPKG root directory (e.g.,
~/mega/vcpkg). - Click "Re-configure with Initial Parameters".
- Open the
Install development tools for Windows
masterTo develop the MEGA Desktop App on Windows, you need to install the following tools:
- Visual Studio 2019: Install the Community or Professional Edition via the Visual Studio Installer. You must include the
Desktop Development with C++workload. - CMake: Download the Windows x64 Installer from cmake.org. It is recommended to add CMake to the system
PATHduring installation. - Git: Download Git for Windows. During installation, select
Checkout as-is, commit as-isto prevent line ending conversions and add Git tools to the user environmentPATH. - Windows Terminal: Use Windows Terminal with PowerShell for command-line builds.
- Visual Studio 2019: Install the Community or Professional Edition via the Visual Studio Installer. You must include the
Configure the project with CMake
masterUse CMake to configure the build. You must provide the path to your VCPKG installation using the
-DVCPKG_ROOTflag. It is recommended to build in a separate directory outside of the source tree.Required CMake arguments:
-DVCPKG_ROOT: The absolute path to your VCPKG installation.-S: The path to the desktop application source repository.-B: The path to the directory where the build files will be generated.-DCMAKE_BUILD_TYPE: Set toDebugorRelease.
cd ~/mega cmake -DVCPKG_ROOT='~/mega/vcpkg' -S '~/mega/desktop' -B '~/mega/build_dir' -DCMAKE_BUILD_TYPE=DebugInstall and setup VCPKG
masterMEGA uses Microsoft's VCPKG C++ Library Manager to manage third-party dependencies. You must clone the VCPKG repository to a local directory (e.g.,
c:\mega\) before building the project.mkdir c:\mega\ cd c:\mega\ git clone https://github.com/microsoft/vcpkgSet up VCPKG for dependency management
masterMEGAsync uses Microsoft's VCPKG C++ Library Manager to handle third-party dependencies (including Qt). You must clone the VCPKG repository to a local directory before building the project.
mkdir ~/mega cd ~/mega git clone https://github.com/microsoft/vcpkgDevelop using Qt Creator
masterTo use Qt Creator for development:
- Open the
CMakeLists.txtfile located at the root of the repository. - Select your desired configuration and set the build path.
- Configure VCPKG: In the "Initial Configuration" tab, add a new
VCPKG_ROOTkey for each configuration and set its value to your VCPKG root directory (e.g.,~/mega/vcpkg). - Click "Re-configure with Initial Parameters" and wait for the process to complete.
- Open the