Skip to content

Commit

Permalink
[R-package] fix handling of custom paths in Windows GPU build (fixes m…
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Oct 30, 2022
1 parent 0c0eb2a commit a626b57
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions build_r.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,23 +95,26 @@ install_libs_content <- .replace_flag("use_msys2", USING_MSYS2, install_libs_con

# set up extra flags based on keyword arguments
keyword_args <- parsed_args[["keyword_args"]]
print("+-+-+-+-+-")
if (length(keyword_args) > 0L) {
cmake_args_to_add <- NULL
for (i in seq_len(length(keyword_args))) {
arg_name <- names(keyword_args)[[i]]
define_name <- ARGS_TO_DEFINES[[arg_name]]
arg_value <- shQuote(keyword_args[[arg_name]])
arg_value <- shQuote(normalizePath(keyword_args[[arg_name]], winslash = "/"))
cmake_args_to_add <- c(cmake_args_to_add, paste0(define_name, "=", arg_value))
}
install_libs_content <- gsub(
pattern = paste0("command_line_args <- NULL")
, replacement = paste0(
"command_line_args <- c(\""
, paste(cmake_args_to_add, collapse = "\", \"")
, "\")"
"command_line_args <- c(\'"
, paste(cmake_args_to_add, collapse = "', '")
, "')"
)
, x = install_libs_content
, fixed = TRUE
)
writeLines(install_libs_content, "C:/Users/James/repos/LightGBM/install-out.R")
}

# if provided, set '-j' in 'make' commands in install.libs.R
Expand Down

0 comments on commit a626b57

Please sign in to comment.