Skip to content

Commit 55b1ce3

Browse files
jeroenhhoeflin
authored andcommitted
Automatically build against hdf5 from rwinlib (fixes #128) (#129)
* Automatically build against hdf5 from rwinlib * Cleanup appveyor config * Stick with hdf5 1.8.16 * Cleanup to remove code that generates Makevars.win * Fixes for WinBuilder
1 parent c1d7f00 commit 55b1ce3

File tree

5 files changed

+34
-24
lines changed

5 files changed

+34
-24
lines changed

.Rbuildignore

+2
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,5 @@ wercker.yml
2828
^docs$
2929
^_pkgdown\.yml$
3030
^cran-comments\.md$
31+
windows
32+

Makefile

-22
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,6 @@ CHECKPATH := $(PKG_NAME).Rcheck
2020
CHECKLOG := `cat $(CHECKPATH)/00check.log`
2121
CURRENT_DIR := $(shell pwd)
2222

23-
# Makevars used for CRAN release
24-
HDF5_VERSION_USE=1_8_14
25-
WINC=$${LIB_HDF5}/include
26-
WLIB=$${LIB_HDF5}/lib$${R_ARCH}
27-
HDF5R_CPPFLAGS=
28-
DEFINE_H5FREE_MEMORY=0
29-
HDF5R_LIBS=-L${WLIB} -lhdf5 -lhdf5_hl -lz -lm
30-
HDF5R_CFLAGS=-I${WINC}/hdf5 -I${WINC}/hdf5_hl -I${WINC}/cmakeconf -I${HDF5_VERSION_USE} -I.
31-
# Makevars end
32-
3323
.PHONY: all build check manual install clean compileAttributes roxygen\
3424
build-cran check-cran doc
3525

@@ -45,18 +35,6 @@ $(PKG_NAME)_$(PKG_VERSION).tar.gz: $(PKG_FILES)
4535
build-cran:
4636
@make clean
4737
@make roxygen
48-
# Generate src/Makevars.win
49-
sed -e 's#@HDF5_VERSION_USE@#${HDF5_VERSION_USE}#g' -e 's#@HDF5R_CFLAGS@#${HDF5R_CFLAGS}#g' \
50-
-e 's#@HDF5R_CPPFLAGS@#${HDF5R_CPPFLAGS}#g' -e 's#@HDF5R_LIBS@#${HDF5R_LIBS}#g' \
51-
-e 's#@DEFINE_H5FREE_MEMORY@#${DEFINE_H5FREE_MEMORY}#g' \
52-
src/Makevars.in > src/Makevars.win
53-
# Swap configure.win
54-
@cp configure.win configure.win.temp; cat /dev/null >| configure.win
55-
R CMD build --resave-data .
56-
# Unswap configure.win
57-
@cp configure.win.temp configure.win; rm configure.win.temp
58-
# Remove src/Makevars.win
59-
rm src/Makevars.win
6038

6139
roxygen: $(R_FILES)
6240
$(R) 'devtools::load_all(".", reset=TRUE, recompile = FALSE, export_all=FALSE)';

appveyor.yml

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ install:
1313
# Adapt as necessary starting from here
1414

1515
build_script:
16-
- Rscript -e "source('https://bioconductor.org/biocLite.R')"
1716
- travis-tool.sh install_deps
1817
- echo %CD%
1918
- ls
@@ -28,7 +27,6 @@ environment:
2827
WARNINGS_ARE_ERRORS: 1
2928
_R_CHECK_FORCE_SUGGESTS_: FALSE
3029
R_ARCH: x64
31-
HDF5_VERSION_USE: 1_8_14
3230

3331
artifacts:
3432
- path: '*.Rcheck\**\*.log'

src/Makevars.win

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
WRAP = 1_8_16
2+
VERSION = 1.8.16
3+
RWINLIB = ../windows/hdf5-$(VERSION)
4+
PKG_LIBS = -L${RWINLIB}/lib-4.9.3${R_ARCH} -lhdf5 -lhdf5_hl -lz -lm
5+
PKG_CPPFLAGS = -I${RWINLIB}/include -I$(WRAP) -I. -D__USE_MINGW_ANSI_STDIO
6+
7+
all: winlibs
8+
9+
OBJECTS = $(WRAP)/const_export.o $(WRAP)/datatype_export.o $(WRAP)/Wrapper_auto_H5A.o \
10+
$(WRAP)/Wrapper_auto_H5.o $(WRAP)/Wrapper_auto_H5D.o $(WRAP)/Wrapper_auto_H5DS.o $(WRAP)/Wrapper_auto_H5E.o \
11+
$(WRAP)/Wrapper_auto_H5F.o $(WRAP)/Wrapper_auto_H5G.o $(WRAP)/Wrapper_auto_H5I.o $(WRAP)/Wrapper_auto_H5IM.o \
12+
$(WRAP)/Wrapper_auto_H5L.o $(WRAP)/Wrapper_auto_H5LT.o $(WRAP)/Wrapper_auto_H5O.o $(WRAP)/Wrapper_auto_H5P.o \
13+
$(WRAP)/Wrapper_auto_H5R.o $(WRAP)/Wrapper_auto_H5S.o $(WRAP)/Wrapper_auto_H5TB.o $(WRAP)/Wrapper_auto_H5T.o \
14+
$(WRAP)/Wrapper_auto_H5Z.o $(WRAP)/Wrapper_auto_H5FDcore.o $(WRAP)/Wrapper_auto_H5FDfamily.o \
15+
$(WRAP)/Wrapper_auto_H5FDlog.o $(WRAP)/Wrapper_auto_H5FDsec2.o $(WRAP)/Wrapper_auto_H5FDstdio.o \
16+
convert.o hdf5r_init.o H5Error.o H5ls.o Wrapper_manual_H5T.o
17+
18+
winlibs:
19+
@echo "Linking to HDF5 $(RWINLIB)"
20+
"${R_HOME}/bin${R_ARCH_BIN}/Rscript.exe" "../tools/winlibs.R" $(VERSION)
21+
22+
.PHONY: all winlibs
23+

tools/winlibs.R

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Build against rwinlib build of hdf5
2+
VERSION <- commandArgs(TRUE)
3+
if(!file.exists(sprintf("../windows/hdf5-%s/include/hdf5.h", VERSION))){
4+
download.file(sprintf("https://github.com/rwinlib/hdf5/archive/v%s.zip", VERSION),
5+
"lib.zip", quiet = TRUE)
6+
dir.create("../windows", showWarnings = FALSE)
7+
unzip("lib.zip", exdir = "../windows")
8+
unlink("lib.zip")
9+
}

0 commit comments

Comments
 (0)