Skip to content

Commit b6c6f97

Browse files
committed
Windows: use poppler from Rtools if found
1 parent f786f24 commit b6c6f97

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ jobs:
1818
config:
1919
- {os: macOS-latest, r: 'release'}
2020
- {os: windows-latest, r: 'devel'}
21-
- {os: windows-latest, r: 'release'}
21+
- {os: windows-latest, r: '4.4'}
22+
- {os: windows-latest, r: '4.3'}
2223
- {os: windows-latest, r: '4.2'}
2324
- {os: windows-latest, r: '4.1'}
2425
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}

src/Makevars.win

Lines changed: 25 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,32 @@
1-
POPPLERDATA=share/poppler
2-
RWINLIB=../windows/poppler
3-
PKG_CXXFLAGS=-Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA
4-
PKG_CPPFLAGS=-I$(RWINLIB)/include/poppler/cpp \
5-
-I$(RWINLIB)/include/poppler \
6-
-DSTRICT_R_HEADERS -DR_NO_REMAP
1+
PKG_CONFIG_NAME = poppler-cpp
2+
PKG_CONFIG ?= $(BINPREF)pkg-config
3+
PKG_CXXFLAGS = -Dpoppler_cpp_EXPORTS -DBUNDLE_POPPLER_DATA -DSTRICT_R_HEADERS -DR_NO_REMAP
4+
PKG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))
75

8-
PKG_LIBS= \
9-
-L$(RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} \
10-
-L$(RWINLIB)/lib \
11-
-lpoppler-cpp -lpoppler -llcms2 -ljpeg -lpng16 -ltiff -lopenjp2 \
12-
-lfreetype -lfreetype -lbz2 -liconv -lz
6+
ifneq ($(PKG_LIBS),)
7+
$(info using $(PKG_CONFIG_NAME) from Rtools)
8+
PKG_CPPFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME))
9+
POPPLERDATA := $(shell pkg-config --variable=poppler_datadir poppler-data)
10+
else
11+
RWINLIB = ../windows/poppler
12+
PKG_CPPFLAGS = -I$(RWINLIB)/include/poppler/cpp -I$(RWINLIB)/include/poppler
13+
PKG_LIBS = -L$(RWINLIB)/lib${subst gcc,,${COMPILED_BY}}${R_ARCH} -L$(RWINLIB)/lib \
14+
-lpoppler-cpp -lpoppler -llcms2 -ljpeg -lpng16 -ltiff -lopenjp2 -lfreetype -lfreetype -lbz2 -liconv -lz
15+
POPPLERDATA = $(RWINLIB)/share/poppler
16+
endif
1317

14-
all: clean winlibs
18+
all: $(SHLIB) $(copydata)
1519

16-
clean:
17-
rm -f $(OBJECTS) $(SHLIB)
20+
$(OBJECTS): $(RWINLIB)
1821

19-
winlibs:
22+
$(RWINLIB):
2023
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"
24+
25+
copydata:
2126
rm -Rf ../inst/share && mkdir -p ../inst/share
22-
cp -Rf $(RWINLIB)/$(POPPLERDATA) ../inst/share/poppler
27+
cp -Rf $(POPPLERDATA) ../inst/share/poppler
28+
29+
clean:
30+
rm -f $(SHLIB) $(OBJECTS)
31+
2332

24-
.PHONY: all winlibs clean

0 commit comments

Comments
 (0)