Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
71c2dcc
vendor path
pachadotdev Feb 16, 2024
10d3565
Update tests/testthat/test-vendor.R
pachadotdev Apr 6, 2024
da1c84e
fix vendor
pachadotdev Apr 7, 2024
e2df430
improve DESCRIPTION change with vendoring
pachadotdev Apr 9, 2024
8845015
replace DESC/Make funs with user msg
pachadotdev May 13, 2024
6778095
fix eventual CRAN warning
pachadotdev May 13, 2024
c90eea4
testthat 3e
pachadotdev Oct 23, 2024
2729233
add and test unvendor function
pachadotdev Dec 6, 2024
fd99010
implement 25% of #297
pachadotdev Dec 17, 2024
b1d8858
almost complete implementation of r_complex
pachadotdev Dec 20, 2024
628ae8f
UPDATE AS.HPP
pachadotdev Dec 25, 2024
ca9c11e
temporary as.hpp
pachadotdev Dec 25, 2024
17ba519
handle cpp complex <-> R sexp
pachadotdev Dec 25, 2024
ea98a87
almost ok, push_back for complexes is pending
pachadotdev Dec 26, 2024
8e044f6
trying to add push_back for cplx
pachadotdev Dec 26, 2024
49ee179
trying to get push_back for cplx to work :\
pachadotdev Dec 26, 2024
b003c28
complex tests work, BUT THERE IS A CATCH ERROR I DO NOT GET
pachadotdev Dec 26, 2024
e642aa6
passed all test for cplx :D
pachadotdev Dec 27, 2024
d42f512
complex_matrix<>
pachadotdev Dec 27, 2024
f7ead22
cpp11test: add rcpp to imports + .here to .Rbuildignore
pachadotdev Dec 27, 2024
66b4ade
revert complexes_matrix<> for now
pachadotdev Dec 27, 2024
f5d6054
clang format
pachadotdev Dec 27, 2024
713f147
bool -> int + using transform for bool -> double
pachadotdev Dec 27, 2024
127e700
Merge branch 'main' into testthat3e
pachadotdev Dec 27, 2024
f7383a0
fix #273
pachadotdev Dec 27, 2024
73231a5
use sexp instead of auto for C++ older than 14
pachadotdev Dec 27, 2024
812e6ce
replace auto with attribute_proxy<V>
pachadotdev Dec 27, 2024
5217ded
use SEXP
pachadotdev Dec 27, 2024
1b51d23
test again
pachadotdev Dec 27, 2024
b919f41
try to fix build error on gh actions
pachadotdev Dec 27, 2024
a91c3ed
Define SET_COMPLEX_ELT if not defined
pachadotdev Dec 27, 2024
814b408
implement @stephematician suggestion
pachadotdev Dec 28, 2024
511a7ed
re-add complex matrix with tests
pachadotdev Dec 29, 2024
bbee709
fix #406
pachadotdev Jan 1, 2025
496dd6b
borrow from @traversc's push_back_fast
pachadotdev Jan 1, 2025
008ab7c
add benchmarks
pachadotdev Jan 1, 2025
f717e3d
fix unvendor example
pachadotdev Jan 1, 2025
6f84867
implement #431
pachadotdev Jan 1, 2025
2d4bbb5
implement #432
pachadotdev Jan 1, 2025
9673bb2
implement #435
pachadotdev Jan 1, 2025
6dbf339
fix pkgdown error
pachadotdev Jan 1, 2025
a03a126
draft map -> list/sexp
pachadotdev Jan 1, 2025
aaed104
ordered and unordered C++ maps are converted to R lists
pachadotdev Jan 2, 2025
70c68df
template map to list conversion
pachadotdev Jan 2, 2025
9ebcf41
fix sum rcpp error on Unix systems (cpp11test)
pachadotdev Jan 3, 2025
fb3583f
roxygen comments on cpp side (works ok with 1 roxygenised function pe…
pachadotdev Jan 3, 2025
14531db
almost there with rx/no rx in the same file
pachadotdev Jan 4, 2025
c750115
correctly handles roxygen in cpp files
pachadotdev Jan 4, 2025
fb848c6
revert some styler changes to make the changes more clear
pachadotdev Jan 4, 2025
17cac60
fix multi line roxygen examples
pachadotdev Jan 4, 2025
7a436d6
add roxygen example to documentation
pachadotdev Jan 4, 2025
a781c99
consider the case where a file does not exist
pachadotdev Jan 4, 2025
f717713
do not roxygenize chunk in vignette
pachadotdev Jan 4, 2025
fbb365f
workaround for roxygen comments in cpp chunks
pachadotdev Jan 5, 2025
c91f4ef
revert to eval = F
pachadotdev Jan 5, 2025
b1d8ecd
implement #312
pachadotdev Feb 1, 2025
7a72ec9
implement fix for #445
pachadotdev May 9, 2025
fcb7756
only one cstdlib in data_frame.hpp
pachadotdev May 9, 2025
012e4e0
use inline constexpr for doubles/integers/list/logicals/strings
pachadotdev May 9, 2025
2be6542
use noexcept in protect/sexp
pachadotdev May 9, 2025
91c3bd4
noexcept in operator SEXP (attribute proxy)
pachadotdev May 9, 2025
472f40f
+ noexcept
pachadotdev May 9, 2025
4209cf0
clang format
pachadotdev May 9, 2025
b0b3f47
rollback noexcept
pachadotdev May 9, 2025
8fdaaef
clang format
pachadotdev May 9, 2025
a80ae91
fix typos
pachadotdev May 9, 2025
ff8e314
fix r_Vector
pachadotdev May 9, 2025
f7fd0e0
fix strings
pachadotdev May 9, 2025
e0229d5
rollback strings
pachadotdev May 9, 2025
ddf5300
rollback strings
pachadotdev May 9, 2025
9851423
use a lamba to unwind protect around the loop
pachadotdev Aug 26, 2025
c016918
Use values added to a vector with push_back immediately
pachadotdev Aug 26, 2025
8ee112a
fix clang format
pachadotdev Aug 26, 2025
8093e12
llvm formatt
pachadotdev Sep 7, 2025
6783944
Global symbol visibility
pachadotdev Sep 15, 2025
5114411
clang ofrmat
pachadotdev Sep 15, 2025
acdcf61
clang format
pachadotdev Sep 15, 2025
e340f78
clang format 12
pachadotdev Sep 15, 2025
3c6e5c6
clang fmt
pachadotdev Sep 15, 2025
224b9af
check unix tests
pachadotdev Sep 15, 2025
72d2f37
Merge pull request #1 from pachadotdev/issue460
pachadotdev Sep 16, 2025
36ef9b7
Merge pull request #2 from pachadotdev/issue453
pachadotdev Sep 16, 2025
2c56e1a
Merge pull request #3 from pachadotdev/issue452
pachadotdev Sep 16, 2025
7256c37
Merge pull request #4 from pachadotdev/issue406
pachadotdev Sep 16, 2025
8e7a80d
Merge pull request #5 from pachadotdev/issue297
pachadotdev Sep 16, 2025
66d37b1
Merge pull request #6 from pachadotdev/compilationspeed
pachadotdev Sep 16, 2025
1487985
Merge pull request #7 from pachadotdev/nullable_extptr
pachadotdev Sep 16, 2025
5eff766
Merge branch 'main' into roxygen
pachadotdev Sep 16, 2025
bd30629
Merge pull request #8 from pachadotdev/roxygen
pachadotdev Sep 16, 2025
b63d96c
Merge branch 'main' into 419
pachadotdev Sep 16, 2025
a33c8b5
Merge pull request #9 from pachadotdev/419
pachadotdev Sep 16, 2025
4441386
Merge branch 'main' into vignettes
pachadotdev Sep 16, 2025
49953b9
Merge pull request #10 from pachadotdev/vignettes
pachadotdev Sep 16, 2025
b041c48
Merge branch 'main' into named_arg_utf8
pachadotdev Sep 16, 2025
67f3fb1
Merge pull request #11 from pachadotdev/named_arg_utf8
pachadotdev Sep 16, 2025
55fd0f0
Merge branch 'main' into vmaxgetset
pachadotdev Sep 16, 2025
b44690d
Merge pull request #12 from pachadotdev/vmaxgetset
pachadotdev Sep 16, 2025
6b36c1a
Merge branch 'main' into 3Fto1T
pachadotdev Sep 16, 2025
926b078
Merge pull request #13 from pachadotdev/3Fto1T
pachadotdev Sep 16, 2025
fbded54
Merge branch 'main' into matrix_attr
pachadotdev Sep 16, 2025
5e945fc
Merge pull request #14 from pachadotdev/matrix_attr
pachadotdev Sep 16, 2025
b5e5e34
Merge branch 'main' into complex
pachadotdev Sep 16, 2025
a107194
Merge pull request #15 from pachadotdev/complex
pachadotdev Sep 16, 2025
fd74b51
Merge branch 'main' into 255
pachadotdev Sep 16, 2025
e62c914
Merge pull request #16 from pachadotdev/255
pachadotdev Sep 16, 2025
bd5d79b
Merge branch 'main' into testthat3e
pachadotdev Sep 16, 2025
e350bbf
Merge pull request #17 from pachadotdev/testthat3e
pachadotdev Sep 16, 2025
33d04f4
Merge branch 'main' into vendoring
pachadotdev Sep 16, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 35 additions & 11 deletions R/vendor.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@
#' cpp11 currently installed on your machine.
#'
#' If you choose to vendor the headers you should _remove_ `LinkingTo:
#' cpp11` from your DESCRIPTION.
#' cpp11` from your DESCRIPTION. This is done automatically by this function.
#'
#' **Note**: vendoring places the responsibility of updating the code on
#' **you**. Bugfixes and new features in cpp11 will not be available for your
#' code until you run `cpp_vendor()` again.
#'
#' @inheritParams cpp_register
#' @param path The path to vendor the code into. The default is
#' `./inst/include/`.
#' @return The file path to the vendored code (invisibly).
#' @export
#' @examples
Expand All @@ -30,13 +31,15 @@
#'
#' # cleanup
#' unlink(dir, recursive = TRUE)
cpp_vendor <- function(path = ".") {
new <- file.path(path, "inst", "include", "cpp11")
cpp_vendor <- function(path = "./inst/include/") {
new <- file.path(path, "cpp11")

if (dir.exists(new)) {
stop("'", new, "' already exists\n * run unlink('", new, "', recursive = TRUE)", call. = FALSE)
}

# Vendor cpp11 ----

dir.create(new , recursive = TRUE, showWarnings = FALSE)

current <- system.file("include", "cpp11", package = "cpp11")
Expand All @@ -48,16 +51,37 @@ cpp_vendor <- function(path = ".") {

cpp11_header <- sprintf("// cpp11 version: %s\n// vendored on: %s", cpp11_version, Sys.Date())

files <- list.files(current, full.names = TRUE)
write_header(path, "cpp11.hpp", "cpp11", cpp11_header)

copy_files(list.files(current, full.names = TRUE), path, "cpp11", cpp11_header)

# Additional steps to make vendoring work ----

message(paste(
"Makevars and/or Makevars.win should have a line such as",
"'PKG_CPPFLAGS = -I../inst/include'"
))

message("DESCRIPTION should not have lines such as 'LinkingTo: cpp11'")

invisible(new)
}

write_header <- function(path, header, pkg, cpp11_header) {
writeLines(
c(cpp11_header, readLines(system.file("include", "cpp11.hpp", package = "cpp11"))),
file.path(dirname(new), "cpp11.hpp")
c(
cpp11_header,
readLines(system.file("include", header, package = pkg))
),
file.path(path, header)
)
}

copy_files <- function(files, path, out, cpp11_header) {
for (f in files) {
writeLines(c(cpp11_header, readLines(f)), file.path(new, basename(f)))
writeLines(
c(cpp11_header, readLines(f)),
file.path(path, out, basename(f))
)
}

invisible(new)
}
}
7 changes: 4 additions & 3 deletions man/cpp_vendor.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/testthat/test-vendor.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ describe("cpp_vendor", {

cpp_vendor(pkg_path(pkg))

expect_true(dir.exists(file.path(p, "inst", "include", "cpp11")))
expect_true(file.exists(file.path(p, "inst", "include", "cpp11.hpp")))
expect_true(file.exists(file.path(p, "inst", "include", "cpp11", "declarations.hpp")))
expect_true(dir.exists(file.path(p, "cpp11")))
expect_true(file.exists(file.path(p, "cpp11.hpp")))
expect_true(file.exists(file.path(p, "cpp11", "declarations.hpp")))
})
})