-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathCargo.toml
149 lines (118 loc) · 6.89 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
[package]
name = "sdf-viewer"
version = "1.6.5"
authors = ["Yeicor"]
description = "SDF Viewer"
repository = "https://github.com/Yeicor/sdf-viewer"
license = "MIT or Apache-2.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"] # Required for web and Android.
[features]
default = ["app", "server", "meshers", "native", "file_dialog"]
default-android = ["app", "server", "meshers", "native", "eframe/android-native-activity"]
default-wasm = ["app", "meshers", "web"]
# === ARCH-BASED FEATURES (only to select dependencies' features) ===
web = ["wasmer/js-default", "wasmer-wasix/js-default"]
native = ["wasmer/sys-default", "wasmer-wasix/sys-default", "native_no_wasmer"]
native_no_wasmer = ["poll-promise/tokio"] # Android (Termux) server-only builds can't compile wasmer (and don't need it).
file_dialog = ["klask/rfd"] # Desktop-only file dialog
# === FUNCTIONALITY-BASED FEATURES ===
# The whole app that renders SDFs.
app = ["standalone", "sdf", "sdfdemo", "wasminterpreters", # <-- other features
"three-d", "eframe", "winit", "image", "ehttp", "anyhow", "klask"]
# The simple server to watch and serve files to the app.
server = ["standalone", # <-- other features
"salvo", "notify-debouncer-full", "anyhow", "httpdate", "lru", "tokio/process"]
# Convert the SDF to a 3D model. Adds a command and a toolbar option (if app) for generating triangle meshes
meshers = ["standalone", "sdf", "wasminterpreters", # <-- other features
"ply-rs", "isosurface"]
# An executable that runs a program instead of providing an API, i.e., an app and/or a server
standalone = [
"instant", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", "js-sys", "tracing-wasm", "tracing-subscriber",
"once_cell", "console_error_panic_hook", "tracing", "profiling", "shadow-rs", "tokio", "poll-promise",
"futures-util", "clap"]
# The main SDF trait. Useful for using as a library (remember to disable default features).
sdf = ["auto_impl", "cgmath", "clap"]
# Declares the demo SDF.
sdfdemo = ["sdf"]
# Creates a FFI to be able to export an SDF written in rust as a WASM file to be interpreted by the app.
# This is the only feature required for the library mode.
sdfffi = ["sdf"]
# Publishes the demo SDF through FFI
sdfdemoffi = ["sdfdemo", "sdfffi"]
# The wasm interpreters are neede for the app and the meshers, so a new feature is needed for convenience.
wasminterpreters = ["wasmer", "wasmer-wasix"]
# ========== DEPENDENCIES ==========
[dependencies]
# === RENDERING ===
three-d = { version = "=0.18", default-features = false, features = ["egui-gui"], optional = true }
eframe = { version = "=0.29", features = ["persistence", "glow"], optional = true } # Same as three-d (egui)
winit = { version = "=0.30", optional = true } # Same as eframe
image = { version = "0.25", optional = true } # Required for image loading
# === LOGGING & PROFILING (see also native/web dependencies) ===
tracing = { version = "0.1", optional = true }
profiling = { version = "1.0", features = ["profile-with-tracing"], optional = true } # Provides simpler macro for functions
# === APP HTTP CLIENT ===
ehttp = { version = "0.5", optional = true } # Very simple HTTP client that supports web
# === SERVER ===
salvo = { version = "0.75", optional = true } # Simple HTTP server
notify-debouncer-full = { version = "0.5", default-features = false, optional = true } # Watch for file changes
httpdate = { version = "1.0", optional = true } # Formatting of dates
lru = { version = "0.12", optional = true } # For caching resources
# === WEBASSEMBLY COMPILERS/INTERPRETERS ===
wasmer = { version = "5.0.5-rc1", default-features = false, optional = true } # Very fast WebAssembly runtime for x86_64, wasm32 and ARM64
wasmer-wasix = { version = "0.35", default-features = false, optional = true } # WASI support for wasmer
# === CONFIGURATION & CLI ===
clap = { version = "=3", features = ["derive"], optional = true } # CLI parser. Heavy dependency on this version because of klask.
klask = { git = "https://github.com/Yeicor/klask", default-features = false, optional = true } # CLI to GUI converter
shadow-rs = { version = "0.37", default-features = false, optional = true } # Web does not support the git2 optional dependency, which is unnecessary
# === MESHERS ===
ply-rs = { version = "0.1", optional = true } # Mesh output format
isosurface = { git = "https://github.com/swiftcoder/isosurface", optional = true } # Generate triangle meshes from SDFs
# === MISC ===
auto_impl = { version = "1.2", optional = true } # Automatic trait implementations for Box<_>, &_, etc.
instant = { version = "0.1", default-features = false, features = ["wasm-bindgen"], optional = true } # Cross platform current time
cgmath = { version = "0.18", optional = true } # Math library (shared with three-d)
anyhow = { version = "1.0", optional = true, default-features = false, features = ["std"] } # Error handling
poll-promise = { git = "https://github.com/EmbarkStudios/poll-promise/", rev = "49daf6c1b91be2dbfe59d41ae5547909268c6d46", optional = true } # Polls a future until it resolves
futures-util = { version = "0.3", optional = true } # Async utilities
once_cell = { version = "1.20", optional = true } # Static globals with lazy initialization
# === NATIVE (desktop & mobile) ===
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
tokio = { version = "1.42", features = ["rt-multi-thread", "macros", "sync"], optional = true } # Asynchronous runtime
tracing-subscriber = { version = "0.3", optional = true } # For logging
# === WEB ===
[target.'cfg(target_arch = "wasm32")'.dependencies] # Web dependencies
wasm-bindgen = { version = "0.2", optional = true } # Core bindings
wasm-bindgen-futures = { version = "0.4", optional = true } # Core bindings
tokio = { version = "1.42", features = ["rt", "macros", "sync"], optional = true } # Asynchronous runtime
web-sys = { version = "0.3", optional = true } # Core bindings
js-sys = { version = "0.3", optional = true } # Core bindings
tracing-wasm = { version = "0.2", optional = true } # For logging
console_error_panic_hook = { version = "0.1", optional = true } # For logging
# === BUILD ===
[build-dependencies]
shadow-rs = "0.37" # For build metadata
# ========== RELEASE CONFIGURATION ==========
[profile.release]
lto = true
codegen-units = 1
strip = true
[package.metadata.wasm-pack.profile.release]
wasm-opt = false # https://github.com/rustwasm/wasm-pack/issues/781 (enable this if it works for you, but it fails on CI)
# ========== ANDROID CONFIGURATION ==========
[target.'cfg(target_os = "android")'.dependencies]
log = "0.4"
android_logger = "0.14"
[package.metadata.android]
package = "com.github.yeicor.sdfviewer"
# build_targets = [ "armv7-linux-androideabi", "aarch64-linux-android", "i686-linux-android", "x86_64-linux-android" ]
[package.metadata.android.application]
label = "SDF Viewer"
[package.metadata.android.sdk]
min_sdk_version = 23
target_sdk_version = 35
max_sdk_version = 35
[[package.metadata.android.uses_permission]]
name = "android.permission.INTERNET"