Move BuiltinPlugin into ocs_plugin_api (host feature) so out-of-tree crates can implement it, and add export_plugin! to emit the two C symbols a cdylib exposes: ocs_plugin_api_version (checked first, so an ABI-incompatible build never runs) and ocs_plugin_register -> boxed BuiltinPlugin. The host loads every compatible package from the plugins folder at startup via libloading (desktop only), keeps the library resident for the session, and merges its ribbon tab + command dispatch into the same paths as built-ins (honouring enable/disable). The Plugin Manager shows external packages with a Loaded / incompatible status. Approach B: the plugin hands back a boxed trait object, assuming a matching toolchain + ocs_plugin_api version (the version symbol enforces the latter). crates/ocs_example_plugin is the reference cdylib. Part of the #100 extensibility epic (phase 2). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
16 lines
622 B
TOML
16 lines
622 B
TOML
[package]
|
|
name = "ocs_example_plugin"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
description = "Reference external add-on for Open CAD Studio — builds a cdylib the host loads at runtime."
|
|
license = "GPL-3.0-only"
|
|
|
|
# A dynamically-loaded plugin is a C-ABI dynamic library. `cargo build -p
|
|
# ocs_example_plugin` produces target/<profile>/libocs_example_plugin.so (or
|
|
# .dll/.dylib); drop it beside a plugin.toml in the plugins folder.
|
|
[lib]
|
|
crate-type = ["cdylib"]
|
|
|
|
[dependencies]
|
|
# The stable contract, with the runtime `host` surface (HostApi/BuiltinPlugin).
|
|
ocs_plugin_api = { path = "../ocs_plugin_api", features = ["host"] }
|