-
Notifications
You must be signed in to change notification settings - Fork 21
/
Cargo.toml
157 lines (135 loc) · 6.29 KB
/
Cargo.toml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
[workspace]
resolver = "2"
members = [
"moly-runner",
"moly-protocol",
"moly-backend",
"moly-fake-backend",
]
exclude = ["packaging/before-packaging-command"]
[package]
name = "moly"
version = "0.1.0"
edition = "2021"
rust-version = "1.79" ## required by cargo-packager
description = "Desktop app for downloading and chatting with AI LLMs"
## Rename the binary to `_moly_app` to avoid naming conflicts
## with the `moly` binary defined by the `moly-runner` crate.
[[bin]]
name = "_moly_app"
path = "src/main.rs"
[dependencies]
moly-protocol = { path = "moly-protocol" }
moly-backend = { path = "moly-backend" }
moly-fake-backend = { path = "moly-fake-backend" }
makepad-widgets = { git = "https://github.com/makepad/makepad", branch = "rik" }
makepad-code-editor = { git = "https://github.com/makepad/makepad", branch = "rik" }
robius-open = "0.1.1"
robius-url-handler = { git = "https://github.com/project-robius/robius-url-handler" }
chrono = "0.4"
directories = "5.0.1"
unicode-segmentation = "1.10.1"
anyhow = "1.0"
serde_json = "1.0"
serde = { version = "1.0.197", features = ["derive"] }
lipsum = "0.9"
rand = "0.8.5"
rfd = "0.14.1"
## Configuration for `cargo packager`
[package.metadata.packager]
product_name = "Moly"
identifier = "com.moxin-org.moly"
category = "Utility"
authors = ["Moxin Organization <moxin-org@github.com>"]
publisher = "moxin-org"
license_file = "LICENSE"
copyright = "Copyright 2023-2024, Project Robius, Moxin Organization"
homepage = "https://github.com/moxin-org"
### Note: there is an 80-character max for each line of the `long_description`.
long_description = """
Moly is a desktop app that lets you browse AI Large Language Models (LLMs),
download them, and run them locally to chat with the models.
Moly uses the Makepad UI framework (https://github.com/makepad/makepad)
and Project Robius platform abstractions (https://github.com/project-robius),
and currently runs on major desktop platforms: macOS and Linux
(Windows support is coming soon).
Moly uses the WasmEdge WASM runtime (https://github.com/WasmEdge/WasmEdge)
to locally run the AI models efficiently across varying hardware.
"""
icons = ["./packaging/app_icon128x128.png"]
out_dir = "./dist"
## Note: the `moly-runner` crate binary is named `moly`,
## while the main `moly` crate binary is named `_moly_app`.
## This is to avoid naming conflicts when packaging the binaries,
## and also ensures that the `moly-runner` binary is the "main" binary
## that gets executed when the user runs "moly" from the command line.
binaries = [
{ path = "moly", main = true },
{ path = "_moly_app", main = false },
]
## The below command 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 Moly project's `resources/` directory to the `./dist/resources/moly` directory.
##
## This is necessary because the `cargo packager` command only supports defining resources at a known path
## (see the below `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.
##
## In addition, on macOS only, we must download the WasmEdge plugins in order to include them
## in the macOS app bundle. This is because macOS apps must include all dependencies in order to pass notarization.
before-packaging-command = """
cargo run --manifest-path packaging/before-packaging-command/Cargo.toml before-packaging
"""
## See the above paragraph comments for more info on how we create/populate the below `src` directories.
resources = [
{ src = "./dist/resources/makepad_widgets", target = "makepad_widgets" },
{ src = "./dist/resources/moly", target = "moly" },
]
## We then build the entire Moly project and set the `MAKEPAD_PACKAGE_DIR` env var to the proper value.
## * For macOS app bundles, this should be set to `../Resources`.
## This only works because the `moly-runner` binary sets the current working directory
## to the directory where the binary is located, which is `Moly.app/Contents/MacOS/`.
## (See the `run_moly` function in `moly-runner/src/main.rs` for more details.)
## In a macOS app bundle, the resources directory is in `Moly.app/Context/Resources/`,
## so that's why we set `MAKEPAD_PACKAGE_DIR` to `../Resources` --- it must be relative to the binary's location,
## which is up one parent directory.
## * For Debian `.deb` packages, this should be set to `/usr/lib/<main-binary-name>`,
## which is currently `/usr/lib/moly-runner`.
## 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 Moly,
## making sure to add `curl` since it is used by an invocation in `moly-runner`.
##
before-each-package-command = """
cargo run --manifest-path packaging/before-packaging-command/Cargo.toml before-each-package
"""
deep_link_protocols = [
{ schemes = ["moly"], role = "viewer" }, ## `name` is left as default
]
[package.metadata.packager.deb]
depends = "./dist/depends_deb.txt"
desktop_template = "./packaging/moly.desktop"
section = "utils"
[package.metadata.packager.appimage]
## `curl` is needed for `moly-runner` to auto-install wasmedge.
bins = ["/usr/bin/curl"]
[package.metadata.packager.macos]
minimum_system_version = "11.0"
frameworks = [
"./wasmedge/WasmEdge-0.14.0-Darwin/lib/libwasmedge.0.dylib",
"./wasmedge/WasmEdge-0.14.0-Darwin/plugin/libwasmedgePluginWasiNN.dylib",
]
## Configuration for `cargo packager`'s generation of a macOS `.dmg`.
[package.metadata.packager.dmg]
background = "./packaging/Moly macOS dmg background.png"
window_size = { width = 960, height = 540 }
app_position = { x = 200, y = 250 }
application_folder_position = { x = 760, y = 250 }
## Configuration for `cargo packager`'s generation of a Windows `.exe` setup installer.
[package.metadata.packager.nsis]
## See this: <https://nsis.sourceforge.io/Docs/Chapter4.html#varconstant>
appdata_paths = [
"$APPDATA/$PUBLISHER/$PRODUCTNAME",
"$LOCALAPPDATA/$PRODUCTNAME",
]