Fix(Modules) - Finally managed to get both to compile

This commit is contained in:
Dandaedre 2023-02-20 06:45:53 +01:00
parent 34c7cf86ed
commit 669634f19f
6 changed files with 37 additions and 33 deletions

2
Cargo.lock generated
View File

@ -552,7 +552,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "447660ad36a13288b1db4d4248e857b510e8c3a225c822ba4fb748c0aafecffd"
[[package]]
name = "xiv_craft_solver_lib"
name = "xiv_craft_solver"
version = "0.1.2"
dependencies = [
"clap",

View File

@ -1,5 +1,5 @@
[package]
name = "xiv_craft_solver_lib"
name = "xiv_craft_solver"
version = "0.1.2"
edition = "2021"
authors = ["谭俊健","Dandaedre"]
@ -21,15 +21,21 @@ pyo3 = { version = "0.18.0", features = ["extension-module"] }
panic = 'abort'
opt-level = 3
lto = true
vere0 = false
[lib_rust]
name = "xiv_craft_solver_rust"
path = "src/lib.rs"
# crate-type = ["cdylib"]
[lib]
name = "xiv_craft_solver_lib"
name = "xiv_craft_solver"
path = "src/lib.rs"
crate-type = ["cdylib"]
crate-type = ["cdylib","rlib"]
[[bin]]
name = "xiv_craft_solver"
path = "src/bin/bin.rs"
name = "ffcraft"
path = "src/bin/ffcraft.rs"
[tool.maturin]
python-source = "python"

View File

@ -3,7 +3,7 @@ requires = ["maturin>=0.14,<0.15"]
build-backend = "maturin"
[project]
name = "ffxiv"
name = "xiv_craft_solver"
requires-python = ">=3.7"
classifiers = [
"Programming Language :: Rust",

View File

@ -1,25 +0,0 @@
// // #![warn(missing_docs,unsafe_code,unstable_features,)]
// #[allow(dead_code)]
// use clap::Parser;
// use xiv_craft_solver_lib;
// #[derive(Debug)]
// struct CustomError(String);
// fn main() {
// let args = xiv_craft_solver_lib::Args::parse();
// let params = xiv_craft_solver_lib::Parameters{
// depth: args.depth,
// threads: args.threads,
// verbose: args.verbose,
// };
// let (recipe,stats) = xiv_craft_solver_lib::load_from_config(&args.recipe_name, &args.file_name, &args.character_name);
// xiv_craft_solver_lib::solve_craft(recipe,stats,params);
// ()
// }
fn main() {
unimplemented!();
}

23
src/bin/ffcraft.rs Normal file
View File

@ -0,0 +1,23 @@
// #![warn(missing_docs,unsafe_code,unstable_features,)]
use clap::Parser;
use xiv_craft_solver;
#[derive(Debug)]
struct CustomError(String);
fn main() {
let args = xiv_craft_solver::Args::parse();
let params = xiv_craft_solver::Parameters{
depth: args.depth,
threads: args.threads,
verbose: args.verbose,
};
let (recipe,stats) = xiv_craft_solver::load_from_config(&args.recipe_name, &args.file_name, &args.character_name);
xiv_craft_solver::solve_craft(recipe,stats,params);
()
}
// fn main() {
// unimplemented!();
// }

View File

@ -56,7 +56,7 @@ pub fn pouet()-> &'static str {
/// A Python module implemented in Rust.
#[pymodule]
fn xiv_craft_solver_lib(_py: Python, m: &PyModule) -> PyResult<()> {
fn xiv_craft_solver(_py: Python, m: &PyModule) -> PyResult<()> {
m.add_function(wrap_pyfunction!(pouet, m)?)?;
Ok(())
}