0
0
mirror of https://github.com/tursodatabase/libsql.git synced 2025-06-17 04:29:47 +00:00

refactor+fix: trying to fix sqlite3mc cross compilation

This commit is contained in:
Levy A.
2024-11-07 10:42:13 -03:00
parent d09ed8230d
commit c74c8eef99

@ -474,19 +474,28 @@ fn build_multiple_ciphers(target: &str, out_path: &Path) {
.unwrap();
if let Some(ref cc) = cross_cc {
if cc.contains("aarch64") && cc.contains("linux") {
cmake_opts.push(&cmake_toolchain_opt);
writeln!(toolchain_file, "set(CMAKE_SYSTEM_NAME \"Linux\")").unwrap();
writeln!(toolchain_file, "set(CMAKE_SYSTEM_PROCESSOR \"arm64\")").unwrap();
} else if cc.contains("x86_64") && cc.contains("darwin") {
cmake_opts.push(&cmake_toolchain_opt);
writeln!(toolchain_file, "set(CMAKE_SYSTEM_NAME \"Darwin\")").unwrap();
writeln!(toolchain_file, "set(CMAKE_SYSTEM_PROCESSOR \"x86_64\")").unwrap();
}
}
if let Some(cc) = cross_cc {
let system_name = if cc.contains("linux") {
"Linux"
} else if cc.contains("darwin") {
"Darwin"
} else {
panic!("Unsupported cross target {}", cc)
};
let system_processor = if cc.contains("x86_64") {
"x86_64"
} else if cc.contains("aarch64") {
"arm64"
} else {
panic!("Unsupported cross target {}", cc)
};
cmake_opts.push(&cmake_toolchain_opt);
writeln!(toolchain_file, "set(CMAKE_SYSTEM_NAME \"{}\")", system_name).unwrap();
writeln!(toolchain_file, "set(CMAKE_SYSTEM_PROCESSOR \"{}\")", system_processor).unwrap();
writeln!(toolchain_file, "set(CMAKE_C_COMPILER {})", cc).unwrap();
}
if let Some(cxx) = cross_cxx {
writeln!(toolchain_file, "set(CMAKE_CXX_COMPILER {})", cxx).unwrap();
}