Fix(Modules) - Modules working and double build working
This commit is contained in:
parent
669634f19f
commit
8fc83e2f2f
10
Cargo.toml
10
Cargo.toml
|
|
@ -17,16 +17,18 @@ threadpool = "1.8.1"
|
||||||
# For python bindings TODO: make it optionnal
|
# For python bindings TODO: make it optionnal
|
||||||
pyo3 = { version = "0.18.0", features = ["extension-module"] }
|
pyo3 = { version = "0.18.0", features = ["extension-module"] }
|
||||||
|
|
||||||
|
# [build]
|
||||||
|
# target = ["x86_64-unknown-linux-gnu", "x86_64-unknown-windows-gnu"]
|
||||||
|
|
||||||
[profile.release]
|
[profile.release]
|
||||||
panic = 'abort'
|
panic = 'abort'
|
||||||
opt-level = 3
|
opt-level = 3
|
||||||
lto = true
|
lto = true
|
||||||
vere0 = false
|
vere0 = false
|
||||||
|
|
||||||
[lib_rust]
|
[features]
|
||||||
name = "xiv_craft_solver_rust"
|
default = []
|
||||||
path = "src/lib.rs"
|
verbose = []
|
||||||
# crate-type = ["cdylib"]
|
|
||||||
|
|
||||||
[lib]
|
[lib]
|
||||||
name = "xiv_craft_solver"
|
name = "xiv_craft_solver"
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,3 @@ fn main() {
|
||||||
|
|
||||||
()
|
()
|
||||||
}
|
}
|
||||||
// fn main() {
|
|
||||||
// unimplemented!();
|
|
||||||
// }
|
|
||||||
11
src/lib.rs
11
src/lib.rs
|
|
@ -71,12 +71,14 @@ pub fn solve_craft<'a>(recipe: Recipe, stats: Stats, params: Parameters) -> Opti
|
||||||
// Start a threadpool
|
// Start a threadpool
|
||||||
let pool = ThreadPool::new(params.threads);
|
let pool = ThreadPool::new(params.threads);
|
||||||
|
|
||||||
|
#[cfg(feature = "verbose")]
|
||||||
if params.verbose>0{
|
if params.verbose>0{
|
||||||
println!("Solving...\n");
|
println!("Solving...\n");
|
||||||
println!("[P1] Starting phase 1...");
|
println!("[P1] Starting phase 1...");
|
||||||
}
|
}
|
||||||
let phase1_routes = solver::generate_routes_phase1(craft);
|
let phase1_routes = solver::generate_routes_phase1(craft);
|
||||||
|
|
||||||
|
#[cfg(feature = "verbose")]
|
||||||
if params.verbose>0{
|
if params.verbose>0{
|
||||||
println!("[P1] Found {} routes, testing them all...",phase1_routes.len());
|
println!("[P1] Found {} routes, testing them all...",phase1_routes.len());
|
||||||
if params.verbose>1{
|
if params.verbose>1{
|
||||||
|
|
@ -109,6 +111,7 @@ pub fn solve_craft<'a>(recipe: Recipe, stats: Stats, params: Parameters) -> Opti
|
||||||
let phase2_routes = arc_phase2_routes.lock().unwrap();
|
let phase2_routes = arc_phase2_routes.lock().unwrap();
|
||||||
|
|
||||||
// Print the results if verbose
|
// Print the results if verbose
|
||||||
|
#[cfg(feature = "verbose")]
|
||||||
if params.verbose>0{
|
if params.verbose>0{
|
||||||
println!("[P2] Found {} solutions, sorting",phase2_routes.len());
|
println!("[P2] Found {} solutions, sorting",phase2_routes.len());
|
||||||
|
|
||||||
|
|
@ -140,6 +143,7 @@ pub fn solve_craft<'a>(recipe: Recipe, stats: Stats, params: Parameters) -> Opti
|
||||||
let top_route = match valid_routes.iter().max_by_key(|route| route.quality) {
|
let top_route = match valid_routes.iter().max_by_key(|route| route.quality) {
|
||||||
Some(top) => top,
|
Some(top) => top,
|
||||||
None => {
|
None => {
|
||||||
|
#[cfg(feature = "verbose")]
|
||||||
println!("[P2] No route could finish the craft.\n[P2] Runtime {}ms. Now exiting...",now.elapsed().as_millis());
|
println!("[P2] No route could finish the craft.\n[P2] Runtime {}ms. Now exiting...",now.elapsed().as_millis());
|
||||||
return None;
|
return None;
|
||||||
},
|
},
|
||||||
|
|
@ -162,12 +166,15 @@ pub fn solve_craft<'a>(recipe: Recipe, stats: Stats, params: Parameters) -> Opti
|
||||||
content.push("\"focusedSynthesis\"".to_string());
|
content.push("\"focusedSynthesis\"".to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "verbose")]
|
||||||
if params.verbose>2{
|
if params.verbose>2{
|
||||||
println!("[F] Top route {:?}",top_route);
|
println!("[F] Top route {:?}",top_route);
|
||||||
}
|
}
|
||||||
|
|
||||||
println!("Quality: {}/{}", top_route.quality, top_route.recipe.quality);
|
{
|
||||||
println!("\t[{}]", content.join(", "));
|
println!("Quality: {}/{}", top_route.quality, top_route.recipe.quality);
|
||||||
|
println!("\t[{}]", content.join(", "));
|
||||||
|
}
|
||||||
|
|
||||||
// Wait for enter TODO: Remove
|
// Wait for enter TODO: Remove
|
||||||
println!();
|
println!();
|
||||||
|
|
|
||||||
Reference in New Issue