Support setting vector size (3 or 4)

This commit is contained in:
Alex Orlenko 2023-06-15 20:15:51 +01:00
parent e88e1f2a89
commit ab7f49f168
No known key found for this signature in database
GPG Key ID: 4C150C250863B96D
1 changed files with 10 additions and 0 deletions

View File

@ -12,6 +12,8 @@ pub struct Build {
use_longjmp: bool,
// Enable code generator (jit)
enable_codegen: bool,
// Vector size, must be 3 (default) or 4
vector_size: usize,
}
pub struct Artifacts {
@ -31,6 +33,7 @@ impl Build {
max_cstack_size: 100000,
use_longjmp: false,
enable_codegen: false,
vector_size: 3,
}
}
@ -64,6 +67,12 @@ impl Build {
self
}
pub fn set_vector_size(&mut self, size: usize) -> &mut Build {
assert!(size == 3 || size == 4);
self.vector_size = size;
self
}
pub fn build(&mut self) -> Artifacts {
let target = &self.target.as_ref().expect("TARGET not set")[..];
let host = &self.host.as_ref().expect("HOST not set")[..];
@ -109,6 +118,7 @@ impl Build {
// Common defines
config.define("LUAI_MAXCSTACK", &*self.max_cstack_size.to_string());
config.define("LUA_VECTOR_SIZE", &*self.vector_size.to_string());
if self.use_longjmp {
config.define("LUA_USE_LONGJMP", "1");