Add llvm 19 support (#477)

* feat: Add llvm 19 support

* docs: Update changelog
This commit is contained in:
Sergio Gasquez Arcos 2025-02-20 12:39:08 +01:00 committed by GitHub
parent 236ad275b8
commit 0a8ac1b6c8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 31 additions and 9 deletions

View File

@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased] ## [Unreleased]
### Added ### Added
- Add support for LLVM esp-19.1.2_20250211 (#477)
### Fixed ### Fixed
- Return an error if GET request fails (#471) - Return an error if GET request fails (#471)

View File

@ -27,6 +27,7 @@ const OLD_LLVM_16_VERSION: &str = "esp-16.0.0-20230516";
const DEFAULT_LLVM_16_VERSION: &str = "esp-16.0.4-20231113"; const DEFAULT_LLVM_16_VERSION: &str = "esp-16.0.4-20231113";
const DEFAULT_LLVM_17_VERSION: &str = "esp-17.0.1_20240419"; const DEFAULT_LLVM_17_VERSION: &str = "esp-17.0.1_20240419";
const DEFAULT_LLVM_18_VERSION: &str = "esp-18.1.2_20240912"; const DEFAULT_LLVM_18_VERSION: &str = "esp-18.1.2_20240912";
const DEFAULT_LLVM_19_VERSION: &str = "esp-19.1.2_20250211";
pub const CLANG_NAME: &str = "xtensa-esp32-elf-clang"; pub const CLANG_NAME: &str = "xtensa-esp32-elf-clang";
#[derive(Debug, Clone, Default)] #[derive(Debug, Clone, Default)]
@ -50,7 +51,10 @@ pub struct Llvm {
impl Llvm { impl Llvm {
/// Gets the name of the LLVM arch based on the host triple. /// Gets the name of the LLVM arch based on the host triple.
fn get_arch(host_triple: &HostTriple, version: &str) -> String { fn get_arch(host_triple: &HostTriple, version: &str) -> String {
if version == DEFAULT_LLVM_17_VERSION || version == DEFAULT_LLVM_18_VERSION { if version == DEFAULT_LLVM_17_VERSION
|| version == DEFAULT_LLVM_18_VERSION
|| version == DEFAULT_LLVM_19_VERSION
{
let arch = match host_triple { let arch = match host_triple {
HostTriple::Aarch64AppleDarwin => "aarch64-apple-darwin", HostTriple::Aarch64AppleDarwin => "aarch64-apple-darwin",
HostTriple::X86_64AppleDarwin => "x86_64-apple-darwin", HostTriple::X86_64AppleDarwin => "x86_64-apple-darwin",
@ -121,11 +125,18 @@ impl Llvm {
|| (major == 1 && minor < 81) || (major == 1 && minor < 81)
{ {
DEFAULT_LLVM_17_VERSION.to_string() DEFAULT_LLVM_17_VERSION.to_string()
} else { } else if (major == 1 && minor == 84 && patch == 0 && subpatch == 0)
|| (major == 1 && minor < 84)
{
DEFAULT_LLVM_18_VERSION.to_string() DEFAULT_LLVM_18_VERSION.to_string()
} else {
DEFAULT_LLVM_19_VERSION.to_string()
}; };
let name = if version == DEFAULT_LLVM_17_VERSION || version == DEFAULT_LLVM_18_VERSION { let name = if version == DEFAULT_LLVM_17_VERSION
|| version == DEFAULT_LLVM_18_VERSION
|| version == DEFAULT_LLVM_19_VERSION
{
"clang-" "clang-"
} else { } else {
"llvm-" "llvm-"
@ -139,12 +150,14 @@ impl Llvm {
Self::get_arch(host_triple, &version) Self::get_arch(host_triple, &version)
); );
let file_name_libs = let file_name_libs = if version != DEFAULT_LLVM_17_VERSION
if version != DEFAULT_LLVM_17_VERSION && version != DEFAULT_LLVM_18_VERSION { && version != DEFAULT_LLVM_18_VERSION
format!("libs_{file_name_full}") && version != DEFAULT_LLVM_19_VERSION
} else { {
format!("libs-{file_name_full}") format!("libs_{file_name_full}")
}; } else {
format!("libs-{file_name_full}")
};
// For LLVM 15 and 16 the "full" tarball was a superset of the "libs" tarball, so if // For LLVM 15 and 16 the "full" tarball was a superset of the "libs" tarball, so if
// we're in extended LLVM mode we only need the "full" tarballs for those versions. // we're in extended LLVM mode we only need the "full" tarballs for those versions.
@ -229,6 +242,14 @@ impl Llvm {
), ),
"", "",
); );
updated_path = updated_path.replace(
&format!(
"{}\\{}\\esp-clang\\bin;",
llvm_path.display().to_string().replace('/', "\\"),
DEFAULT_LLVM_19_VERSION,
),
"",
);
updated_path = updated_path.replace( updated_path = updated_path.replace(
&format!( &format!(
"{}\\esp-clang\\bin;", "{}\\esp-clang\\bin;",