Skip to content

Commit 4ac5cb7

Browse files
authored
Merge pull request #113 from matt-cornell/no-llvm-15
Disable LLVM 15
2 parents d1a1469 + 464cd54 commit 4ac5cb7

File tree

4 files changed

+18
-58
lines changed

4 files changed

+18
-58
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ To build from source, use:
88
```bash
99
cargo install --git https://github.com/matt-cornell/cobalt-lang
1010
```
11-
By default, builds link dynamically to LLVM 16. They can also statically link to it by enabling the `prefer-static` or `force-static` features. LLVM 15 can be linked to instead with the `llvm-15` feature.
11+
By default, builds link dynamically to LLVM 16. They can also statically link to it by enabling the `prefer-static` or `force-static` features.
1212
## Language features
1313
- Modern programming features without a focus on compatibility with an outdated standard
1414
- First-class functions, arrays, and types

cobalt-llvm/Cargo.toml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,8 @@ description.workspace = true
99
documentation.workspace = true
1010

1111
[dependencies]
12-
inkwell = { version = "0.2.0" }
13-
llvm-sys-15 = { package = "llvm-sys", version = "150", optional = true }
14-
llvm-sys-16 = { package = "llvm-sys", version = "160", optional = true }
12+
inkwell = { version = "0.2.0", features = ["llvm16-0"] }
13+
llvm-sys = "160"
1514

1615
[build-dependencies]
1716
lazy_static = "1.4"
@@ -21,13 +20,11 @@ semver = "1.0"
2120

2221
# features passed to llvm-sys
2322
[features]
24-
default = ["strict-versioning", "prefer-dynamic", "llvm-16"]
25-
llvm-15 = ["inkwell/llvm15-0", "llvm-sys-15"]
26-
llvm-16 = ["inkwell/llvm16-0", "llvm-sys-16"]
27-
strict-versioning = ["llvm-sys-15/strict-versioning", "llvm-sys-16/strict-versioning"]
28-
no-llvm-linking = ["llvm-sys-15/no-llvm-linking", "llvm-sys-16/no-llvm-linking"]
23+
default = ["strict-versioning", "prefer-dynamic"]
24+
strict-versioning = ["llvm-sys/strict-versioning"]
25+
no-llvm-linking = ["llvm-sys/no-llvm-linking"]
2926

30-
prefer-dynamic = ["llvm-sys-15/prefer-dynamic", "llvm-sys-16/prefer-dynamic"]
31-
force-dynamic = ["llvm-sys-15/force-dynamic", "llvm-sys-16/force-dynamic"]
32-
prefer-static = ["llvm-sys-15/prefer-static", "llvm-sys-16/prefer-static"]
33-
force-static = ["llvm-sys-15/force-static", "llvm-sys-16/force-static"]
27+
prefer-dynamic = ["llvm-sys/prefer-dynamic"]
28+
force-dynamic = ["llvm-sys/force-dynamic"]
29+
prefer-static = ["llvm-sys/prefer-static"]
30+
force-static = ["llvm-sys/force-static"]

cobalt-llvm/build.rs

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ use std::io::{self, ErrorKind};
1313
use std::path::PathBuf;
1414
use std::process::Command;
1515

16-
#[cfg(not(any(feature = "llvm-15", feature = "llvm-16")))]
17-
compile_error!("Either LLVM 15 or LLVM 16 must be specified!");
18-
19-
#[cfg(feature = "llvm-15")]
20-
const LLVM_MAJOR: u64 = 15;
21-
#[cfg(feature = "llvm-16")]
2216
const LLVM_MAJOR: u64 = 16;
2317

2418
// Environment variables that can guide compilation
@@ -35,13 +29,11 @@ static ENV_FORCE_FFI: &str = formatcp!("LLVM_SYS_{LLVM_MAJOR}_FFI_WORKAROUND");
3529
lazy_static! {
3630
/// LLVM version used by this version of the crate.
3731
static ref CRATE_VERSION: Version = {
38-
let crate_version = Version::parse(env!("CARGO_PKG_VERSION"))
39-
.expect("Crate version is somehow not valid semver");
40-
Version {
41-
major: LLVM_MAJOR,
42-
minor: 0,
43-
.. crate_version
44-
}
32+
Version::new(
33+
LLVM_MAJOR,
34+
0,
35+
0
36+
)
4537
};
4638

4739
/// Filesystem path to an llvm-config binary for the correct version.
@@ -168,7 +160,7 @@ fn is_compatible_llvm(llvm_version: &Version) -> bool {
168160
if strict {
169161
llvm_version.major == CRATE_VERSION.major && llvm_version.minor == CRATE_VERSION.minor
170162
} else {
171-
llvm_version.major >= CRATE_VERSION.major
163+
llvm_version.major == CRATE_VERSION.major
172164
|| (llvm_version.major == CRATE_VERSION.major
173165
&& llvm_version.minor >= CRATE_VERSION.minor)
174166
}

cobalt-llvm/src/lib.rs

Lines changed: 2 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,4 @@
1-
#[cfg(feature = "llvm-15")]
2-
pub use llvm_sys_15 as llvm_sys;
3-
4-
#[cfg(feature = "llvm-16")]
5-
pub use llvm_sys_16 as llvm_sys;
6-
1+
pub use llvm_sys;
72
pub use inkwell;
83

9-
pub const LLVM_VERSION: &str = env!("LLVM_VERSION");
10-
11-
#[cfg(feature = "llvm-15")]
12-
#[macro_export]
13-
macro_rules! if_llvm_15 {
14-
($($tok:tt)*) => {$($tok)*}
15-
}
16-
17-
#[cfg(not(feature = "llvm-15"))]
18-
#[macro_export]
19-
macro_rules! if_llvm_15 {
20-
($($tok:tt)*) => {};
21-
}
22-
23-
#[cfg(feature = "llvm-16")]
24-
#[macro_export]
25-
macro_rules! if_llvm_16 {
26-
($($tok:tt)*) => {$($tok)*}
27-
}
28-
29-
#[cfg(not(feature = "llvm-16"))]
30-
#[macro_export]
31-
macro_rules! if_llvm_16 {
32-
($($tok:tt)*) => {};
33-
}
4+
pub const LLVM_VERSION: &str = env!("LLVM_VERSION");

0 commit comments

Comments
 (0)