trainingsample 0.2.11__tar.gz → 0.2.13__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. {trainingsample-0.2.11 → trainingsample-0.2.13}/.github/workflows/ci.yml +4 -4
  2. {trainingsample-0.2.11 → trainingsample-0.2.13}/.github/workflows/publish.yml +69 -11
  3. {trainingsample-0.2.11 → trainingsample-0.2.13}/Cargo.lock +56 -147
  4. {trainingsample-0.2.11 → trainingsample-0.2.13}/Cargo.toml +1 -1
  5. {trainingsample-0.2.11 → trainingsample-0.2.13}/Dockerfile +1 -1
  6. {trainingsample-0.2.11 → trainingsample-0.2.13}/PKG-INFO +1 -1
  7. trainingsample-0.2.13/docs/BUILDING_STATIC_OPENCV.md +197 -0
  8. {trainingsample-0.2.11 → trainingsample-0.2.13}/pyproject.toml +1 -1
  9. {trainingsample-0.2.11 → trainingsample-0.2.13}/rust-toolchain.toml +1 -1
  10. {trainingsample-0.2.11 → trainingsample-0.2.13}/scripts/build-opencv-static.sh +52 -38
  11. trainingsample-0.2.13/scripts/repair-wheel.sh +5 -0
  12. trainingsample-0.2.11/docs/BUILDING_STATIC_OPENCV.md +0 -103
  13. {trainingsample-0.2.11 → trainingsample-0.2.13}/.cargo/config.toml +0 -0
  14. {trainingsample-0.2.11 → trainingsample-0.2.13}/.envrc +0 -0
  15. {trainingsample-0.2.11 → trainingsample-0.2.13}/.gitignore +0 -0
  16. {trainingsample-0.2.11 → trainingsample-0.2.13}/.pre-commit-config.yaml +0 -0
  17. {trainingsample-0.2.11 → trainingsample-0.2.13}/.rustfmt.toml +0 -0
  18. {trainingsample-0.2.11 → trainingsample-0.2.13}/BENCHMARKS.md +0 -0
  19. {trainingsample-0.2.11 → trainingsample-0.2.13}/LICENSE +0 -0
  20. {trainingsample-0.2.11 → trainingsample-0.2.13}/README.md +0 -0
  21. {trainingsample-0.2.11 → trainingsample-0.2.13}/clippy.toml +0 -0
  22. {trainingsample-0.2.11 → trainingsample-0.2.13}/docs/API_COMPAT_CV2.md +0 -0
  23. {trainingsample-0.2.11 → trainingsample-0.2.13}/scripts/run_competitive_benchmarks.sh +0 -0
  24. {trainingsample-0.2.11 → trainingsample-0.2.13}/setup-env.sh +0 -0
  25. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/core.rs +0 -0
  26. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/cropping.rs +0 -0
  27. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/cv_batch_ops.rs +0 -0
  28. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/cv_batch_ops_optimized.rs +0 -0
  29. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/cv_compat.rs +0 -0
  30. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/format_conversion_simd.rs +0 -0
  31. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/lib.rs +0 -0
  32. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/loading.rs +0 -0
  33. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/luminance.rs +0 -0
  34. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/luminance_simd.rs +0 -0
  35. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/opencv_ops.rs +0 -0
  36. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/python_bindings.rs +0 -0
  37. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/tests.rs +0 -0
  38. {trainingsample-0.2.11 → trainingsample-0.2.13}/src/true_batch_ops.rs +0 -0
  39. {trainingsample-0.2.11 → trainingsample-0.2.13}/tests/__init__.py +0 -0
  40. {trainingsample-0.2.11 → trainingsample-0.2.13}/tests/comprehensive_tests.rs +0 -0
  41. {trainingsample-0.2.11 → trainingsample-0.2.13}/tests/test_comprehensive.py +0 -0
  42. {trainingsample-0.2.11 → trainingsample-0.2.13}/tests/test_performance_benchmarks.py +0 -0
  43. {trainingsample-0.2.11 → trainingsample-0.2.13}/tests/test_python_bindings.py +0 -0
@@ -69,7 +69,7 @@ jobs:
69
69
  - name: Install Rust toolchain
70
70
  uses: dtolnay/rust-toolchain@master
71
71
  with:
72
- toolchain: 1.85
72
+ toolchain: 1.89
73
73
  components: rustfmt, clippy
74
74
 
75
75
  - name: Cache cargo registry
@@ -169,7 +169,7 @@ jobs:
169
169
  - name: Install Rust toolchain
170
170
  uses: dtolnay/rust-toolchain@master
171
171
  with:
172
- toolchain: 1.85
172
+ toolchain: 1.89
173
173
  components: rustfmt, clippy
174
174
 
175
175
  - name: Install maturin (Linux/macOS)
@@ -260,7 +260,7 @@ jobs:
260
260
  - name: Install Rust toolchain
261
261
  uses: dtolnay/rust-toolchain@master
262
262
  with:
263
- toolchain: 1.85
263
+ toolchain: 1.89
264
264
  components: rustfmt, clippy
265
265
 
266
266
  - name: Install cargo-audit
@@ -342,7 +342,7 @@ jobs:
342
342
  - name: Install Rust toolchain
343
343
  uses: dtolnay/rust-toolchain@master
344
344
  with:
345
- toolchain: 1.85
345
+ toolchain: 1.89
346
346
 
347
347
  - name: Install maturin (Linux/macOS)
348
348
  run: pip install maturin[patchelf]
@@ -107,10 +107,19 @@ jobs:
107
107
  OPENCV_LINK_LIBS: static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=jpeg,static=png,static=tiff,static=webp,static=z,static=jasper,static=stdc++
108
108
  OPENCV_DISABLE_PROBES: pkg_config,cmake,vcpkg,vcpkg_cmake
109
109
 
110
+ - name: Repair wheels
111
+ env:
112
+ OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
113
+ run: |
114
+ ./scripts/repair-wheel.sh dist/*.whl
115
+ - name: Prune unrepaired wheels
116
+ run: |
117
+ find dist -type f -name '*.linux_*.whl' -print -delete
118
+
110
119
  - name: Upload wheels
111
120
  uses: actions/upload-artifact@v4
112
121
  with:
113
- name: wheels-linux-${{ matrix.os }}-${{ matrix.target }}-py${{ matrix.python }}
122
+ name: wheels-${{ matrix.os }}-${{ matrix.target }}-py${{ matrix.python }}
114
123
  path: dist
115
124
 
116
125
 
@@ -157,12 +166,17 @@ jobs:
157
166
  # OpenCV static linking configuration
158
167
  OPENCV_INCLUDE_PATHS: ${{ github.workspace }}/third_party/opencv-static/include/opencv4
159
168
  OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
160
- OPENCV_LINK_LIBS: static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=jpeg,static=png,static=tiff,static=webp,static=z,static=jasper,framework=Accelerate,dylib=c++
169
+ OPENCV_LINK_LIBS: static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=jpeg,static=png,static=tiff,static=webp,static=jasper,framework=Accelerate,dylib=c++,framework=OpenCL,z
161
170
  OPENCV_DISABLE_PROBES: pkg_config,cmake,vcpkg,vcpkg_cmake
171
+ - name: Repair wheels
172
+ env:
173
+ OPENCV_LINK_PATHS: ${{ github.workspace }}/third_party/opencv-static/lib
174
+ run: |
175
+ ./scripts/repair-wheel.sh dist/*.whl
162
176
  - name: Upload wheels
163
177
  uses: actions/upload-artifact@v4
164
178
  with:
165
- name: wheels-macos-${{ matrix.target }}
179
+ name: wheels-macos-latest-${{ matrix.target }}-py3.11
166
180
  path: dist
167
181
 
168
182
  sdist:
@@ -180,10 +194,58 @@ jobs:
180
194
  name: wheels-sdist
181
195
  path: dist
182
196
 
197
+ smoketest:
198
+ runs-on: ${{ matrix.os }}
199
+ needs: [linux, macos]
200
+ strategy:
201
+ matrix:
202
+ include:
203
+ # Ubuntu 22.04 (libc 2.35)
204
+ - os: ubuntu-22.04
205
+ target: x86_64
206
+ manylinux: manylinux_2_35
207
+ python: '3.11'
208
+ - os: ubuntu-22.04
209
+ target: x86_64
210
+ manylinux: manylinux_2_35
211
+ python: '3.12'
212
+ # Ubuntu 24.04 (libc 2.39)
213
+ - os: ubuntu-24.04
214
+ target: x86_64
215
+ manylinux: manylinux_2_39
216
+ python: '3.11'
217
+ - os: ubuntu-24.04
218
+ target: x86_64
219
+ manylinux: manylinux_2_39
220
+ python: '3.12'
221
+ - os: macos-latest
222
+ target: aarch64
223
+ manylinux: ''
224
+ python: '3.11'
225
+ steps:
226
+ - uses: actions/download-artifact@v4
227
+ with:
228
+ pattern: wheels-${{ matrix.os }}-${{ matrix.target }}-py${{ matrix.python }}
229
+ path: dist
230
+ - uses: actions/setup-python@v5
231
+ with:
232
+ python-version: ${{ matrix.python }}
233
+ - run: |
234
+ set -euo pipefail
235
+ wheel="$(find "${{ github.workspace }}/dist" -type f -name '*.whl' | sort | head -n 1)"
236
+ if [ -z "${wheel}" ]; then
237
+ echo "No wheel files found under dist/"
238
+ find "${{ github.workspace }}/dist" -maxdepth 3 -type f || true
239
+ exit 1
240
+ fi
241
+ echo "Installing wheel: ${wheel}"
242
+ pip install "${wheel}"
243
+ python -c 'import trainingsample' || echo "Import failed"
244
+
183
245
  release:
184
246
  name: Release
185
247
  runs-on: ubuntu-latest
186
- needs: [linux, macos, sdist]
248
+ needs: [smoketest, sdist]
187
249
  steps:
188
250
  - uses: actions/download-artifact@v4
189
251
  with:
@@ -194,13 +256,9 @@ jobs:
194
256
  run: |
195
257
  echo "Built wheels:"
196
258
  ls -la dist/
197
- echo "Wheel information:"
198
- for wheel in dist/*.whl; do
199
- if [ -f "$wheel" ]; then
200
- echo "Checking $wheel:"
201
- python -c "import zipfile; print(zipfile.ZipFile('$wheel').namelist()[:3])" || echo " Could not read wheel contents"
202
- fi
203
- done
259
+ - name: Prune unsupported linux-tag wheels
260
+ run: |
261
+ find dist -type f -name '*.linux_*.whl' -print -delete
204
262
  - name: Publish to PyPI
205
263
  uses: pypa/gh-action-pypi-publish@v1.12.4
206
264
  with:
@@ -100,9 +100,9 @@ checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8"
100
100
 
101
101
  [[package]]
102
102
  name = "av1-grain"
103
- version = "0.2.4"
103
+ version = "0.2.5"
104
104
  source = "registry+https://github.com/rust-lang/crates.io-index"
105
- checksum = "4f3efb2ca85bc610acfa917b5aaa36f3fcbebed5b3182d7f877b02531c4b80c8"
105
+ checksum = "8cfddb07216410377231960af4fcab838eaa12e013417781b78bd95ee22077f8"
106
106
  dependencies = [
107
107
  "anyhow",
108
108
  "arrayvec",
@@ -183,9 +183,9 @@ checksum = "37b2a672a2cb129a2e41c10b1224bb368f9f37a2b16b612598138befd7b37eb5"
183
183
 
184
184
  [[package]]
185
185
  name = "cc"
186
- version = "1.2.41"
186
+ version = "1.2.43"
187
187
  source = "registry+https://github.com/rust-lang/crates.io-index"
188
- checksum = "ac9fe6cdbb24b6ade63616c0a0688e45bb56732262c158df3c0c4bea4ca47cb7"
188
+ checksum = "739eb0f94557554b3ca9a86d2d37bebd49c5e6d0c1d2bda35ba5bdac830befc2"
189
189
  dependencies = [
190
190
  "find-msvc-tools",
191
191
  "jobserver",
@@ -258,18 +258,18 @@ dependencies = [
258
258
 
259
259
  [[package]]
260
260
  name = "clap"
261
- version = "4.5.49"
261
+ version = "4.5.50"
262
262
  source = "registry+https://github.com/rust-lang/crates.io-index"
263
- checksum = "f4512b90fa68d3a9932cea5184017c5d200f5921df706d45e853537dea51508f"
263
+ checksum = "0c2cfd7bf8a6017ddaa4e32ffe7403d547790db06bd171c1c53926faab501623"
264
264
  dependencies = [
265
265
  "clap_builder",
266
266
  ]
267
267
 
268
268
  [[package]]
269
269
  name = "clap_builder"
270
- version = "4.5.49"
270
+ version = "4.5.50"
271
271
  source = "registry+https://github.com/rust-lang/crates.io-index"
272
- checksum = "0025e98baa12e766c67ba13ff4695a887a1eba19569aad00a472546795bd6730"
272
+ checksum = "0a4c05b9e80c5ccd3a7ef080ad7b6ba7d6fc00a985b8b157197075677c82c7a0"
273
273
  dependencies = [
274
274
  "anstyle",
275
275
  "clap_lex",
@@ -435,7 +435,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
435
435
  checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb"
436
436
  dependencies = [
437
437
  "libc",
438
- "windows-sys 0.61.2",
438
+ "windows-sys",
439
439
  ]
440
440
 
441
441
  [[package]]
@@ -496,9 +496,9 @@ checksum = "52051878f80a721bb68ebfbc930e07b65ba72f2da88968ea5c06fd6ca3d3a127"
496
496
 
497
497
  [[package]]
498
498
  name = "flate2"
499
- version = "1.1.4"
499
+ version = "1.1.5"
500
500
  source = "registry+https://github.com/rust-lang/crates.io-index"
501
- checksum = "dc5a4e564e38c699f2880d3fda590bedc2e69f3f84cd48b457bd892ce61d0aa9"
501
+ checksum = "bfe33edd8e85a12a67454e37f8c75e730830d83e313556ab9ebf9ee7fbeb3bfb"
502
502
  dependencies = [
503
503
  "crc32fast",
504
504
  "miniz_oxide",
@@ -671,9 +671,12 @@ dependencies = [
671
671
 
672
672
  [[package]]
673
673
  name = "indoc"
674
- version = "2.0.6"
674
+ version = "2.0.7"
675
675
  source = "registry+https://github.com/rust-lang/crates.io-index"
676
- checksum = "f4c7245a08504955605670dbf141fceab975f15ca21570696aebe9d2e71576bd"
676
+ checksum = "79cf5c93f93228cf8efb3ba362535fb11199ac548a09ce117c9b1adc3030d706"
677
+ dependencies = [
678
+ "rustversion",
679
+ ]
677
680
 
678
681
  [[package]]
679
682
  name = "interpolate_name"
@@ -688,13 +691,13 @@ dependencies = [
688
691
 
689
692
  [[package]]
690
693
  name = "is-terminal"
691
- version = "0.4.16"
694
+ version = "0.4.17"
692
695
  source = "registry+https://github.com/rust-lang/crates.io-index"
693
- checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9"
696
+ checksum = "3640c1c38b8e4e43584d8df18be5fc6b0aa314ce6ebf51b53313d4306cca8e46"
694
697
  dependencies = [
695
698
  "hermit-abi",
696
699
  "libc",
697
- "windows-sys 0.59.0",
700
+ "windows-sys",
698
701
  ]
699
702
 
700
703
  [[package]]
@@ -733,9 +736,9 @@ dependencies = [
733
736
 
734
737
  [[package]]
735
738
  name = "js-sys"
736
- version = "0.3.81"
739
+ version = "0.3.82"
737
740
  source = "registry+https://github.com/rust-lang/crates.io-index"
738
- checksum = "ec48937a97411dcb524a265206ccd4c90bb711fca92b2792c407f268825b9305"
741
+ checksum = "b011eec8cc36da2aab2d5cff675ec18454fad408585853910a202391cf9f8e65"
739
742
  dependencies = [
740
743
  "once_cell",
741
744
  "wasm-bindgen",
@@ -849,12 +852,6 @@ dependencies = [
849
852
  "paste",
850
853
  ]
851
854
 
852
- [[package]]
853
- name = "minimal-lexical"
854
- version = "0.2.1"
855
- source = "registry+https://github.com/rust-lang/crates.io-index"
856
- checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
857
-
858
855
  [[package]]
859
856
  name = "miniz_oxide"
860
857
  version = "0.8.9"
@@ -867,9 +864,9 @@ dependencies = [
867
864
 
868
865
  [[package]]
869
866
  name = "moxcms"
870
- version = "0.7.7"
867
+ version = "0.7.9"
871
868
  source = "registry+https://github.com/rust-lang/crates.io-index"
872
- checksum = "c588e11a3082784af229e23e8e4ecf5bcc6fbe4f69101e0421ce8d79da7f0b40"
869
+ checksum = "0fbdd3d7436f8b5e892b8b7ea114271ff0fa00bc5acae845d53b07d498616ef6"
873
870
  dependencies = [
874
871
  "num-traits",
875
872
  "pxfm",
@@ -913,12 +910,11 @@ checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086"
913
910
 
914
911
  [[package]]
915
912
  name = "nom"
916
- version = "7.1.3"
913
+ version = "8.0.0"
917
914
  source = "registry+https://github.com/rust-lang/crates.io-index"
918
- checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a"
915
+ checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405"
919
916
  dependencies = [
920
917
  "memchr",
921
- "minimal-lexical",
922
918
  ]
923
919
 
924
920
  [[package]]
@@ -1197,9 +1193,9 @@ dependencies = [
1197
1193
 
1198
1194
  [[package]]
1199
1195
  name = "proc-macro2"
1200
- version = "1.0.101"
1196
+ version = "1.0.103"
1201
1197
  source = "registry+https://github.com/rust-lang/crates.io-index"
1202
- checksum = "89ae43fd86e4158d6db51ad8e2b80f313af9cc74f5c0e03ccb87de09998732de"
1198
+ checksum = "5ee95bc4ef87b8d5ba32e8b7714ccc834865276eab0aed5c9958d00ec45f49e8"
1203
1199
  dependencies = [
1204
1200
  "unicode-ident",
1205
1201
  ]
@@ -1492,7 +1488,7 @@ dependencies = [
1492
1488
  "errno",
1493
1489
  "libc",
1494
1490
  "linux-raw-sys",
1495
- "windows-sys 0.61.2",
1491
+ "windows-sys",
1496
1492
  ]
1497
1493
 
1498
1494
  [[package]]
@@ -1625,9 +1621,9 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03"
1625
1621
 
1626
1622
  [[package]]
1627
1623
  name = "syn"
1628
- version = "2.0.107"
1624
+ version = "2.0.108"
1629
1625
  source = "registry+https://github.com/rust-lang/crates.io-index"
1630
- checksum = "2a26dbd934e5451d21ef060c018dae56fc073894c5a7896f882928a76e6d081b"
1626
+ checksum = "da58917d35242480a05c2897064da0a80589a2a0476c9a3f2fdc83b53502e917"
1631
1627
  dependencies = [
1632
1628
  "proc-macro2",
1633
1629
  "quote",
@@ -1663,7 +1659,7 @@ dependencies = [
1663
1659
  "getrandom 0.3.4",
1664
1660
  "once_cell",
1665
1661
  "rustix",
1666
- "windows-sys 0.61.2",
1662
+ "windows-sys",
1667
1663
  ]
1668
1664
 
1669
1665
  [[package]]
@@ -1746,7 +1742,7 @@ dependencies = [
1746
1742
 
1747
1743
  [[package]]
1748
1744
  name = "trainingsample"
1749
- version = "0.2.11"
1745
+ version = "0.2.12"
1750
1746
  dependencies = [
1751
1747
  "anyhow",
1752
1748
  "criterion",
@@ -1779,9 +1775,9 @@ checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb"
1779
1775
 
1780
1776
  [[package]]
1781
1777
  name = "unicode-ident"
1782
- version = "1.0.19"
1778
+ version = "1.0.20"
1783
1779
  source = "registry+https://github.com/rust-lang/crates.io-index"
1784
- checksum = "f63a545481291138910575129486daeaf8ac54aee4387fe7906919f7830c7d9d"
1780
+ checksum = "462eeb75aeb73aea900253ce739c8e18a67423fadf006037cd3ff27e82748a06"
1785
1781
 
1786
1782
  [[package]]
1787
1783
  name = "unindent"
@@ -1839,9 +1835,9 @@ dependencies = [
1839
1835
 
1840
1836
  [[package]]
1841
1837
  name = "wasm-bindgen"
1842
- version = "0.2.104"
1838
+ version = "0.2.105"
1843
1839
  source = "registry+https://github.com/rust-lang/crates.io-index"
1844
- checksum = "c1da10c01ae9f1ae40cbfac0bac3b1e724b320abfcf52229f80b547c0d250e2d"
1840
+ checksum = "da95793dfc411fbbd93f5be7715b0578ec61fe87cb1a42b12eb625caa5c5ea60"
1845
1841
  dependencies = [
1846
1842
  "cfg-if",
1847
1843
  "once_cell",
@@ -1850,25 +1846,11 @@ dependencies = [
1850
1846
  "wasm-bindgen-shared",
1851
1847
  ]
1852
1848
 
1853
- [[package]]
1854
- name = "wasm-bindgen-backend"
1855
- version = "0.2.104"
1856
- source = "registry+https://github.com/rust-lang/crates.io-index"
1857
- checksum = "671c9a5a66f49d8a47345ab942e2cb93c7d1d0339065d4f8139c486121b43b19"
1858
- dependencies = [
1859
- "bumpalo",
1860
- "log",
1861
- "proc-macro2",
1862
- "quote",
1863
- "syn",
1864
- "wasm-bindgen-shared",
1865
- ]
1866
-
1867
1849
  [[package]]
1868
1850
  name = "wasm-bindgen-macro"
1869
- version = "0.2.104"
1851
+ version = "0.2.105"
1870
1852
  source = "registry+https://github.com/rust-lang/crates.io-index"
1871
- checksum = "7ca60477e4c59f5f2986c50191cd972e3a50d8a95603bc9434501cf156a9a119"
1853
+ checksum = "04264334509e04a7bf8690f2384ef5265f05143a4bff3889ab7a3269adab59c2"
1872
1854
  dependencies = [
1873
1855
  "quote",
1874
1856
  "wasm-bindgen-macro-support",
@@ -1876,31 +1858,31 @@ dependencies = [
1876
1858
 
1877
1859
  [[package]]
1878
1860
  name = "wasm-bindgen-macro-support"
1879
- version = "0.2.104"
1861
+ version = "0.2.105"
1880
1862
  source = "registry+https://github.com/rust-lang/crates.io-index"
1881
- checksum = "9f07d2f20d4da7b26400c9f4a0511e6e0345b040694e8a75bd41d578fa4421d7"
1863
+ checksum = "420bc339d9f322e562942d52e115d57e950d12d88983a14c79b86859ee6c7ebc"
1882
1864
  dependencies = [
1865
+ "bumpalo",
1883
1866
  "proc-macro2",
1884
1867
  "quote",
1885
1868
  "syn",
1886
- "wasm-bindgen-backend",
1887
1869
  "wasm-bindgen-shared",
1888
1870
  ]
1889
1871
 
1890
1872
  [[package]]
1891
1873
  name = "wasm-bindgen-shared"
1892
- version = "0.2.104"
1874
+ version = "0.2.105"
1893
1875
  source = "registry+https://github.com/rust-lang/crates.io-index"
1894
- checksum = "bad67dc8b2a1a6e5448428adec4c3e84c43e561d8c9ee8a9e5aabeb193ec41d1"
1876
+ checksum = "76f218a38c84bcb33c25ec7059b07847d465ce0e0a76b995e134a45adcb6af76"
1895
1877
  dependencies = [
1896
1878
  "unicode-ident",
1897
1879
  ]
1898
1880
 
1899
1881
  [[package]]
1900
1882
  name = "web-sys"
1901
- version = "0.3.81"
1883
+ version = "0.3.82"
1902
1884
  source = "registry+https://github.com/rust-lang/crates.io-index"
1903
- checksum = "9367c417a924a74cae129e6a2ae3b47fabb1f8995595ab474029da749a8be120"
1885
+ checksum = "3a1f95c0d03a47f4ae1f7a64643a6bb97465d9b740f0fa8f90ea33915c99a9a1"
1904
1886
  dependencies = [
1905
1887
  "js-sys",
1906
1888
  "wasm-bindgen",
@@ -1928,7 +1910,7 @@ version = "0.1.11"
1928
1910
  source = "registry+https://github.com/rust-lang/crates.io-index"
1929
1911
  checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22"
1930
1912
  dependencies = [
1931
- "windows-sys 0.61.2",
1913
+ "windows-sys",
1932
1914
  ]
1933
1915
 
1934
1916
  [[package]]
@@ -1938,7 +1920,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
1938
1920
  checksum = "7f919aee0a93304be7f62e8e5027811bbba96bcb1de84d6618be56e43f8a32a1"
1939
1921
  dependencies = [
1940
1922
  "windows-core",
1941
- "windows-targets 0.53.5",
1923
+ "windows-targets",
1942
1924
  ]
1943
1925
 
1944
1926
  [[package]]
@@ -1951,7 +1933,7 @@ dependencies = [
1951
1933
  "windows-interface",
1952
1934
  "windows-result",
1953
1935
  "windows-strings",
1954
- "windows-targets 0.53.5",
1936
+ "windows-targets",
1955
1937
  ]
1956
1938
 
1957
1939
  [[package]]
@@ -2006,15 +1988,6 @@ dependencies = [
2006
1988
  "windows-link 0.1.3",
2007
1989
  ]
2008
1990
 
2009
- [[package]]
2010
- name = "windows-sys"
2011
- version = "0.59.0"
2012
- source = "registry+https://github.com/rust-lang/crates.io-index"
2013
- checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b"
2014
- dependencies = [
2015
- "windows-targets 0.52.6",
2016
- ]
2017
-
2018
1991
  [[package]]
2019
1992
  name = "windows-sys"
2020
1993
  version = "0.61.2"
@@ -2024,22 +1997,6 @@ dependencies = [
2024
1997
  "windows-link 0.2.1",
2025
1998
  ]
2026
1999
 
2027
- [[package]]
2028
- name = "windows-targets"
2029
- version = "0.52.6"
2030
- source = "registry+https://github.com/rust-lang/crates.io-index"
2031
- checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973"
2032
- dependencies = [
2033
- "windows_aarch64_gnullvm 0.52.6",
2034
- "windows_aarch64_msvc 0.52.6",
2035
- "windows_i686_gnu 0.52.6",
2036
- "windows_i686_gnullvm 0.52.6",
2037
- "windows_i686_msvc 0.52.6",
2038
- "windows_x86_64_gnu 0.52.6",
2039
- "windows_x86_64_gnullvm 0.52.6",
2040
- "windows_x86_64_msvc 0.52.6",
2041
- ]
2042
-
2043
2000
  [[package]]
2044
2001
  name = "windows-targets"
2045
2002
  version = "0.53.5"
@@ -2047,106 +2004,58 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
2047
2004
  checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3"
2048
2005
  dependencies = [
2049
2006
  "windows-link 0.2.1",
2050
- "windows_aarch64_gnullvm 0.53.1",
2051
- "windows_aarch64_msvc 0.53.1",
2052
- "windows_i686_gnu 0.53.1",
2053
- "windows_i686_gnullvm 0.53.1",
2054
- "windows_i686_msvc 0.53.1",
2055
- "windows_x86_64_gnu 0.53.1",
2056
- "windows_x86_64_gnullvm 0.53.1",
2057
- "windows_x86_64_msvc 0.53.1",
2007
+ "windows_aarch64_gnullvm",
2008
+ "windows_aarch64_msvc",
2009
+ "windows_i686_gnu",
2010
+ "windows_i686_gnullvm",
2011
+ "windows_i686_msvc",
2012
+ "windows_x86_64_gnu",
2013
+ "windows_x86_64_gnullvm",
2014
+ "windows_x86_64_msvc",
2058
2015
  ]
2059
2016
 
2060
- [[package]]
2061
- name = "windows_aarch64_gnullvm"
2062
- version = "0.52.6"
2063
- source = "registry+https://github.com/rust-lang/crates.io-index"
2064
- checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3"
2065
-
2066
2017
  [[package]]
2067
2018
  name = "windows_aarch64_gnullvm"
2068
2019
  version = "0.53.1"
2069
2020
  source = "registry+https://github.com/rust-lang/crates.io-index"
2070
2021
  checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53"
2071
2022
 
2072
- [[package]]
2073
- name = "windows_aarch64_msvc"
2074
- version = "0.52.6"
2075
- source = "registry+https://github.com/rust-lang/crates.io-index"
2076
- checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469"
2077
-
2078
2023
  [[package]]
2079
2024
  name = "windows_aarch64_msvc"
2080
2025
  version = "0.53.1"
2081
2026
  source = "registry+https://github.com/rust-lang/crates.io-index"
2082
2027
  checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006"
2083
2028
 
2084
- [[package]]
2085
- name = "windows_i686_gnu"
2086
- version = "0.52.6"
2087
- source = "registry+https://github.com/rust-lang/crates.io-index"
2088
- checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b"
2089
-
2090
2029
  [[package]]
2091
2030
  name = "windows_i686_gnu"
2092
2031
  version = "0.53.1"
2093
2032
  source = "registry+https://github.com/rust-lang/crates.io-index"
2094
2033
  checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3"
2095
2034
 
2096
- [[package]]
2097
- name = "windows_i686_gnullvm"
2098
- version = "0.52.6"
2099
- source = "registry+https://github.com/rust-lang/crates.io-index"
2100
- checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66"
2101
-
2102
2035
  [[package]]
2103
2036
  name = "windows_i686_gnullvm"
2104
2037
  version = "0.53.1"
2105
2038
  source = "registry+https://github.com/rust-lang/crates.io-index"
2106
2039
  checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c"
2107
2040
 
2108
- [[package]]
2109
- name = "windows_i686_msvc"
2110
- version = "0.52.6"
2111
- source = "registry+https://github.com/rust-lang/crates.io-index"
2112
- checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66"
2113
-
2114
2041
  [[package]]
2115
2042
  name = "windows_i686_msvc"
2116
2043
  version = "0.53.1"
2117
2044
  source = "registry+https://github.com/rust-lang/crates.io-index"
2118
2045
  checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2"
2119
2046
 
2120
- [[package]]
2121
- name = "windows_x86_64_gnu"
2122
- version = "0.52.6"
2123
- source = "registry+https://github.com/rust-lang/crates.io-index"
2124
- checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78"
2125
-
2126
2047
  [[package]]
2127
2048
  name = "windows_x86_64_gnu"
2128
2049
  version = "0.53.1"
2129
2050
  source = "registry+https://github.com/rust-lang/crates.io-index"
2130
2051
  checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499"
2131
2052
 
2132
- [[package]]
2133
- name = "windows_x86_64_gnullvm"
2134
- version = "0.52.6"
2135
- source = "registry+https://github.com/rust-lang/crates.io-index"
2136
- checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d"
2137
-
2138
2053
  [[package]]
2139
2054
  name = "windows_x86_64_gnullvm"
2140
2055
  version = "0.53.1"
2141
2056
  source = "registry+https://github.com/rust-lang/crates.io-index"
2142
2057
  checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1"
2143
2058
 
2144
- [[package]]
2145
- name = "windows_x86_64_msvc"
2146
- version = "0.52.6"
2147
- source = "registry+https://github.com/rust-lang/crates.io-index"
2148
- checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec"
2149
-
2150
2059
  [[package]]
2151
2060
  name = "windows_x86_64_msvc"
2152
2061
  version = "0.53.1"
@@ -38,7 +38,7 @@ description = "High-performance Rust reimplementation of GIL-blocking video/imag
38
38
  edition = "2021"
39
39
  license = "MIT"
40
40
  name = "trainingsample"
41
- version = "0.2.11"
41
+ version = "0.2.12"
42
42
  readme = "README.md"
43
43
 
44
44
  [profile.release]
@@ -66,7 +66,7 @@ ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH
66
66
  ENV LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
67
67
 
68
68
  # Install Rust
69
- RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.85
69
+ RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain 1.89
70
70
  ENV PATH="/root/.cargo/bin:${PATH}"
71
71
  RUN rustup component add rustfmt clippy
72
72
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: trainingsample
3
- Version: 0.2.11
3
+ Version: 0.2.13
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -0,0 +1,197 @@
1
+ # Building a statically linked OpenCV bundle
2
+
3
+ The `opencv` crate expects to find an existing OpenCV toolkit and, by default, it
4
+ links against the dynamic libraries that come with a system installation
5
+ (`libopencv_core.dylib`, `libopencv_core.so`, …). To ship the `trainingsample`
6
+ crate without asking end users to install OpenCV themselves, build a static
7
+ OpenCV distribution once and point Cargo at it during compilation.
8
+
9
+ ## 1. Build FFmpeg as static libraries
10
+
11
+ 1. Download FFmpeg sources (6.1+ recommended) to a temporary location:
12
+
13
+ ```bash
14
+ curl -sSLo ~/Downloads/ffmpeg-6.1.1.tar.bz2 https://ffmpeg.org/releases/ffmpeg-6.1.1.tar.bz2
15
+ tar -C ~/Downloads -xjf ~/Downloads/ffmpeg-6.1.1.tar.bz2
16
+ ```
17
+
18
+ 2. Configure a static build that keeps only the components required for software
19
+ decoding. Disable the executables and hardware accelerators so the build
20
+ stays self-contained:
21
+
22
+ ```bash
23
+ pushd ~/Downloads/ffmpeg-6.1.1
24
+ ./configure \
25
+ --prefix=$(pwd)/../../third_party/ffmpeg-static \
26
+ --pkg-config-flags="--static" \
27
+ --extra-cflags="-fPIC" \
28
+ --extra-cxxflags="-fPIC" \
29
+ --extra-ldflags="-fPIC" \
30
+ --enable-static \
31
+ --disable-shared \
32
+ --disable-doc \
33
+ --disable-debug \
34
+ --disable-autodetect \
35
+ --disable-hwaccels \
36
+ --disable-vulkan \
37
+ --disable-cuvid \
38
+ --disable-nvenc \
39
+ --disable-nvdec \
40
+ --disable-vaapi \
41
+ --disable-vdpau \
42
+ --disable-d3d11va \
43
+ --disable-dxva2 \
44
+ --disable-alsa \
45
+ --disable-sdl2 \
46
+ --disable-libxcb \
47
+ --disable-iconv \
48
+ --disable-libdrm \
49
+ --disable-network \
50
+ --disable-avdevice \
51
+ --disable-postproc \
52
+ --disable-programs \
53
+ --enable-swscale \
54
+ --enable-swresample
55
+ make -j$(nproc)
56
+ make install
57
+ popd
58
+ ```
59
+
60
+ The install step writes the static archives and headers to
61
+ `third_party/ffmpeg-static`. The OpenCV build picks them up via pkg-config.
62
+ Copy the resulting libraries into the OpenCV bundle later (`libavcodec.a`,
63
+ `libavfilter.a`, `libavformat.a`, `libavutil.a`, `libswresample.a`,
64
+ `libswscale.a`).
65
+
66
+ ## 2. Build OpenCV as static libraries
67
+
68
+ 1. Download an official OpenCV source archive (4.9+ recommended) and place it
69
+ somewhere outside the repository, e.g. `~/Downloads/opencv-4.10.0`.
70
+ 2. Configure a *Release* build that turns off shared libraries and only enables
71
+ the modules that `trainingsample` uses. Ensure the FFmpeg pkg-config files
72
+ are visible (e.g. `export PKG_CONFIG_PATH=$(pwd)/third_party/ffmpeg-static/lib/pkgconfig:$PKG_CONFIG_PATH`).
73
+ On macOS or Linux:
74
+
75
+ ```bash
76
+ cmake -S ~/Downloads/opencv-4.10.0 \
77
+ -B ~/Downloads/opencv-build-static \
78
+ -DBUILD_LIST=core,imgproc,imgcodecs,highgui,video,videoio,calib3d,features2d,photo \
79
+ -DBUILD_SHARED_LIBS=OFF \
80
+ -DBUILD_opencv_world=ON \
81
+ -DOPENCV_FORCE_3RDPARTY_BUILD=ON \
82
+ -DBUILD_JPEG=ON -DWITH_JPEG=ON \
83
+ -DBUILD_PNG=ON -DWITH_PNG=ON \
84
+ -DBUILD_TIFF=ON -DWITH_TIFF=ON \
85
+ -DBUILD_WEBP=ON -DWITH_WEBP=ON \
86
+ -DBUILD_ZLIB=ON -DWITH_ZLIB=ON \
87
+ -DBUILD_JASPER=ON -DWITH_JASPER=ON \
88
+ -DWITH_FFMPEG=ON -DOPENCV_FFMPEG_USE_FIND_LIBS=ON \
89
+ -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF \
90
+ -DWITH_IPP=OFF -DWITH_OPENCL=OFF -DWITH_CUDA=OFF -DWITH_OPENEXR=OFF
91
+ cmake --build ~/Downloads/opencv-build-static --config Release --target opencv_world
92
+ cmake --install ~/Downloads/opencv-build-static \
93
+ --config Release \
94
+ --prefix $(pwd)/third_party/opencv-static
95
+ ```
96
+
97
+ The `opencv_world` target gives you a single `libopencv_world.a` archive;
98
+ switch it off and install the individual module archives if you prefer.
99
+ The OpenCV build drops the bundled codec libraries (`liblibjpeg-turbo.a`,
100
+ `liblibpng.a`, `liblibtiff.a`, `liblibwebp.a`, `libzlib.a`, `liblibjasper.a`) inside the
101
+ build tree under `build/3rdparty/lib/`. Copy them into
102
+ `third_party/opencv-static/lib/` and add the expected linker aliases, e.g.:
103
+
104
+ ```bash
105
+ cp ~/Downloads/opencv-build-static/3rdparty/lib/liblibjpeg-turbo.a third_party/opencv-static/lib/
106
+ ln -sf liblibjpeg-turbo.a third_party/opencv-static/lib/libjpeg.a
107
+ # Repeat for liblibpng.a→libpng.a, liblibtiff.a→libtiff.a, liblibwebp.a→libwebp.a, libzlib.a→libz.a, liblibjasper.a→libjasper.a
108
+ ```
109
+
110
+ 3. After installation you should have:
111
+
112
+ ```text
113
+ third_party/opencv-static/include/opencv4/...
114
+ third_party/opencv-static/lib/libopencv_world.a
115
+ third_party/opencv-static/lib/libz.a (and other third-party static deps)
116
+ third_party/opencv-static/lib/libjasper.a
117
+ third_party/opencv-static/lib/libavcodec.a
118
+ third_party/opencv-static/lib/libavfilter.a
119
+ third_party/opencv-static/lib/libavformat.a
120
+ third_party/opencv-static/lib/libavutil.a
121
+ third_party/opencv-static/lib/libswresample.a
122
+ third_party/opencv-static/lib/libswscale.a
123
+ ```
124
+
125
+ If your OpenCV build links to optional third-party components (TBB, JPEG,
126
+ PNG, WebP, etc.), install their static archives into the same `lib/` folder
127
+ so Cargo can link them in one pass.
128
+
129
+ > **macOS note**: Apple does not provide static builds of the C++ standard
130
+ > library. Replace `static=stdc++` with `dylib=c++` (or `framework=Accelerate`
131
+ > when required) in the linking step below.
132
+
133
+ ## 2. Point Cargo at the static toolchain
134
+
135
+ Add a `.cargo/config.toml` (kept inside the repo) with the environment variables
136
+ that the `opencv` build script understands:
137
+
138
+ ```toml
139
+ [env]
140
+ # Paths are resolved relative to the workspace root.
141
+ OPENCV_INCLUDE_PATHS = { value = "third_party/opencv-static/include", relative = true }
142
+ OPENCV_LINK_PATHS = { value = "third_party/opencv-static/lib", relative = true }
143
+ # Tell the build script to stop probing the system.
144
+ OPENCV_DISABLE_PROBES = "pkg_config,cmake,vcpkg"
145
+ # Static link OpenCV and the extra libraries it depends on.
146
+ # Adjust the list to match the archives present in third_party/opencv-static/lib.
147
+ OPENCV_LINK_LIBS = "static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=png,static=jpeg,static=tiff,static=webp,static=z,static=jasper,static=stdc++"
148
+ ```
149
+
150
+ The helper script in this repository disables OpenJPEG support
151
+ (`-DWITH_OPENJPEG=OFF`), so `opencv_world` does not depend on `openjp2`. If you
152
+ enable JPEG2000 support yourself, append the appropriate OpenJPEG archive
153
+ (`static=openjp2`) to `OPENCV_LINK_LIBS`.
154
+
155
+ To avoid stale caches, the script drops a `build_signature.txt` file alongside
156
+ the libraries containing the configuration fingerprint (OpenCV version and the
157
+ set of disabled features). If you rebuild OpenCV manually, update or remove that
158
+ file so subsequent runs do not skip regeneration.
159
+
160
+ If you elected to install the individual module archives instead of
161
+ `opencv_world`, list each one (`static=opencv_core`, `static=opencv_imgproc`,
162
+ …). Keep the order roughly from high- to low-level modules so the linker can
163
+ resolve symbols in one pass.
164
+
165
+ For cross-compilation add target-specific sections, e.g.:
166
+
167
+ ```toml
168
+ [target.aarch64-apple-darwin.env]
169
+ OPENCV_LINK_LIBS = "static=opencv_world,static=avformat,static=avcodec,static=avfilter,static=swresample,static=swscale,static=avutil,static=png,static=jpeg,static=tiff,static=z,static=jasper,dylib=c++"
170
+ ```
171
+
172
+ ## 3. Build the crate
173
+
174
+ With the static bundle in place you can now build the crate without touching the
175
+ system OpenCV installation:
176
+
177
+ ```bash
178
+ cargo build --features opencv --release
179
+ ```
180
+
181
+ The resulting `libtrainingsample.{so,dylib}` (or the wheels produced by the
182
+ Python bindings) now embed the OpenCV symbols directly, so end users do not need
183
+ `opencv_core` on their machines.
184
+
185
+ ## 4. Regenerating the bundle
186
+
187
+ Whenever you need to update OpenCV:
188
+
189
+ 1. Re-run the CMake configure/build/install steps pointing at the new source
190
+ tree.
191
+ 2. Verify that the list in `OPENCV_LINK_LIBS` still matches the archives produced.
192
+ 3. Commit the regenerated contents of `third_party/opencv-static/` if you keep
193
+ it under version control (or upload it to your release pipeline’s artifact
194
+ store).
195
+
196
+ That is all Cargo needs—no changes to `Cargo.toml` are required beyond enabling
197
+ the `opencv` feature when you want the acceleration path.
@@ -14,7 +14,7 @@ description = "High-performance Rust reimplementation of GIL-blocking video/imag
14
14
  license = {text = "MIT"}
15
15
  name = "trainingsample"
16
16
  requires-python = ">=3.11"
17
- version = "0.2.11"
17
+ version = "0.2.13"
18
18
 
19
19
  [project.optional-dependencies]
20
20
  dev = ["pytest>=6.0", "pytest-benchmark", "maturin>=1.0,<2.0", "pre-commit"]
@@ -1,4 +1,4 @@
1
1
  [toolchain]
2
- channel = "1.85"
2
+ channel = "1.89"
3
3
  components = ["rustfmt", "clippy"]
4
4
  profile = "minimal"
@@ -11,7 +11,7 @@ PROJECT_ROOT="$(cd "${SCRIPT_DIR}/.." && pwd)"
11
11
  BUILD_DIR="${PROJECT_ROOT}/opencv-build-tmp"
12
12
  INSTALL_DIR="${PROJECT_ROOT}/third_party/opencv-static"
13
13
  SIGNATURE_FILE="${INSTALL_DIR}/build_signature.txt"
14
- BUILD_SIGNATURE="opencv-${OPENCV_VERSION}-static-codecs-jasper-ffmpeg-no-itt-no-openjpeg"
14
+ BUILD_SIGNATURE="opencv-${OPENCV_VERSION}-static-codecs-jasper-ffmpeg-no-itt-no-openjpeg-no-tbb"
15
15
 
16
16
  FFMPEG_BUILD_DIR="${PROJECT_ROOT}/ffmpeg-build-tmp"
17
17
  FFMPEG_INSTALL_DIR="${PROJECT_ROOT}/third_party/ffmpeg-static"
@@ -136,43 +136,57 @@ fi
136
136
  # Configure CMake build
137
137
  echo "Configuring CMake build..."
138
138
  export PKG_CONFIG_PATH="${FFMPEG_INSTALL_DIR}/lib/pkgconfig:${PKG_CONFIG_PATH:-}"
139
- cmake -S "opencv-${OPENCV_VERSION}" \
140
- -B build \
141
- -DCMAKE_BUILD_TYPE=Release \
142
- -DBUILD_LIST=core,imgproc,imgcodecs,highgui,video,videoio,calib3d,features2d,photo \
143
- -DBUILD_SHARED_LIBS=OFF \
144
- -DBUILD_opencv_world=ON \
145
- -DOPENCV_FORCE_3RDPARTY_BUILD=ON \
146
- -DBUILD_JPEG=ON \
147
- -DBUILD_PNG=ON \
148
- -DBUILD_TIFF=ON \
149
- -DBUILD_WEBP=ON \
150
- -DBUILD_ZLIB=ON \
151
- -DBUILD_JASPER=ON \
152
- -DWITH_JPEG=ON \
153
- -DWITH_PNG=ON \
154
- -DWITH_TIFF=ON \
155
- -DWITH_WEBP=ON \
156
- -DWITH_ZLIB=ON \
157
- -DWITH_JASPER=ON \
158
- -DBUILD_TESTS=OFF \
159
- -DBUILD_PERF_TESTS=OFF \
160
- -DBUILD_EXAMPLES=OFF \
161
- -DBUILD_opencv_apps=OFF \
162
- -DBUILD_DOCS=OFF \
163
- -DWITH_IPP=OFF \
164
- -DWITH_OPENCL=OFF \
165
- -DWITH_CUDA=OFF \
166
- -DWITH_OPENJPEG=OFF \
167
- -DWITH_FFMPEG=ON \
168
- -DOPENCV_FFMPEG_USE_FIND_LIBS=ON \
169
- -DWITH_GSTREAMER=OFF \
170
- -DWITH_V4L=OFF \
171
- -DWITH_GTK=OFF \
172
- -DWITH_QT=OFF \
173
- -DWITH_OPENEXR=OFF \
174
- -DWITH_ITT=OFF \
175
- -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
139
+
140
+ CMAKE_ARGS=(
141
+ -S "opencv-${OPENCV_VERSION}"
142
+ -B build
143
+ -DCMAKE_BUILD_TYPE=Release
144
+ -DBUILD_LIST=core,imgproc,imgcodecs,highgui,video,videoio,calib3d,features2d,photo
145
+ -DBUILD_SHARED_LIBS=OFF
146
+ -DBUILD_opencv_world=ON
147
+ -DOPENCV_FORCE_3RDPARTY_BUILD=ON
148
+ -DBUILD_JPEG=ON
149
+ -DBUILD_PNG=ON
150
+ -DBUILD_TIFF=ON
151
+ -DBUILD_WEBP=ON
152
+ -DBUILD_ZLIB=ON
153
+ -DBUILD_JASPER=ON
154
+ -DWITH_JPEG=ON
155
+ -DWITH_PNG=ON
156
+ -DWITH_TIFF=ON
157
+ -DWITH_WEBP=ON
158
+ -DWITH_ZLIB=ON
159
+ -DWITH_JASPER=ON
160
+ -DBUILD_TESTS=OFF
161
+ -DBUILD_PERF_TESTS=OFF
162
+ -DBUILD_EXAMPLES=OFF
163
+ -DBUILD_opencv_apps=OFF
164
+ -DBUILD_DOCS=OFF
165
+ -DWITH_IPP=OFF
166
+ -DWITH_OPENCL=OFF
167
+ -DWITH_CUDA=OFF
168
+ -DWITH_OPENJPEG=OFF
169
+ -DWITH_FFMPEG=ON
170
+ -DOPENCV_FFMPEG_USE_FIND_LIBS=ON
171
+ -DWITH_GSTREAMER=OFF
172
+ -DWITH_V4L=OFF
173
+ -DWITH_GTK=OFF
174
+ -DWITH_QT=OFF
175
+ -DWITH_OPENEXR=OFF
176
+ -DWITH_ITT=OFF
177
+ -DBUILD_TBB=OFF
178
+ -DWITH_TBB=OFF
179
+ -DCMAKE_INSTALL_PREFIX="${INSTALL_DIR}"
180
+ )
181
+
182
+ if [[ "$(uname)" == "Darwin" ]]; then
183
+ echo "Detected macOS host; disabling Carotene to avoid linking issue."
184
+ CMAKE_ARGS+=(
185
+ -DWITH_CAROTENE=OFF
186
+ )
187
+ fi
188
+
189
+ cmake "${CMAKE_ARGS[@]}"
176
190
 
177
191
  # Build opencv_world (single unified library)
178
192
  echo "Building OpenCV (this may take several minutes)..."
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env bash
2
+
3
+ pip install repairwheel
4
+
5
+ repairwheel -o $(dirname "$1") -l "${OPENCV_LINK_PATHS}" "$1"
@@ -1,103 +0,0 @@
1
- # Building a statically linked OpenCV bundle
2
-
3
- The `opencv` crate expects to find an existing OpenCV toolkit and, by default, it
4
- links against the dynamic libraries that come with a system installation
5
- (`libopencv_core.dylib`, `libopencv_core.so`, …). To ship the `trainingsample`
6
- crate without asking end users to install OpenCV themselves, build a static
7
- OpenCV distribution once and point Cargo at it during compilation.
8
-
9
- ## 1. Build OpenCV as static libraries
10
-
11
- 1. Download an official OpenCV source archive (4.9+ recommended) and place it
12
- somewhere outside the repository, e.g. `~/Downloads/opencv-4.10.0`.
13
- 2. Configure a *Release* build that turns off shared libraries and only enables
14
- the modules that `trainingsample` uses. On macOS or Linux:
15
-
16
- ```bash
17
- cmake -S ~/Downloads/opencv-4.10.0 \
18
- -B ~/Downloads/opencv-build-static \
19
- -DBUILD_LIST=core,imgproc,imgcodecs,highgui,video,videoio,calib3d,features2d,photo \
20
- -DBUILD_SHARED_LIBS=OFF \
21
- -DBUILD_opencv_world=ON \
22
- -DBUILD_TESTS=OFF -DBUILD_PERF_TESTS=OFF -DBUILD_EXAMPLES=OFF \
23
- -DWITH_IPP=OFF -DWITH_OPENCL=OFF -DWITH_CUDA=OFF
24
- cmake --build ~/Downloads/opencv-build-static --config Release --target opencv_world
25
- cmake --install ~/Downloads/opencv-build-static \
26
- --config Release \
27
- --prefix $(pwd)/third_party/opencv-static
28
- ```
29
-
30
- The `opencv_world` target gives you a single `libopencv_world.a` archive;
31
- switch it off and install the individual module archives if you prefer.
32
-
33
- 3. After installation you should have:
34
-
35
- ```text
36
- third_party/opencv-static/include/opencv4/...
37
- third_party/opencv-static/lib/libopencv_world.a
38
- third_party/opencv-static/lib/libz.a (and other third-party static deps)
39
- ```
40
-
41
- If your OpenCV build links to optional third-party components (TBB, JPEG,
42
- PNG, WebP, etc.), install their static archives into the same `lib/` folder
43
- so Cargo can link them in one pass.
44
-
45
- > **macOS note**: Apple does not provide static builds of the C++ standard
46
- > library. Replace `static=stdc++` with `dylib=c++` (or `framework=Accelerate`
47
- > when required) in the linking step below.
48
-
49
- ## 2. Point Cargo at the static toolchain
50
-
51
- Add a `.cargo/config.toml` (kept inside the repo) with the environment variables
52
- that the `opencv` build script understands:
53
-
54
- ```toml
55
- [env]
56
- # Paths are resolved relative to the workspace root.
57
- OPENCV_INCLUDE_PATHS = { value = "third_party/opencv-static/include", relative = true }
58
- OPENCV_LINK_PATHS = { value = "third_party/opencv-static/lib", relative = true }
59
- # Tell the build script to stop probing the system.
60
- OPENCV_DISABLE_PROBES = "pkg_config,cmake,vcpkg"
61
- # Static link OpenCV and the extra libraries it depends on.
62
- # Adjust the list to match the archives present in third_party/opencv-static/lib.
63
- OPENCV_LINK_LIBS = "static=opencv_world,static=png,static=jpeg,static=tiff,static=webp,static=z,static=stdc++"
64
- ```
65
-
66
- If you elected to install the individual module archives instead of
67
- `opencv_world`, list each one (`static=opencv_core`, `static=opencv_imgproc`,
68
- …). Keep the order roughly from high- to low-level modules so the linker can
69
- resolve symbols in one pass.
70
-
71
- For cross-compilation add target-specific sections, e.g.:
72
-
73
- ```toml
74
- [target.aarch64-apple-darwin.env]
75
- OPENCV_LINK_LIBS = "static=opencv_world,static=png,static=jpeg,static=tiff,static=z,dylib=c++"
76
- ```
77
-
78
- ## 3. Build the crate
79
-
80
- With the static bundle in place you can now build the crate without touching the
81
- system OpenCV installation:
82
-
83
- ```bash
84
- cargo build --features opencv --release
85
- ```
86
-
87
- The resulting `libtrainingsample.{so,dylib}` (or the wheels produced by the
88
- Python bindings) now embed the OpenCV symbols directly, so end users do not need
89
- `opencv_core` on their machines.
90
-
91
- ## 4. Regenerating the bundle
92
-
93
- Whenever you need to update OpenCV:
94
-
95
- 1. Re-run the CMake configure/build/install steps pointing at the new source
96
- tree.
97
- 2. Verify that the list in `OPENCV_LINK_LIBS` still matches the archives produced.
98
- 3. Commit the regenerated contents of `third_party/opencv-static/` if you keep
99
- it under version control (or upload it to your release pipeline’s artifact
100
- store).
101
-
102
- That is all Cargo needs—no changes to `Cargo.toml` are required beyond enabling
103
- the `opencv` feature when you want the acceleration path.
File without changes
File without changes