Skip to content

Commit ae9bb86

Browse files
committed
make windows happy
1 parent 9675f86 commit ae9bb86

15 files changed

Lines changed: 65 additions & 56 deletions

.github/workflows/python-release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name: Python Artifacts
22

33
env:
4-
TRIGGER_ON_PR_PUSH: false # Set to true to enable triggers on PR pushes
4+
TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes
55
PYTHON_VERSION: '3.10'
66

77
on:

.github/workflows/python-test.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
11
name: Python test / linting
2+
3+
env:
4+
TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes
5+
RUSTFLAGS: -C debuginfo=0
6+
RUST_BACKTRACE: 1
7+
PYTHONUTF8: 1
8+
29
on:
310
push:
411
branches: [ "master", "development" ]
@@ -21,11 +28,6 @@ concurrency:
2128
group: ${{ github.workflow }}-${{ github.ref }}
2229
cancel-in-progress: true
2330

24-
env:
25-
RUSTFLAGS: -C debuginfo=0
26-
RUST_BACKTRACE: 1
27-
PYTHONUTF8: 1
28-
2931
defaults:
3032
run:
3133
shell: bash

.github/workflows/rust-test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
name: Rust test / linting
22

33
env:
4-
TRIGGER_ON_PR_PUSH: false # Set to true to enable triggers on PR pushes
5-
4+
TRIGGER_ON_PR_PUSH: true # Set to true to enable triggers on PR pushes
65
RUSTFLAGS: -C debuginfo=0
76
RUST_BACKTRACE: 1
87

Cargo.lock

Lines changed: 26 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ categories = ["science", "simulation"]
2424
rand = "0.9"
2525
rand_chacha = "0.9"
2626
pyo3 = { version = "0.24", features = ["extension-module"] }
27+
pyo3-build-config = { version = "0.24", features = ["resolve-config"] }
2728
rayon = "1"
2829
clap = { version = "4", features = ["derive"] }
2930
log = "0.4"

Makefile

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,7 @@ lint: fmt clippy
7474

7575
.PHONY: rstest
7676
rstest: ## Run Rust tests
77-
ifeq ($(OS),Windows_NT)
78-
cargo test --workspace --exclude pecos-rslib --doc false
79-
else
80-
cargo test
81-
endif
77+
cargo test --workspace
8278

8379
.PHONY: pytest
8480
pytest: ## Run tests on the Python package (not including optional dependencies). ASSUMES: previous build command

build.sh

Lines changed: 0 additions & 4 deletions
This file was deleted.

crates/pecos/src/prelude.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,12 @@ pub use pecos_engines::{
2323
// Re-exporting specific implementations that aren't at the crate root
2424
pub use pecos_engines::engines::{
2525
classical::{ProgramType, detect_program_type, get_program_path, setup_engine},
26-
quantum::{StateVecEngine, new_quantum_engine_arbitrary_qgate},
26+
quantum::{SparseStabEngine, StateVecEngine, new_quantum_engine_arbitrary_qgate},
2727
};
2828

29+
// Re-exporting byte_message functions
30+
pub use pecos_engines::byte_message::dump_batch;
31+
2932
// re-exporting pecos-qsim
3033
pub use pecos_qsim::{
3134
ArbitraryRotationGateable, CliffordGateable, QuantumSimulator, SparseStab, StateVec,

python/pecos-rslib/rust/Cargo.toml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,19 @@ publish = false
1515
[lib]
1616
name = "pecos_rslib"
1717
crate-type = ["cdylib", "rlib"]
18+
# Skip doc tests as they won't work properly in this setup
19+
doctest = false
20+
# Skip unit tests as well - all testing should be done through Python
21+
test = false
1822

1923
[dependencies]
20-
pyo3 = { workspace=true, features = ["extension-module", "abi3-py37"] }
24+
pyo3 = { workspace=true, features = ["extension-module", "abi3-py310", "generate-import-lib"] }
2125
pecos = { workspace = true }
22-
pecos-engines = { workspace = true }
26+
# Removing pecos-engines dependency, using pecos prelude instead
2327
parking_lot = { workspace = true}
2428

2529
[lints]
2630
workspace = true
31+
32+
[build-dependencies]
33+
pyo3-build-config = { workspace = true }

python/pecos-rslib/rust/build.rs

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,8 @@
1-
use std::env;
2-
1+
/// This build script helps with `PyO3` configuration.
32
fn main() {
4-
println!("cargo:rerun-if-env-changed=PYO3_PYTHON");
5-
println!("cargo:rerun-if-env-changed=PYO3_NO_PYTHON");
63
println!("cargo:rerun-if-changed=build.rs");
74

8-
// Check if we're in test mode
9-
let is_test = env::var("CARGO_CFG_TEST").is_ok();
10-
11-
if is_test {
12-
// During tests, make sure PyO3 doesn't try to find Python
13-
println!("cargo:rustc-env=PYO3_NO_PYTHON=1");
14-
}
15-
16-
// For Windows builds, we need to set PYO3_NO_PYTHON
17-
#[cfg(target_os = "windows")]
18-
{
19-
println!("cargo:rustc-env=PYO3_NO_PYTHON=1");
20-
}
21-
22-
// For macOS, ensure proper linking of Python
5+
// For macOS, add required linker args for Python extension modules
236
#[cfg(target_os = "macos")]
24-
{
25-
println!("cargo:rustc-link-arg=-undefined");
26-
println!("cargo:rustc-link-arg=dynamic_lookup");
27-
println!(
28-
"cargo:rustc-link-arg=-Wl,-rpath,/Library/Developer/CommandLineTools/Library/Frameworks"
29-
);
30-
}
7+
pyo3_build_config::add_extension_module_link_args();
318
}

0 commit comments

Comments
 (0)