Skip to content

Commit 0ad9060

Browse files
authored
Windows: use opencv from Rtools when available (R >= 4.5)
1 parent 32e7db5 commit 0ad9060

File tree

4 files changed

+28
-9
lines changed

4 files changed

+28
-9
lines changed

.github/workflows/R-CMD-check.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@ jobs:
2222
- {os: macos-14, r: 'release'}
2323
- {os: windows-latest, r: '4.1'}
2424
- {os: windows-latest, r: '4.2'}
25-
- {os: windows-latest, r: 'release'}
25+
- {os: windows-latest, r: '4.3'}
26+
- {os: windows-latest, r: '4.4'}
27+
- {os: windows-latest, r: 'devel'}
2628
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
2729
- {os: ubuntu-latest, r: 'release'}
2830
- {os: ubuntu-latest, r: 'oldrel-1'}

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package: opencv
22
Type: Package
33
Title: Bindings to 'OpenCV' Computer Vision Library
4-
Version: 0.4.1
4+
Version: 0.5.0
55
Authors@R: c(
66
person("Jeroen", "Ooms", role = c("aut", "cre"), email = "jeroenooms@gmail.com",
77
comment = c(ORCID = "0000-0002-4035-0289")),

NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
0.5.0
2+
- Windows: use opencv from Rtools when available (R >= 4.5)
3+
14
0.4.0
25
- Add QR code detector
36
- Windows: update to libopencv 4.8.1

src/Makevars.win

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,35 @@
1+
PKG_CONFIG_NAME = opencv4
2+
PKG_CONFIG ?= $(BINPREF)pkg-config
3+
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))
4+
5+
ifneq ($(findstring wechat,$(PKG_LIBS)),)
6+
$(info using $(PKG_CONFIG_NAME) from Rtools)
7+
PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME))
8+
OPENCVDATA := $(shell $(PKG_CONFIG) --variable=prefix $(PKG_CONFIG_NAME))/share/opencv4
9+
else
110
RWINLIB = ../windows/opencv
211
PKG_CPPFLAGS = -I$(RWINLIB)/include/opencv4 -DHAVE_XFEATURES2D
312
OLDLIBDIR = lib${subst gcc,,${COMPILED_BY}}${R_ARCH}
4-
513
PKG_LIBS = \
614
-L$(RWINLIB)/$(OLDLIBDIR) \
715
-L$(RWINLIB)/lib \
816
-lopencv_ml481 -lopencv_objdetect481 -lopencv_photo481 -lopencv_stitching481 -lopencv_wechat_qrcode481 -lopencv_dnn481 \
917
-lopencv_video481 -lopencv_calib3d481 -lopencv_xfeatures2d481 -lopencv_features2d481 -lopencv_highgui481 -lopencv_flann481 \
1018
-lopencv_videoio481 -lopencv_imgcodecs481 -lopencv_imgproc481 -lopencv_core481 -llibopenjp2 -lquirc \
1119
-ljpeg -lwebp -lsharpyuv -lpng -lz -ltiff -lpthread -lgdi32 -lole32 -lopengl32 -lcomdlg32 -lOleAut32 -luuid
20+
OPENCVDATA = $(RWINLIB)/share
21+
endif
22+
23+
all: $(SHLIB) copydata
1224

13-
all: clean winlibs
25+
$(OBJECTS): $(RWINLIB)
26+
27+
$(RWINLIB):
28+
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
29+
30+
copydata:
31+
rm -Rf ../inst/share && mkdir -p ../inst
32+
cp -Rf $(OPENCVDATA) ../inst/share
1433

1534
clean:
1635
rm -f $(SHLIB) $(OBJECTS)
17-
18-
winlibs:
19-
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" ${VERSION}
20-
mkdir -p ../inst
21-
cp -r $(RWINLIB)/share ../inst/

0 commit comments

Comments
 (0)