Skip to content

Commit b9139da

Browse files
committed
feat(pkg): opencv module package on macOS (import opencv.cv)
The public `opencv` C++23-module package (pkgs/o/opencv.lua) now offers macosx — the v0.0.4 module tarball is OS-neutral (module source), and its compat.opencv dependency is macOS-capable (linux+macosx full profile, PR#97). So mcpp-ecosystem macOS users get `import opencv.cv;` (core/imgproc/imgcodecs/highgui/videoio+FFmpeg) with the same simple `opencv = "0.0.4"` dependency as linux — no new module release. - pkgs/o/opencv.lua: +xpm.macosx (same tarball/sha as linux). - members opencv-module + opencv-module-unifont -> +cfg(macos); test guards __linux__ -> __linux__||__APPLE__. opencv-module-dnn stays linux (dnn = x86 SIMD kernels + protobuf/mlas; needs a macOS dnn snapshot). windows not offered for the module yet (import opencv.cv aggregates videoio; windows compat.opencv is core-only).
1 parent a4bf601 commit b9139da

5 files changed

Lines changed: 20 additions & 3 deletions

File tree

pkgs/o/opencv.lua

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
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-only for now: compat.opencv carries a linux-x86_64 config snapshot.
13+
-- linux + macOS: compat.opencv carries per-OS config snapshots (linux-x86_64,
14+
-- macosx-arm64 full profiles). windows is core-only (no videoio) so the module
15+
-- (import opencv.cv aggregates videoio) is not yet offered there.
1416
--
1517
package = {
1618
spec = "1",
@@ -31,6 +33,15 @@ package = {
3133
sha256 = "a2e95e8b22ae66712e3f78809426e058330073c2679a21c2b2d500faa0b4964f",
3234
},
3335
},
36+
macosx = {
37+
["0.0.4"] = {
38+
url = {
39+
GLOBAL = "https://github.com/Sunrisepeak/opencv-m/archive/refs/tags/v0.0.4.tar.gz",
40+
CN = "https://gitcode.com/mcpp-res/opencv/releases/download/v0.0.4/opencv-m-0.0.4.tar.gz",
41+
},
42+
sha256 = "a2e95e8b22ae66712e3f78809426e058330073c2679a21c2b2d500faa0b4964f",
43+
},
44+
},
3445
},
3546

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

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ default = { path = "../../.." }
1212

1313
[target.'cfg(linux)'.dependencies]
1414
opencv = { version = "0.0.4", features = ["unifont"] }
15+
16+
[target.'cfg(macos)'.dependencies]
17+
opencv = { version = "0.0.4", features = ["unifont"] }

tests/examples/opencv-module-unifont/tests/opencv_unifont_iface.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// compat.opencv/unifont — CJK rendering through the module layer must ink.
33
// Linux-only (see mcpp.toml). Import-only (import std + opencv.cv): no textual
44
// headers, matching the ffmpeg-module member convention.
5-
#ifdef __linux__
5+
#if defined(__linux__) || defined(__APPLE__)
66
import std;
77
import opencv.cv;
88

tests/examples/opencv-module/mcpp.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,6 @@ default = { path = "../../.." }
1818

1919
[target.'cfg(linux)'.dependencies]
2020
opencv = "0.0.4"
21+
22+
[target.'cfg(macos)'.dependencies]
23+
opencv = "0.0.4"

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-
#ifdef __linux__
6+
#if defined(__linux__) || defined(__APPLE__)
77
import std;
88
import opencv.cv;
99

0 commit comments

Comments
 (0)