Skip to content

Vendoring is the act of making your own copy of the 3rd party packages your project is using. It is often used in the go language community.

Usage

cpp_vendor(path = ".")

Arguments

path

The path to the package root directory

Value

The file path to the vendored code (invisibly).

Details

This function vendors cpp11 into your package by copying the cpp11 headers into the inst/include folder of your package and adding 'cpp11 version: XYZ' to the top of the files, where XYZ is the version of cpp11 currently installed on your machine.

If you choose to vendor the headers you should remove LinkingTo: cpp11 from your DESCRIPTION.

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.

Examples

# create a new directory
dir <- tempfile()
dir.create(dir)

# vendor the cpp11 headers into the directory
cpp_vendor(dir)

list.files(file.path(dir, "inst", "include", "cpp11"))
#>  [1] "R.hpp"                "altrep.hpp"           "as.hpp"              
#>  [4] "attribute_proxy.hpp"  "data_frame.hpp"       "declarations.hpp"    
#>  [7] "doubles.hpp"          "environment.hpp"      "external_pointer.hpp"
#> [10] "function.hpp"         "integers.hpp"         "list.hpp"            
#> [13] "list_of.hpp"          "logicals.hpp"         "matrix.hpp"          
#> [16] "named_arg.hpp"        "protect.hpp"          "r_bool.hpp"          
#> [19] "r_string.hpp"         "r_vector.hpp"         "raws.hpp"            
#> [22] "sexp.hpp"             "strings.hpp"         

# cleanup
unlink(dir, recursive = TRUE)