Skip to content

Commit 309cd70

Browse files
committed
fix(opencv-test): guard on __linux__, drop build-phase define (gui-stack pattern)
The member BUILD phase (mcpp test --workspace runs build+test per member) compiled tests/roundtrip.cpp with -DHAVE_OPENCV from [target.cfg(linux).build] cxxflags but WITHOUT the cfg(linux) opencv dep's include path -> opencv2/core.hpp not found. Match the gui-stack precedent: guard the test on the builtin __linux__ and drop the custom define + [target.build] section, so the build phase is a clean no-op and the test phase compiles with the dep includes. Verified from a clean state (fresh toolchain + fresh opencv source build, released mcpp 0.0.87): mcpp build RC=0, mcpp test roundtrip ok.
1 parent 8b860e9 commit 309cd70

2 files changed

Lines changed: 1 addition & 4 deletions

File tree

tests/examples/opencv/mcpp.toml

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

1414
[target.'cfg(linux)'.dependencies.compat]
1515
opencv = "4.13.0"
16-
17-
[target.'cfg(linux)'.build]
18-
cxxflags = ["-DHAVE_OPENCV=1"]

tests/examples/opencv/tests/roundtrip.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// against the static libs built from source by the package's install() CMake hook.
33
// Linux-only (see mcpp.toml); off-Linux this is a no-op main so `mcpp test
44
// --workspace` is clean on macOS/Windows.
5-
#ifdef HAVE_OPENCV
5+
#ifdef __linux__
66
#include <opencv2/core.hpp>
77
#include <opencv2/imgproc.hpp>
88
#include <opencv2/imgcodecs.hpp>

0 commit comments

Comments
 (0)