diff --git a/pkgs/o/opencv.lua b/pkgs/o/opencv.lua index 138c4d2..b4c52cb 100644 --- a/pkgs/o/opencv.lua +++ b/pkgs/o/opencv.lua @@ -10,9 +10,11 @@ -- Optional features (0.0.4+, mcpp#243 forwarding): `dnn` adds the -- import opencv.dnn; interface and forwards compat.opencv/dnn; `unifont` -- forwards compat.opencv/unifont — `opencv = { features = ["dnn"] }`. --- linux + macOS: the module tarball is OS-neutral; compat.opencv is per-OS - -- (linux/macosx full). v0.0.6 added the clang static-inline export forwarding - -- layer so clang (macOS) can import opencv.cv. windows: module needs videoio. +-- 3-platform: the module tarball is OS-neutral; compat.opencv is per-OS (all + -- three now full — videoio everywhere, dnn on linux/macOS/windows). v0.0.6's + -- clang static-inline export forwarding layer lets clang (macOS + windows + -- clang-cl) import opencv.cv; windows dnn uses the built-in fast_gemm backend + -- (compat.opencv skips mlas there — its x86 asm is GAS/ELF, not COFF). -- package = { spec = "1", @@ -42,6 +44,15 @@ package = { sha256 = "adebd6b1e7a434bf8d744a6fc191725466467ae13b4d7ee1c01d5a8e21bbf2eb", }, }, + windows = { + ["0.0.6"] = { + url = { + GLOBAL = "https://github.com/Sunrisepeak/opencv-m/archive/refs/tags/v0.0.6.tar.gz", + CN = "https://gitcode.com/mcpp-res/opencv/releases/download/v0.0.6/opencv-m-0.0.6.tar.gz", + }, + sha256 = "adebd6b1e7a434bf8d744a6fc191725466467ae13b4d7ee1c01d5a8e21bbf2eb", + }, + }, }, -- (no `mcpp` field -- default lookup will find /*/mcpp.toml) diff --git a/tests/examples/opencv-module-dnn/mcpp.toml b/tests/examples/opencv-module-dnn/mcpp.toml index 5c5a946..809d16d 100644 --- a/tests/examples/opencv-module-dnn/mcpp.toml +++ b/tests/examples/opencv-module-dnn/mcpp.toml @@ -19,4 +19,8 @@ opencv = { version = "0.0.6", features = ["dnn"] } [target.'cfg(macos)'.dependencies] opencv = { version = "0.0.6", features = ["dnn"] } +# windows: `import opencv.dnn;` on windows-x86_64 (fast_gemm backend). +[target.'cfg(windows)'.dependencies] +opencv = { version = "0.0.6", features = ["dnn"] } + diff --git a/tests/examples/opencv-module-dnn/tests/opencv_dnn_iface.cpp b/tests/examples/opencv-module-dnn/tests/opencv_dnn_iface.cpp index fdc04fc..18972c3 100644 --- a/tests/examples/opencv-module-dnn/tests/opencv_dnn_iface.cpp +++ b/tests/examples/opencv-module-dnn/tests/opencv_dnn_iface.cpp @@ -4,7 +4,7 @@ // Linux-only (see mcpp.toml). Not named dnn.cpp (would collide with the dep's // modules/dnn/src/dnn.cpp — #240 family). Import-only (import std + the opencv // modules): no textual headers, matching the ffmpeg-module member convention. -#if defined(__linux__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32) import std; import opencv.cv; import opencv.dnn; diff --git a/tests/examples/opencv-module/mcpp.toml b/tests/examples/opencv-module/mcpp.toml index 49fa103..82e5dbd 100644 --- a/tests/examples/opencv-module/mcpp.toml +++ b/tests/examples/opencv-module/mcpp.toml @@ -21,3 +21,7 @@ opencv = "0.0.6" [target.'cfg(macos)'.dependencies] opencv = "0.0.6" + +# windows: import opencv.cv on windows-x86_64 (clang-cl; module tarball OS-neutral). +[target.'cfg(windows)'.dependencies] +opencv = "0.0.6" diff --git a/tests/examples/opencv-module/tests/opencv_module.cpp b/tests/examples/opencv-module/tests/opencv_module.cpp index a3ba20c..417e5de 100644 --- a/tests/examples/opencv-module/tests/opencv_module.cpp +++ b/tests/examples/opencv-module/tests/opencv_module.cpp @@ -3,7 +3,7 @@ // replacement operator surface: Size comparison via != crosses the module // boundary — the v0.0.1 regression scenario), PNG+JPEG codec roundtrips, // videoio registry. Linux-only (see mcpp.toml). -#if defined(__linux__) || defined(__APPLE__) +#if defined(__linux__) || defined(__APPLE__) || defined(_WIN32) import std; import opencv.cv;