Skip to content

Commit 96ded15

Browse files
authored
feat(pkg): opencv module package windows — import opencv.cv/dnn on windows-x86_64 (compat.opencv now 3-platform full; OS-neutral tarball) (#106)
1 parent 8692bb2 commit 96ded15

5 files changed

Lines changed: 24 additions & 5 deletions

File tree

pkgs/o/opencv.lua

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,11 @@
1010
-- Optional features (0.0.4+, mcpp#243 forwarding): `dnn` adds the
1111
-- import opencv.dnn; interface and forwards compat.opencv/dnn; `unifont`
1212
-- forwards compat.opencv/unifont — `opencv = { features = ["dnn"] }`.
13-
-- linux + macOS: the module tarball is OS-neutral; compat.opencv is per-OS
14-
-- (linux/macosx full). v0.0.6 added the clang static-inline export forwarding
15-
-- layer so clang (macOS) can import opencv.cv. windows: module needs videoio.
13+
-- 3-platform: the module tarball is OS-neutral; compat.opencv is per-OS (all
14+
-- three now full — videoio everywhere, dnn on linux/macOS/windows). v0.0.6's
15+
-- clang static-inline export forwarding layer lets clang (macOS + windows
16+
-- clang-cl) import opencv.cv; windows dnn uses the built-in fast_gemm backend
17+
-- (compat.opencv skips mlas there — its x86 asm is GAS/ELF, not COFF).
1618
--
1719
package = {
1820
spec = "1",
@@ -42,6 +44,15 @@ package = {
4244
sha256 = "adebd6b1e7a434bf8d744a6fc191725466467ae13b4d7ee1c01d5a8e21bbf2eb",
4345
},
4446
},
47+
windows = {
48+
["0.0.6"] = {
49+
url = {
50+
GLOBAL = "https://github.com/Sunrisepeak/opencv-m/archive/refs/tags/v0.0.6.tar.gz",
51+
CN = "https://gitcode.com/mcpp-res/opencv/releases/download/v0.0.6/opencv-m-0.0.6.tar.gz",
52+
},
53+
sha256 = "adebd6b1e7a434bf8d744a6fc191725466467ae13b4d7ee1c01d5a8e21bbf2eb",
54+
},
55+
},
4556
},
4657

4758
-- (no `mcpp` field -- default lookup will find <verdir>/*/mcpp.toml)

tests/examples/opencv-module-dnn/mcpp.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,8 @@ opencv = { version = "0.0.6", features = ["dnn"] }
1919
[target.'cfg(macos)'.dependencies]
2020
opencv = { version = "0.0.6", features = ["dnn"] }
2121

22+
# windows: `import opencv.dnn;` on windows-x86_64 (fast_gemm backend).
23+
[target.'cfg(windows)'.dependencies]
24+
opencv = { version = "0.0.6", features = ["dnn"] }
25+
2226

tests/examples/opencv-module-dnn/tests/opencv_dnn_iface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Linux-only (see mcpp.toml). Not named dnn.cpp (would collide with the dep's
55
// modules/dnn/src/dnn.cpp — #240 family). Import-only (import std + the opencv
66
// modules): no textual headers, matching the ffmpeg-module member convention.
7-
#if defined(__linux__) || defined(__APPLE__)
7+
#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
88
import std;
99
import opencv.cv;
1010
import opencv.dnn;

tests/examples/opencv-module/mcpp.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ opencv = "0.0.6"
2121

2222
[target.'cfg(macos)'.dependencies]
2323
opencv = "0.0.6"
24+
25+
# windows: import opencv.cv on windows-x86_64 (clang-cl; module tarball OS-neutral).
26+
[target.'cfg(windows)'.dependencies]
27+
opencv = "0.0.6"

tests/examples/opencv-module/tests/opencv_module.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
// replacement operator surface: Size comparison via != crosses the module
44
// boundary — the v0.0.1 regression scenario), PNG+JPEG codec roundtrips,
55
// videoio registry. Linux-only (see mcpp.toml).
6-
#if defined(__linux__) || defined(__APPLE__)
6+
#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32)
77
import std;
88
import opencv.cv;
99

0 commit comments

Comments
 (0)