Skip to content

Commit

Permalink
Use libs from Rtools if found
Browse files Browse the repository at this point in the history
  • Loading branch information
jeroen committed Jan 8, 2025
1 parent 6e8bfd1 commit e6351ad
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/R-CMD-check.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
matrix:
config:
- {os: macos-latest, r: 'release'}
- {os: windows-latest, r: 'release'}
- {os: windows-latest, r: 'devel'}
- {os: windows-latest, r: '4.4'}
- {os: windows-latest, r: '4.3'}
- {os: windows-latest, r: '4.2'}
- {os: windows-latest, r: '4.1'}
- {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'}
Expand Down
31 changes: 19 additions & 12 deletions src/Makevars.win
Original file line number Diff line number Diff line change
@@ -1,28 +1,35 @@
PKG_CONFIG_NAME = freetype2 libpng libtiff-4 libjpeg
PKG_CONFIG ?= $(BINPREF)pkg-config
RAGG_LIBS := $(shell $(PKG_CONFIG) --libs $(PKG_CONFIG_NAME))

ifneq ($(RAGG_LIBS),)
$(info using $(PKG_CONFIG_NAME) from Rtools)
RAGG_CFLAGS := $(shell $(PKG_CONFIG) --cflags $(PKG_CONFIG_NAME))
else
RWINLIB = ../windows/harfbuzz
RAGG_CFLAGS = -I$(RWINLIB)/include -I$(RWINLIB)/include/freetype2
RAGG_LIBS = -L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib -lfreetype -lharfbuzz -lfreetype -lpng -lz -ltiff -ljpeg -lbz2 -lrpcrt4 -lgdi32 -lws2_32
endif

PKG_LIBS = -Lagg -lstatagg $(RAGG_LIBS)
PKG_CPPFLAGS = -DSTRICT_R_HEADERS -I./agg/include $(RAGG_CFLAGS)

AGG_OBJECTS = agg/src/agg_curves.o agg/src/agg_font_freetype.o \
agg/src/agg_image_filters.o agg/src/agg_trans_affine.o \
agg/src/agg_vcgen_dash.o agg/src/agg_vcgen_stroke.o

PKG_CPPFLAGS = -DSTRICT_R_HEADERS \
-I$(RWINLIB)/include -I$(RWINLIB)/include/freetype2 \
-I./agg/include \

PKG_LIBS = -Lagg -lstatagg \
-L$(RWINLIB)/lib$(R_ARCH) -L$(RWINLIB)/lib \
-lfreetype -lharfbuzz -lfreetype -lpng -lz -ltiff -ljpeg \
-lbz2 -lrpcrt4 -lgdi32 -lws2_32

STATLIB = agg/libstatagg.a

all: clean winlibs
all: $(SHLIB)

$(SHLIB): $(STATLIB)

$(STATLIB): $(AGG_OBJECTS)

winlibs:
$(OBJECTS): $(RWINLIB)

$(RWINLIB):
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R"

clean:
rm -f $(OBJECTS) $(STATLIB) $(SHLIB) $(AGG_OBJECTS)
rm -f $(SHLIB) $(OBJECTS) $(AGG_OBJECTS) $(STATLIB)

0 comments on commit e6351ad

Please sign in to comment.