summarylogtreecommitdiffstats
path: root/shared-cytolib.patch
blob: 0829dbc6b8bf43ab339928b72298963152b09647 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
diff --git a/cytolib/R/build.R b/cytolib/R/build.R
index 779fb83..6e42d7a 100644
--- a/cytolib/R/build.R
+++ b/cytolib/R/build.R
@@ -20,10 +20,7 @@ CxxFlags <- function() {
 #' @export
 #' @importFrom RProtoBufLib LdFlags
 cytolib_LdFlags <- function() {
-      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")))
+      cat("-lcytolib -lboost_filesystem -lboost_system")
   }
 
 
diff --git a/cytolib/src/Makevars.in b/cytolib/src/Makevars.in
index 0019570..0a7b232 100644
--- a/cytolib/src/Makevars.in
+++ b/cytolib/src/Makevars.in
@@ -8,12 +8,7 @@ ifneq (,)
 This makefile requires GNU Make.
 endif
 
-	
-CXX_STD = CXX11
-boost_sys_src=${wildcard boost/libs/system/src/*.cpp}
-boost_sys_objs=${boost_sys_src:.cpp=.o}
-boost_fs_src=${wildcard boost/libs/filesystem/src/*.cpp}
-boost_fs_objs=${boost_fs_src:.cpp=.o}
+CXX_STD = CXX17
 
 
 PKG_CPPFLAGS =-DROUT -I../inst/include -w -Wfatal-errors -DBOOST_NO_AUTO_PTR -DBOOST_FILESYSTEM_NO_CXX20_ATOMIC_REF -DBOOST_FILESYSTEM_SINGLE_THREADED #the last to flagsare needed to compile bundled boost file system library 1.78
@@ -21,28 +16,18 @@ PKG_CPPFLAGS =-DROUT -I../inst/include -w -Wfatal-errors -DBOOST_NO_AUTO_PTR -DB
 cytolib_src=${wildcard *.cpp}
 cytolib_objs=${cytolib_src:.cpp=.o}
 
-BOOSTFSLIB = libboost_fs.a
-USERDIR = ${R_PACKAGE_DIR}/lib${R_ARCH}
-USERLIB = ${USERDIR}/libcytolib.a
+USERLIB = libcytolib.so.@CYTOLIB_VERSION@
 
 OBJECTS=dummy.o
 
-#needs to wrap in $(shell) to strip the quotes returned by rhdf5lib::pkgconfig
-FSLIB = ${boost_fs_objs} ${boost_sys_objs}
+CLINK_CPPFLAGS := -I/usr/lib/R/library/RProtoBufLib/include
 
+RPROTOBUF_LIBS := $(shell Rscript -e "RProtoBufLib::LdFlags()")
 
+all: $(SHLIB) $(USERLIB)
 
-all: $(SHLIB) 
-
-$(SHLIB): $(USERLIB)
-
-$(USERLIB): ${boost_fs_objs} ${cytolib_objs} 
-	mkdir -p "${USERDIR}"
-	$(AR) rs "${USERLIB}" ${cytolib_objs} ${boost_fs_objs} ${boost_sys_objs}
-
-$(boost_fs_objs): ${boost_sys_objs}
-
+$(USERLIB): $(cytolib_objs)
+	$(CC) -shared $(LDFLAGS) -Wl,-soname=$(USERLIB) -o $@ $^ -lboost_filesystem -lboost_system -lhdf5_cpp -lhdf5 -llapack $(RPROTOBUF_LIBS) $(LIBR)
 
 clean:
 	rm -f $(OBJECTS) ${cytolib_objs} ${boost_fs_objs} ${boost_sys_objs} $(SHLIB)
-