Skip to content

Commit 54b7511

Browse files
committed
make the llvm feature not default for Rust
1 parent 5850c81 commit 54b7511

9 files changed

Lines changed: 30 additions & 17 deletions

File tree

.github/workflows/rust-test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ jobs:
7474
run: rustup component add clippy
7575

7676
- name: Run clippy
77-
run: cargo clippy --workspace --all-targets -- -D warnings
77+
run: cargo clippy --workspace --all-targets --features llvm -- -D warnings
7878

7979
rust-lint-no-llvm:
8080
runs-on: ubuntu-latest
@@ -245,11 +245,11 @@ jobs:
245245
246246
echo "RUSTFLAGS: $RUSTFLAGS"
247247
248-
cargo test --no-run
248+
cargo test --no-run --features llvm
249249
250250
- name: Compile tests (Linux/Windows)
251251
if: matrix.os != 'macos-latest'
252-
run: cargo test --no-run
252+
run: cargo test --no-run --features llvm
253253

254254
- name: Run tests (macOS)
255255
if: matrix.os == 'macos-latest'
@@ -264,7 +264,7 @@ jobs:
264264
unset PKG_CONFIG_PATH
265265
export LIBRARY_PATH=/usr/lib
266266
267-
cargo test --workspace
267+
cargo test --workspace --features llvm
268268
269269
- name: Run tests (Linux)
270270
if: matrix.os == 'ubuntu-latest'
@@ -274,13 +274,13 @@ jobs:
274274
if: matrix.os == 'windows-latest'
275275
run: |
276276
# Run all non-doctest tests
277-
cargo test --workspace --exclude pecos-rslib --lib --bins --tests --examples
277+
cargo test --workspace --features llvm --exclude pecos-rslib --lib --bins --tests --examples
278278
279279
# For Windows, we need to run doctests for the pecos crate specially
280280
# to ensure they run from the crate directory
281281
cd crates/pecos
282-
cargo test --doc
282+
cargo test --doc --features llvm
283283
cd ../..
284284
285285
# Run doctests for other crates normally
286-
cargo test --workspace --exclude pecos-rslib --exclude pecos --doc
286+
cargo test --workspace --features llvm --exclude pecos-rslib --exclude pecos --doc

Makefile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,11 +238,13 @@ lint-fix: ## Fix all auto-fixable linting issues (Rust, Python, Julia)
238238

239239
.PHONY: rstest
240240
rstest: ## Run Rust tests
241-
@$(ADD_LLVM_TO_PATH) cargo test --workspace --release
241+
@$(ADD_LLVM_TO_PATH) cargo test --workspace --release --exclude pecos-quest --exclude pecos-decoders --features llvm
242+
@$(ADD_LLVM_TO_PATH) cargo test -p pecos-quest --release
243+
@$(ADD_LLVM_TO_PATH) cargo test -p pecos-decoders --release --all-features
242244

243245
.PHONY: rstest-all
244246
rstest-all: ## Run Rust tests with all features except GPU
245-
@$(ADD_LLVM_TO_PATH) cargo test --workspace --exclude pecos-quest --exclude pecos-decoders
247+
@$(ADD_LLVM_TO_PATH) cargo test --workspace --exclude pecos-quest --exclude pecos-decoders --features llvm
246248
@$(ADD_LLVM_TO_PATH) cargo test -p pecos-quest
247249
@$(ADD_LLVM_TO_PATH) cargo test -p pecos-decoders --all-features
248250

crates/pecos-cli/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ env_logger.workspace = true
2323
log.workspace = true
2424

2525
[features]
26-
default = ["qasm", "llvm", "phir", "selene"]
26+
default = ["qasm", "phir", "selene"]
2727
qasm = ["pecos/qasm"]
2828
llvm = ["pecos/llvm"]
2929
phir = ["pecos/phir"]

crates/pecos-hugr-qis/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tket.workspace = true
2727
tket-qsystem.workspace = true
2828

2929
[features]
30-
default = ["llvm"]
30+
default = []
3131
llvm = ["tket-qsystem/llvm"]
3232

3333
[lints]

crates/pecos-qis-core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ features = ["llvm14-0"]
3030
optional = true
3131

3232
[features]
33-
default = ["llvm"]
33+
default = []
3434
llvm = ["dep:inkwell"]
3535

3636
[build-dependencies]

crates/pecos/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ pecos-quest = { workspace = true, optional = true }
3838
pecos-qulacs = { workspace = true, optional = true }
3939

4040
[features]
41-
default = ["selene", "llvm", "qasm", "phir", "all-simulators"]
41+
default = ["selene", "qasm", "phir", "all-simulators"]
4242
qasm = []
4343
llvm = ["pecos-qis-core/llvm", "pecos-hugr-qis", "pecos-hugr-qis?/llvm"]
4444
phir = []

julia/pecos-julia-ffi/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ crate-type = ["cdylib"]
1717

1818
[dependencies]
1919
# PECOS - the meta crate that includes everything via its prelude
20-
pecos = { workspace = true }
20+
# Enable llvm feature explicitly for full Julia functionality
21+
pecos = { workspace = true, features = ["llvm"] }
2122

2223
[lints]
2324
workspace = true

python/pecos-rslib/rust/Cargo.toml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ test = false
2121

2222
[dependencies]
2323
# Use the pecos metacrate which includes all simulators and runtimes by default
24-
pecos = { workspace = true }
24+
# Enable llvm feature explicitly for full Python functionality
25+
pecos = { workspace = true, features = ["llvm"] }
2526

2627
pyo3 = { workspace=true, features = ["extension-module", "abi3-py310", "generate-import-lib"] }
2728
parking_lot.workspace = true

python/quantum-pecos/tests/guppy/test_hugr_compilation.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ def test_rust_hugr_crate_compilation(self) -> None:
3939

4040
# Test compilation of pecos-hugr-qis crate
4141
result = subprocess.run(
42-
[cargo_path, "check", "-p", "pecos-hugr-qis"],
42+
[cargo_path, "check", "-p", "pecos-hugr-qis", "--features", "llvm"],
4343
capture_output=True,
4444
text=True,
4545
cwd=project_root,
@@ -75,7 +75,16 @@ def test_rust_hugr_unit_tests(self) -> None:
7575

7676
# Run HUGR-specific unit tests
7777
result = subprocess.run(
78-
[cargo_path, "test", "-p", "pecos-hugr-qis", "--", "--nocapture"],
78+
[
79+
cargo_path,
80+
"test",
81+
"-p",
82+
"pecos-hugr-qis",
83+
"--features",
84+
"llvm",
85+
"--",
86+
"--nocapture",
87+
],
7988
capture_output=True,
8089
text=True,
8190
cwd=project_root,

0 commit comments

Comments
 (0)