-
Notifications
You must be signed in to change notification settings - Fork 59
/
Copy pathflags.R
53 lines (47 loc) · 1.17 KB
/
flags.R
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
#' Compilation flags for RcppParallel
#'
#' Output the compiler or linker flags required to build against RcppParallel.
#'
#' These functions are typically called from `Makevars` as follows:
#'
#' ```
#' PKG_LIBS += $(shell "${R_HOME}/bin/Rscript" -e "RcppParallel::LdFlags()")
#' ```
#'
#' On Windows, the flags ensure that the package links with the built-in TBB
#' library. On Linux and macOS, the output is empty, because TBB is loaded
#' dynamically on load by `RcppParallel`.
#'
#' \R packages using RcppParallel should also add the following to their
#' `NAMESPACE` file:
#'
#' ```
#' importFrom(RcppParallel, RcppParallelLibs)
#' ```
#'
#' This is necessary to ensure that \pkg{RcppParallel} (and so, TBB) is loaded
#' and available.
#'
#' @name flags
#' @rdname flags
#' @aliases RcppParallelLibs LdFlags CxxFlags
#'
#' @return Returns \code{NULL}, invisibly. These functions are called for
#' their side effects (writing the associated flags to stdout).
#'
NULL
#' @name flags
#' @export
CxxFlags <- function() {
cat(tbbCxxFlags())
}
#' @name flags
#' @export
LdFlags <- function() {
cat(tbbLdFlags())
}
#' @name flags
#' @export
RcppParallelLibs <- function() {
LdFlags()
}