add cargo-generate template for plugin example

This commit is contained in:
David Hewitt 2023-01-27 08:31:44 +00:00
parent 2228f584a1
commit d7601a4352
5 changed files with 35 additions and 0 deletions

BIN
examples/plugin/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,9 @@
[package]
authors = ["{{authors}}"]
name = "{{project-name}}"
version = "0.1.0"
edition = "2021"
[dependencies]
pyo3 = "{{PYO3_VERSION}}"
plugin_api = { path = "plugin_api" }

View file

@ -0,0 +1,17 @@
[package]
name = "plugin_api"
version = "0.1.0"
description = "Plugin API example"
edition = "2021"
[lib]
name = "plugin_api"
crate-type = ["cdylib", "rlib"]
[dependencies]
#!!! Important - DO NOT ENABLE extension-module FEATURE HERE!!!
pyo3 = "{{PYO3_VERSION}}"
[features]
# instead extension-module feature for pyo3 is enabled conditionally when we want to build a standalone extension module to test our plugins without "main" program
extension-module = ["pyo3/extension-module"]

View file

@ -0,0 +1,4 @@
variable::set("PYO3_VERSION", "0.18.0");
file::rename(".template/Cargo.toml", "Cargo.toml");
file::rename(".template/plugin_api/Cargo.toml", "plugin_api/Cargo.toml");
file::delete(".template");

View file

@ -0,0 +1,5 @@
[template]
ignore = [".nox"]
[hooks]
pre = [".template/pre-script.rhai"]