Skip to content

Commit b8e7de4

Browse files
authored
Simplified pecos-qir static library compiling
* Simplified pecos-qir static library compiling * More pecos-qir cleanup * force python-tests * Make sure pecos-qir Window's C stubs are consistent with runtime.rs via tests
1 parent 1bba638 commit b8e7de4

14 files changed

Lines changed: 1147 additions & 1951 deletions

File tree

.github/workflows/python-test.yml

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,22 @@ env:
99
on:
1010
push:
1111
branches: [ "master", "development", "dev" ]
12-
paths:
13-
- 'python/**'
14-
- '.github/workflows/python-test.yml'
15-
- '.typos.toml'
16-
- 'ruff.toml'
17-
- '.pre-commit-config.yaml'
12+
# # Comment out paths to force run on all pushes
13+
# paths:
14+
# - 'python/**'
15+
# - '.github/workflows/python-test.yml'
16+
# - '.typos.toml'
17+
# - 'ruff.toml'
18+
# - '.pre-commit-config.yaml'
1819
pull_request:
1920
branches: [ "master", "development", "dev" ]
20-
paths:
21-
- 'python/**'
22-
- '.github/workflows/python-test.yml'
23-
- '.typos.toml'
24-
- 'ruff.toml'
25-
- '.pre-commit-config.yaml'
21+
# # Comment out paths to force run on all PRs
22+
# paths:
23+
# - 'python/**'
24+
# - '.github/workflows/python-test.yml'
25+
# - '.typos.toml'
26+
# - 'ruff.toml'
27+
# - '.pre-commit-config.yaml'
2628

2729
concurrency:
2830
group: ${{ github.workflow }}-${{ github.ref }}

Makefile

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,22 @@ lint: check fmt clippy
8484
# Testing
8585
# -------
8686

87+
.PHONY: qir-staticlib
88+
qir-staticlib: ## Build the QIR static library (needed for QIR compilation)
89+
cargo rustc -p pecos-qir --lib --crate-type=staticlib
90+
91+
.PHONY: qir-staticlib-if-needed
92+
qir-staticlib-if-needed: ## Build QIR static library only if it doesn't exist in persistent location
93+
@if [ ! -f ~/.cargo/pecos-qir/libpecos_qir.a ] && [ ! -f ~/.cargo/pecos-qir/pecos_qir.lib ]; then \
94+
echo "Building QIR static library..."; \
95+
$(MAKE) qir-staticlib; \
96+
fi
97+
8798
.PHONY: rstest
88-
rstest: ## Run Rust tests
99+
rstest: qir-staticlib-if-needed ## Run Rust tests
89100
cargo test --workspace
90101

102+
91103
.PHONY: pytest
92104
pytest: ## Run tests on the Python package (not including optional dependencies). ASSUMES: previous build command
93105
uv run pytest ./python/tests/ -m "not optional_dependency"
@@ -139,6 +151,8 @@ clean-unix:
139151
@find python -type d -name "target" -exec rm -rf {} +
140152
@# Clean the root workspace target directory
141153
@cargo clean
154+
@# Clean the persistent QIR library directory
155+
@rm -rf ~/.cargo/pecos-qir/
142156

143157
.PHONY: clean-windows-ps
144158
clean-windows-ps:
@@ -157,6 +171,8 @@ clean-windows-ps:
157171
@powershell -Command "Get-ChildItem -Path crates -Recurse -Directory -Filter 'target' | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue"
158172
@powershell -Command "Get-ChildItem -Path python -Recurse -Directory -Filter 'target' | Remove-Item -Recurse -Force -ErrorAction SilentlyContinue"
159173
@cargo clean
174+
@# Clean the persistent QIR library directory
175+
@powershell -Command "if (Test-Path '$env:USERPROFILE\.cargo\pecos-qir') { Remove-Item -Recurse -Force $env:USERPROFILE\.cargo\pecos-qir }"
160176

161177
.PHONY: clean-windows-cmd
162178
clean-windows-cmd:
@@ -175,6 +191,8 @@ clean-windows-cmd:
175191
-@for /f "delims=" %%d in ('dir /s /b /ad crates\target 2^>nul') do @rd /s /q "%%d" 2>nul
176192
-@for /f "delims=" %%d in ('dir /s /b /ad python\target 2^>nul') do @rd /s /q "%%d" 2>nul
177193
-@cargo clean
194+
-@REM Clean the persistent QIR library directory
195+
-@if exist %USERPROFILE%\.cargo\pecos-qir rd /s /q %USERPROFILE%\.cargo\pecos-qir
178196

179197
.PHONY: pip-install-uv
180198
pip-install-uv: ## Install uv using pip and create a venv. (Recommended to instead follow: https://docs.astral.sh/uv/getting-started/installation/

crates/pecos-engines/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ categories.workspace = true
1212
description = "Provides simulator engines for PECOS simulations."
1313

1414
[lib]
15-
crate-type = ["cdylib", "rlib"]
15+
crate-type = ["rlib"]
1616

1717
[dependencies]
1818
rayon.workspace = true

0 commit comments

Comments
 (0)