Skip to content

Commit 0a8ac1b

Browse files
Add llvm 19 support (#477)
* feat: Add llvm 19 support * docs: Update changelog
1 parent 236ad27 commit 0a8ac1b

File tree

2 files changed

+31
-9
lines changed

2 files changed

+31
-9
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- Add support for LLVM esp-19.1.2_20250211 (#477)
1112

1213
### Fixed
1314
- Return an error if GET request fails (#471)

src/toolchain/llvm.rs

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ const OLD_LLVM_16_VERSION: &str = "esp-16.0.0-20230516";
2727
const DEFAULT_LLVM_16_VERSION: &str = "esp-16.0.4-20231113";
2828
const DEFAULT_LLVM_17_VERSION: &str = "esp-17.0.1_20240419";
2929
const DEFAULT_LLVM_18_VERSION: &str = "esp-18.1.2_20240912";
30+
const DEFAULT_LLVM_19_VERSION: &str = "esp-19.1.2_20250211";
3031
pub const CLANG_NAME: &str = "xtensa-esp32-elf-clang";
3132

3233
#[derive(Debug, Clone, Default)]
@@ -50,7 +51,10 @@ pub struct Llvm {
5051
impl Llvm {
5152
/// Gets the name of the LLVM arch based on the host triple.
5253
fn get_arch(host_triple: &HostTriple, version: &str) -> String {
53-
if version == DEFAULT_LLVM_17_VERSION || version == DEFAULT_LLVM_18_VERSION {
54+
if version == DEFAULT_LLVM_17_VERSION
55+
|| version == DEFAULT_LLVM_18_VERSION
56+
|| version == DEFAULT_LLVM_19_VERSION
57+
{
5458
let arch = match host_triple {
5559
HostTriple::Aarch64AppleDarwin => "aarch64-apple-darwin",
5660
HostTriple::X86_64AppleDarwin => "x86_64-apple-darwin",
@@ -121,11 +125,18 @@ impl Llvm {
121125
|| (major == 1 && minor < 81)
122126
{
123127
DEFAULT_LLVM_17_VERSION.to_string()
124-
} else {
128+
} else if (major == 1 && minor == 84 && patch == 0 && subpatch == 0)
129+
|| (major == 1 && minor < 84)
130+
{
125131
DEFAULT_LLVM_18_VERSION.to_string()
132+
} else {
133+
DEFAULT_LLVM_19_VERSION.to_string()
126134
};
127135

128-
let name = if version == DEFAULT_LLVM_17_VERSION || version == DEFAULT_LLVM_18_VERSION {
136+
let name = if version == DEFAULT_LLVM_17_VERSION
137+
|| version == DEFAULT_LLVM_18_VERSION
138+
|| version == DEFAULT_LLVM_19_VERSION
139+
{
129140
"clang-"
130141
} else {
131142
"llvm-"
@@ -139,12 +150,14 @@ impl Llvm {
139150
Self::get_arch(host_triple, &version)
140151
);
141152

142-
let file_name_libs =
143-
if version != DEFAULT_LLVM_17_VERSION && version != DEFAULT_LLVM_18_VERSION {
144-
format!("libs_{file_name_full}")
145-
} else {
146-
format!("libs-{file_name_full}")
147-
};
153+
let file_name_libs = if version != DEFAULT_LLVM_17_VERSION
154+
&& version != DEFAULT_LLVM_18_VERSION
155+
&& version != DEFAULT_LLVM_19_VERSION
156+
{
157+
format!("libs_{file_name_full}")
158+
} else {
159+
format!("libs-{file_name_full}")
160+
};
148161

149162
// For LLVM 15 and 16 the "full" tarball was a superset of the "libs" tarball, so if
150163
// we're in extended LLVM mode we only need the "full" tarballs for those versions.
@@ -229,6 +242,14 @@ impl Llvm {
229242
),
230243
"",
231244
);
245+
updated_path = updated_path.replace(
246+
&format!(
247+
"{}\\{}\\esp-clang\\bin;",
248+
llvm_path.display().to_string().replace('/', "\\"),
249+
DEFAULT_LLVM_19_VERSION,
250+
),
251+
"",
252+
);
232253
updated_path = updated_path.replace(
233254
&format!(
234255
"{}\\esp-clang\\bin;",

0 commit comments

Comments
 (0)