Browse Source

auto-gen init.c

master
boB Rudis 3 years ago
parent
commit
30b36eeb39
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
  1. 3
      DESCRIPTION
  2. 19
      src/Makevars
  3. 4
      src/init.c
  4. 2
      src/swiftspeech.swift

3
DESCRIPTION

@ -16,7 +16,8 @@ License: MIT + file LICENSE
Suggests:
covr, tinytest
Depends:
R (>= 3.6.0)
R (>= 3.6.0),
swiftr
Roxygen: list(markdown = TRUE)
RoxygenNote: 7.1.1
RequiresCompilation: yes

19
src/Makevars

@ -2,7 +2,7 @@ SWIFTC = /usr/bin/swiftc
INSTALL_NAME_TOOL = /usr/bin/install_name_tool
SWIFTLIB = libswiftspeech.dylib
LIBDIR = ../inst/lib
DEVLIB = ../lib
DEVLIBDIR = ../lib
REQUIRED_ARGS = -I /Library/Frameworks/R.framework/Headers -F/Library/Frameworks -framework R -emit-library
# add any additional frameworks being used here
EXTRA_FRAMEWORKS = -framework CoreML -framework NaturalLanguage
@ -14,19 +14,26 @@ BRIDGING_HEADER = -import-objc-header swiftspeech.h
PKG_DYNLIB = swiftspeech.so
# linker glue
PKG_LIBS = -lswiftspeech -L../inst/lib
SOURCES = init.c
OBJECTS = init.o
all: $(SHLIB) swiftLibrary
all: glue $(SHLIB) swiftLibrary
glue:
# this makes the R registration code/init.c
Rscript -e "swiftr::add_registration_glue()"
swiftLibrary: $(SWIFTLIB)
# this is where the dylib will go for pkg installation
-@if test ! -e $(LIBDIR); then mkdir -p $(LIBDIR); fi
cp $(SWIFTLIB) $(LIBDIR)
# this is where the dylib will go during development
-@if test ! -e $(DEVLIB); then mkdir -p $(DEVLIB); fi
cp $(SWIFTLIB) $(DEVLIB)
# this is where the dylib will go during development b/c "@loader_path"
-@if test ! -e $(DEVLIBDIR); then mkdir -p $(DEVLIBDIR); fi
cp $(SWIFTLIB) $(DEVLIBDIR)
$(SWIFTLIB): $(OBJECTS)
# comnpile packate "glue"
# compile packate "glue"
$(SHLIB_CXXLD) -o $(SWIFTLIB) $^ $(SHLIB_CXXLDFLAGS) $(LDFLAGS) $(ALL_LIBS)
# compile swift compoonents
$(SWIFTC) $(REQUIRED_ARGS) $(BRIDGING_HEADER) $(EXTRA_FRAMEWORKS) $(SWIFT_SRC)

4
src/init.c

@ -1,6 +1,7 @@
// Generated by swiftr: do not edit by hand
#include <R.h>
#include <Rinternals.h>
#include <stdlib.h> // for NULL
#include <stdlib.h>
#include <R_ext/Rdynload.h>
extern SEXP part_of_speech(SEXP);
@ -14,3 +15,4 @@ void R_init_daybreak(DllInfo *dll) {
R_registerRoutines(dll, NULL, CallEntries, NULL, NULL);
R_useDynamicSymbols(dll, FALSE);
}

2
src/swiftspeech.swift

@ -37,4 +37,4 @@ public func part_of_speech(_ x: SEXP) -> SEXP {
Rf_unprotect(1)
return(out!)
}
}
Loading…
Cancel
Save