[Makepad](https://github.com/makepad/makepad) is a cross-platform UI framework written in Rust.
It is in active development, but is already usable to build quick prototypes and simple (or even complicated UI) applications.
One of the key features of the Makepad is its ability to simply, and quickly, build and run applications on multiple platforms, including MacOS, Windows, Linux, Android, iOS, and WebAssembly.
Here are the current/latest instructions on how to build and run Makepad applications on the different platforms.
## Assumptions
We will assume the following:
Name of application: `makepad-example-simple`
It can be changed to any one of the existing example apps in the [*Makepad* examples folder](https://github.com/makepad/makepad).
## Build & Run Instructions
Follow step 1 commands below for initial setup of the Makepad build and run environment.
After step 2, you may choose any one or more of the platforms you're interested in building for.
## 1. Setup Makepad
Replace `projects` with your own directory name.
```bash
cd ~/projects
```
### Clone the Makepad repository
```bash
git clone https://github.com/makepad/makepad.git
```
or
```bash
git clone git@github.com:makepad/makepad.git
```
### Change to latest 'rik' branch (Optional)
```bash
cd ~/projects/makepad
git branch rik
```
### Install makepad subcommand for cargo
```bash
cd ~/projects/makepad
cargo install --path ./tools/cargo_makepad
```
### Install platform toolchains
```bash
rustup toolchain install nightly
```
## 2. Go To Examples folder (Optional)
```bash
cd ~/projects/makepad/examples
ls -l
```
All examples in this directory have the application name of `makepad-example-` prefix plus the name of directory.
## 3. MacOS / PC
Running on Desktop is the quickest way to try out an example app.
```bash
cd ~/projects/makepad/examples/simple
cargo run
```
or
```bash
cd ~/projects/makepad
cargo run -p makepad-example-simple
```
And there should be a desktop application window now running (may need to click on the icon on MacOS's Dock to show it)
## 4. Android Build
### Install Android toolchain (First time)
```bash
cargo makepad android install-toolchain
```
### Install app on Android device or Android emulator
Open either the Android emulator or connect to a real Android device
use `adb` command to make sure there's a single device connected properly, then install and run as below:
```bash
cd ~/projects/makepad
cargo makepad android run -p makepad-example-simple --release
```
The application will be installed and launch on either the emulator or device.
## 5. iOS Setup & Install
### Install IOS toolchain (First time)
```bash
xcode-select --install
cargo makepad apple ios install-toolchain
```
### Install app on Apple devivce or iOS simulator
### iOS Setup
For iOS, the process is slightly more complicated. The steps involved are:
1. Enable your iPhone's Developer Mode, please see instructions here: [Enable Developer Mode](https://www.delasign.com/blog/how-to-turn-on-developer-mode-on-an-iphone/)
1. Setup an Apple Developer account
1. Setup an empty skeleton project in XCode
1. File -> New -> Project to create a new "App"
1. Set the Product Name as **`makepad-example-simple`** (used in --app later)
1. Set the Organization Identifier to a value of your choice, for this example we will use **`my.test`** (used in --org later)
1. Setup the Project Signing & Capabilities to select the proper team account
1. In XCode, Build/Run this project to install and run the app on the simulator and device
1. Once the simulator and device has the "skeleton" app installed and running properly, then it is ready for Makepad to install its application.
### Makepad Install
We will run the `cargo makepad apple ios` command, similar to Android build above, but there are some 2 to 4 additional parameters that need to be filled in:
**`--org`**
First few parts of the organization identifier (which makes up the Bundle Identifier). Usually in the form of **com.somecompany** or **org.someorg**, etc.
This is the same value used to setup the initial skeleton app above. For this example:
> `my.test`
**`--app`**
The name of the application or the project. This is the same as the Product Name used to setup the initial skeleton app above. In this case:
> `makepad-example-simple`
**`--org-id`** (real-device only)
Find the `<key>ApplicationIdentifierPrefix</key>` and use the value in the `<string>ORGIDVALUE</string>`, from the newest `**.mobileprovision` file located in the `~/Library/MobileDevice/Provisioning Profiles` directory.
`ORGIDVALUE` should be a 10 digit alpha-numeric value.
**`--ios-version`** (OPTIONAL)
defaults to 17. Set it to 16 or other values if the device is not running iOS 17.
### Example
For this example, we have the Bundle Identifier of **`my.test.makepad-example-simple`**
### Install app on IOS simulator
```bash
cd ~/projects/makepad
cargo makepad apple ios --org=my.test --app=makepad-example-simple run-sim -p makepad-example-simple --release
```
### Install app on IOS device
```bash
cd ~/projects/makepad
cargo makepad apple ios --org-id=ORGIDVALUE --org=my.test --app=makepad-example-simple run-device -p makepad-example-simple --release
```
The application will be installed and launched on either the emulator or real device.
## 5. WASM Build
*Coming Soon*
---
---
This device has reached the maximum number of installed apps using a free developer profile: {(
"6EM34J2VW2.rs.robius.taobao",
"6EM34J2VW2.rs.robius.comp-demo",
"6EM34J2VW2.rs.robius.wonderous"
)}
Verify that the Developer App certificate for your account is trusted on your device. Open Settings on the device and navigate to General -> VPN & Device Management, then select your Developer App certificate to trust it.
Unable to Install “anyapp”
Domain: IDEInstallCoreDevice
Code: 0
Recovery Suggestion: This device has reached the maximum number of installed apps using a free developer profile: {(
"6EM34J2VW2.rs.robius.taobao",
"6EM34J2VW2.rs.robius.comp-demo",
"6EM34J2VW2.rs.robius.wonderous"
)}
Verify that the Developer App certificate for your account is trusted on your device. Open Settings on the device and navigate to General -> VPN & Device Management, then select your Developer App certificate to trust it.
User Info: {
DVTErrorCreationDateKey = "2024-01-06 01:03:15 +0000";
IDERunOperationFailingWorker = IDEInstallCoreDeviceWorker;
}
--
Failed to install the app on the device.
Domain: com.apple.dt.CoreDeviceError
Code: 3002
User Info: {
NSURL = "file:///Users/edwardtan/Library/Developer/Xcode/DerivedData/anyapp-awhflyhxbfhdkabtvbgoxjpxaipu/Build/Products/Debug-iphoneos/anyapp.app/";
}
--
Unable to Install “anyapp”
Domain: IXUserPresentableErrorDomain
Code: 14
Failure Reason: This app cannot be installed because its integrity could not be verified.
Recovery Suggestion: This device has reached the maximum number of installed apps using a free developer profile: {(
"6EM34J2VW2.rs.robius.taobao",
"6EM34J2VW2.rs.robius.comp-demo",
"6EM34J2VW2.rs.robius.wonderous"
)}
--
This device has reached the maximum number of installed apps using a free developer profile: {(
"6EM34J2VW2.rs.robius.taobao",
"6EM34J2VW2.rs.robius.comp-demo",
"6EM34J2VW2.rs.robius.wonderous"
)}
Domain: MIInstallerErrorDomain
Code: 13
User Info: {
FunctionName = "-[MIFreeProfileValidatedAppTracker _onQueue_addReferenceForApplicationIdentifier:bundle:error:]";
LegacyErrorString = ApplicationVerificationFailed;
LibMISErrorNumber = "-402620383";
SourceFileLine = 171;
}
--
Event Metadata: com.apple.dt.IDERunOperationWorkerFinished : {
"device_isCoreDevice" = 1;
"device_model" = "iPhone16,1";
"device_osBuild" = "17.2.1 (21C66)";
"device_platform" = "com.apple.platform.iphoneos";
"dvt_coredevice_version" = "355.7.6";
"dvt_mobiledevice_version" = "1643.60.2";
"launchSession_schemeCommand" = Run;
"launchSession_state" = 1;
"launchSession_targetArch" = arm64;
"operation_duration_ms" = 1290;
"operation_errorCode" = 0;
"operation_errorDomain" = IDEInstallCoreDevice;
"operation_errorWorker" = IDEInstallCoreDeviceWorker;
"operation_name" = IDERunOperationWorkerGroup;
"param_debugger_attachToExtensions" = 0;
"param_debugger_attachToXPC" = 1;
"param_debugger_type" = 3;
"param_destination_isProxy" = 0;
"param_destination_platform" = "com.apple.platform.iphoneos";
"param_diag_MainThreadChecker_stopOnIssue" = 0;
"param_diag_MallocStackLogging_enableDuringAttach" = 0;
"param_diag_MallocStackLogging_enableForXPC" = 1;
"param_diag_allowLocationSimulation" = 1;
"param_diag_checker_tpc_enable" = 1;
"param_diag_gpu_frameCapture_enable" = 0;
"param_diag_gpu_shaderValidation_enable" = 0;
"param_diag_gpu_validation_enable" = 0;
"param_diag_memoryGraphOnResourceException" = 0;
"param_diag_queueDebugging_enable" = 1;
"param_diag_runtimeProfile_generate" = 0;
"param_diag_sanitizer_asan_enable" = 0;
"param_diag_sanitizer_tsan_enable" = 0;
"param_diag_sanitizer_tsan_stopOnIssue" = 0;
"param_diag_sanitizer_ubsan_stopOnIssue" = 0;
"param_diag_showNonLocalizedStrings" = 0;
"param_diag_viewDebugging_enabled" = 1;
"param_diag_viewDebugging_insertDylibOnLaunch" = 1;
"param_install_style" = 0;
"param_launcher_UID" = 2;
"param_launcher_allowDeviceSensorReplayData" = 0;
"param_launcher_kind" = 0;
"param_launcher_style" = 99;
"param_launcher_substyle" = 8192;
"param_runnable_appExtensionHostRunMode" = 0;
"param_runnable_productType" = "com.apple.product-type.application";
"param_structuredConsoleMode" = 1;
"param_testing_launchedForTesting" = 0;
"param_testing_suppressSimulatorApp" = 0;
"param_testing_usingCLI" = 0;
"sdk_canonicalName" = "iphoneos17.2";
"sdk_osVersion" = "17.2";
"sdk_variant" = iphoneos;
}
--
System Information
macOS Version 14.2.1 (Build 23C71)
Xcode 15.1 (22502) (Build 15C65)
Timestamp: 2024-01-05T17:03:15-08:00