lux_lib/lua_rockspec/build/
cmake.rs1use std::collections::HashMap;
2
3use mlua::UserData;
4
5#[derive(Debug, PartialEq, Clone)]
6pub struct CMakeBuildSpec {
7 pub cmake_lists_content: Option<String>,
8 pub build_pass: bool,
11 pub install_pass: bool,
14 pub variables: HashMap<String, String>,
15}
16
17impl Default for CMakeBuildSpec {
18 fn default() -> Self {
19 Self {
20 cmake_lists_content: Default::default(),
21 build_pass: default_pass(),
22 install_pass: default_pass(),
23 variables: Default::default(),
24 }
25 }
26}
27
28impl UserData for CMakeBuildSpec {
29 fn add_methods<M: mlua::UserDataMethods<Self>>(methods: &mut M) {
30 methods.add_method("cmake_lists_content", |_, this, _: ()| {
31 Ok(this.cmake_lists_content.clone())
32 });
33 methods.add_method("build_pass", |_, this, _: ()| Ok(this.build_pass));
34 methods.add_method("install_pass", |_, this, _: ()| Ok(this.install_pass));
35 methods.add_method("variables", |_, this, _: ()| Ok(this.variables.clone()));
36 }
37}
38
39fn default_pass() -> bool {
40 true
41}