Requirements for packaging a Makepad project depend on the target platform. This guide provides an overview of how to package your Makepad application for different platforms, including desktop and mobile.
Due to the release of makepad 1.0 caused robius-packaging-commands tool currently exists resource path copy incomplete problem, it is currently recommended that you use another packaging method for application packaging and distribution.
See the This PR: https://github.com/project-robius/robius-packaging-commands/pull/1
Use the cargo-packager
tool to package your Makepad application.
Before you start packaging your Makepad application, make sure you already install the cargo-packager tool:
This tool helps you create packages for your Makepad application, including generating the necessary files and directories for different platforms.
Then configure your Cargo.toml
file to include the necessary metadata for packaging, also you can create a packager.toml
file to specify additional packaging options.
This Guide use Cargo.toml
as an example, but you can also use packager.toml
to specify packaging options.
And we use the small robius-packaging-commands
CLI tool to run the packaging commands before packaging your Makepad application.
You can install the robius-packaging-commands
tool using the following command:
If you don't want to use the robius-packaging-commands
tool, you can also run the packaging commands manually, but it is recommended to use the tool for convenience.
and manually copy the resources to the output directory.
Such as:
The below command primarily uses cargo-metadata to determine the path of the makepad_widgets
crate on the host build system,and copies the makepad-widgets/resources
directory to the ./dist/resources/makepad_widgets
directory.
We also copy the your app project's resources/
directory to the ./dist/resources/<main-binary-name>
directory.
This is necessary because the cargo packager
command only supports defining resources at a known path
(see the resources = [...]
block below),so we need to copy the resources to a known fixed (static) path before packaging, such that cargo-packager can locate them and include them in the final package.
We then build the entire your app project and set the MAKEPAD
/MAKEPAD_PACKAGE_DIR
env vars to the proper value.
For macOS app bundles, this should be set to .
because we set the apple_bundle
cfg option for Makepad, which causes Makepad to look for resources in the Contents/Resources/
directory,
which is where the resources are located for an Apple app bundle (.app
and .dmg
).
For Debian .deb
packages, this should be set to /usr/lib/<main-binary-name>
, which is currently /usr/lib/<main-binary-name>
.
This is the directory in which dpkg
copies app resource files to when installing the .deb
package.
On Linux, we also strip the binaries of unneeded content, as required for Debian packages.
For Debian and Pacman (still a to-do!) packages, we also auto-generate the list of dependencies required by your application.
See more about cargo-packager
: https://github.com/crabnebula-dev/cargo-packager
install necessary dependencies for packaging:
run the packaging command:
if you already configure your Cargo.toml
file as described above, you can run the packaging command:
if you already configure your Cargo.toml
file as described above, you can run the packaging command:
Luckly, Makepad provides a convenient way to package your app for mobile platforms using cargo-makepad
.
Android can easyly be packaged using cargo-makepad
:
use cargo-makepad
to build the iOS app: