Skip to content

Commit fc7fdb4

Browse files
committed
docs: Add install instructions in README
1 parent f8e2ab8 commit fc7fdb4

File tree

7 files changed

+68
-6
lines changed

7 files changed

+68
-6
lines changed

.Rbuildignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
^.*\.Rproj$
2+
^\.Rproj\.user$

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
*.o
22
*.so
33
.Rhistory
4+
*.Rcheck
5+
.Rproj.user
6+
*.tgz
7+
*.tar.gz

DESCRIPTION

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,18 @@
11
Package: swigr
2-
Title: What the Package Does (One Line, Title Case)
2+
Title: An example R package using SWIG to wrap C++
33
Version: 0.0.1
44
Authors@R:
55
person(given = "First",
66
family = "Last",
77
role = c("aut", "cre"),
88
email = "first.last@example.com",
99
comment = c(ORCID = "YOUR-ORCID-ID"))
10-
Description: What the package does (one paragraph).
11-
License: What license it uses
10+
Description: A simple example repo to test making an R package
11+
from C++ code using SWIG to generate wrapper code. The goal is
12+
to make it easy to install for both Linux, MacOS and Windows
13+
users. Windows users should be able to install a binary package
14+
to not require tools to compile the C++ code.
15+
License: AGPL (>= 3)
1216
Encoding: UTF-8
1317
LazyData: true
1418
RoxygenNote: 7.1.0

README.md

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
1-
# swigr
2-
An example project to test building an R package from C++ code using SWIG
1+
# SwigR - An example R package using SWIG to wrap C++
2+
3+
A simple example repo to test making an R package
4+
from C++ code using SWIG to generate wrapper code. The goal is
5+
to make it easy to install for both Linux, MacOS and Windows
6+
users. Windows users should be able to install a binary package
7+
to not require tools to compile the C++ code.
8+
9+
## Install
10+
11+
Swigr can be installed as a source package from R by running
12+
13+
```R
14+
devtools::install_github("danieledler/swigr")
15+
```
16+
17+
Binary bundle can be installed from R by running
18+
19+
```R
20+
devtools::install_url("https://github.com/danieledler/swigr/releases/download/v0.0.1/swigr_0.0.1.tgz")
21+
```
22+
323

424
## TODO
525

6-
Add `zzz.R` with `.onUnload()` to clean SWIG?
26+
* Add `zzz.R` with `.onUnload()` to clean SWIG?

build.R

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ setwd("~/dev/R/swig")
2020
devtools::install("swigr")
2121
setwd("~/dev/R/swig/swigr")
2222

23+
# Install local binary bundle
24+
devtools::install_url("file:///Users/Daniel/dev/R/swig/swigr_bin_man.tgz")
25+
2326
# Test package
2427
swigr::test_r()
2528
swigr::test_example()

demo/runme.R

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,21 @@
55
# source("example.R")
66
# cacheMetaData(1)
77

8+
search()
9+
#detach(package:swig, unload = TRUE)
10+
811
install.packages("devtools")
12+
13+
# Install from github
914
devtools::install_github("danieledler/swigr")
1015

16+
# Install source bundle from URL
17+
devtools::install_url("https://github.com/danieledler/swigr/releases/download/v0.0.1/swigr_0.0.1.tar.gz")
18+
19+
# Install binary bundle from URL
20+
devtools::install_url("https://github.com/danieledler/swigr/releases/download/v0.0.1/swigr_0.0.1.tgz")
21+
22+
1123
swigr::test_example()
1224

1325
# ----- Object creation -----

swigr.Rproj

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Version: 1.0
2+
3+
RestoreWorkspace: Default
4+
SaveWorkspace: Default
5+
AlwaysSaveHistory: Default
6+
7+
EnableCodeIndexing: Yes
8+
UseSpacesForTab: Yes
9+
NumSpacesForTab: 2
10+
Encoding: UTF-8
11+
12+
RnwWeave: Sweave
13+
LaTeX: pdfLaTeX
14+
15+
BuildType: Package
16+
PackageUseDevtools: Yes
17+
PackageInstallArgs: --no-multiarch --with-keep.source

0 commit comments

Comments
 (0)