Skip to content

Commit

Permalink
fix windows build. #45
Browse files Browse the repository at this point in the history
  • Loading branch information
mikejiang committed Jan 22, 2021
1 parent fe359ee commit 01c7e18
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
7 changes: 5 additions & 2 deletions R/build.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,11 @@ CxxFlags <- function() {
#' @importFrom RProtoBufLib LdFlags
#' @importFrom RcppParallel RcppParallelLibs
cytolib_LdFlags <- function() {
cat(res <- asBuildPath(system.file("lib/libcytolib.a", package = "cytolib")))
}
libDir <- "lib/"
if (.Platform$OS.type == "windows")
libDir <- paste(libDir, .Platform$r_arch, "/", sep="")
cat(asBuildPath(system.file(paste(libDir, "libcytolib.a", sep = ""), package = "cytolib")))
}



Expand Down
2 changes: 1 addition & 1 deletion src/Makevars.in
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,5 @@ $(boost_fs_objs): ${boost_sys_objs}


clean:
rm -f $(OBJECTS) ${boost_fs_objs} ${boost_sys_objs} $(SHLIB)
rm -f $(OBJECTS) ${cytolib_objs} ${boost_fs_objs} ${boost_sys_objs} $(SHLIB)

8 changes: 5 additions & 3 deletions src/Makevars.win
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ boost_fs_src=${wildcard boost/libs/filesystem/src/*.cpp}
boost_fs_objs=${boost_fs_src:.cpp=.o}

PKG_CPPFLAGS =-DROUT -I../inst/include -DRCPP_PARALLEL_USE_TBB=1 -fpermissive -DBOOST_NO_AUTO_PTR
cytolib_src=${wildcard *.cpp}
cytolib_objs=${cytolib_src:.cpp=.o}


#needs to wrap in $(shell) to strip the quotes returned by rhdf5lib::pkgconfig
Expand All @@ -24,6 +26,7 @@ PKG_LIBS = ${boost_fs_objs} ${boost_sys_objs} $(LAPACK_LIBS) $(BLAS_LIBS) $(FLI

USERDIR = ${R_PACKAGE_DIR}/lib${R_ARCH}
PKGLIB = ${USERDIR}/libcytolib.a
OBJECTS=dummy.o


all: $(SHLIB)
Expand All @@ -34,7 +37,7 @@ $(SHLIB): $(PKGLIB)
#expose static lib for other package to link to
$(PKGLIB): $(OBJECTS)
mkdir -p "${USERDIR}"
$(AR) rs "${PKGLIB}" $(OBJECTS) $(boost_fs_objs) ${boost_sys_objs}
$(AR) rs "${PKGLIB}" $(cytolib_objs) $(boost_fs_objs) ${boost_sys_objs}



Expand All @@ -44,5 +47,4 @@ $(boost_fs_objs): ${boost_sys_objs}


clean:
rm -f $(OBJECTS) ${boost_fs_objs} ${boost_sys_objs}

rm -f $(OBJECTS) ${cytolib_objs} ${boost_fs_objs} ${boost_sys_objs} $(SHLIB)

0 comments on commit 01c7e18

Please sign in to comment.