quick_start/
quick_start.rs

1use parabuild::Parabuilder;
2use serde_json::{json, to_string_pretty, Value as JsonValue};
3
4fn main() {
5    let project_path = "tests/example_cmake_project"; // your project path
6    let workspaces_path = "workspaces"; // where to store the workspaces, executables, etc.
7    let template_path = "src/main.cpp.template"; // template file in the project
8    let target_executable_file = "build/main"; // target executable file
9    let datas = vec![json!({"N": "10"}), json!({"N": "20"})];
10    let mut parabuilder = Parabuilder::new(
11        project_path,
12        workspaces_path,
13        template_path,
14        &[target_executable_file],
15    );
16    parabuilder.set_datas(datas).unwrap();
17    parabuilder.init_workspace().unwrap();
18    let (run_data, _compile_error_datas, _processed_data_ids): (
19        JsonValue,
20        Vec<JsonValue>,
21        Vec<usize>,
22    ) = parabuilder.run().unwrap();
23    println!("{}", to_string_pretty(&run_data).unwrap());
24    /*
25    [
26        {
27            "data": {
28                "N": "10"
29            },
30            "status": 0,
31            "stderr": "",
32            "stdout": "10\n"
33        },
34        {
35            "data": {
36                "N": "20"
37            },
38            "status": 0,
39            "stderr": "",
40            "stdout": "20\n"
41        }
42    ]
43     */
44}