Unverified Commit 15d861ce authored by James Lamb's avatar James Lamb Committed by GitHub
Browse files

[R-package] fixed overly-strict compiler check in install.libs.R (fixes #2259) (#2339)

* fixed overly-strict copmiler check in install.libs.R (fixes #2259)

* made compiler check in install.libs.R more defensive
parent 20f94c52
......@@ -45,7 +45,18 @@ if (!use_precompile) {
}
# Could NOT find OpenMP_C on Mojave workaround
if (Sys.info()['sysname'] == 'Darwin' && !(grepl('^gcc', Sys.getenv('CC', '')) & grepl('^g\\+\\+', Sys.getenv('CXX', '')))) {
# Using this kind-of complicated pattern to avoid matching to
# things like "pgcc"
using_gcc <- grepl(
pattern = '^gcc$|[/\\]+gcc|^gcc\\-[0-9]+$|[/\\]+gcc\\-[0-9]+$'
, x = Sys.getenv('CC', '')
)
using_gpp <- grepl(
pattern = '^g\\+\\+$|[/\\]+g\\+\\+|^g\\+\\+\\-[0-9]+$|[/\\]+g\\+\\+\\-[0-9]+$'
, x = Sys.getenv('CXX', '')
)
on_mac <- Sys.info()['sysname'] == 'Darwin'
if (on_mac && !(using_gcc & using_gpp)) {
cmake_cmd <- paste(cmake_cmd, ' -DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" ')
cmake_cmd <- paste(cmake_cmd, ' -DOpenMP_C_LIB_NAMES="omp" ')
cmake_cmd <- paste(cmake_cmd, ' -DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp -I$(brew --prefix libomp)/include" ')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment