Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
tianlh
LightGBM-DCU
Commits
8843703a
Unverified
Commit
8843703a
authored
Aug 06, 2024
by
James Lamb
Committed by
GitHub
Aug 06, 2024
Browse files
[R-package] [cmake] simplify CMake-based R builds (#6591)
Co-authored-by:
Nikita Titov
<
nekit94-08@mail.ru
>
parent
ff2c62a4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
19 deletions
+7
-19
R-package/src/install.libs.R
R-package/src/install.libs.R
+7
-19
No files found.
R-package/src/install.libs.R
View file @
8843703a
...
@@ -15,14 +15,8 @@ if (.Machine$sizeof.pointer != 8L) {
...
@@ -15,14 +15,8 @@ if (.Machine$sizeof.pointer != 8L) {
stop
(
"LightGBM only supports 64-bit R, please check the version of R and Rtools."
)
stop
(
"LightGBM only supports 64-bit R, please check the version of R and Rtools."
)
}
}
R_int_UUID
<-
.Internal
(
internalsID
())
R_ver
<-
as.double
(
R.Version
()
$
major
)
+
as.double
(
R.Version
()
$
minor
)
/
10.0
R_ver
<-
as.double
(
R.Version
()
$
major
)
+
as.double
(
R.Version
()
$
minor
)
/
10.0
if
(
!
(
R_int_UUID
==
"0310d4b8-ccb1-4bb8-ba94-d36a55f60262"
||
R_int_UUID
==
"2fdf6c18-697a-4ba7-b8ef-11c0d92f1327"
))
{
warning
(
"Warning: unmatched R_INTERNALS_UUID, may not run normally."
)
}
# Get some paths
# Get some paths
source_dir
<-
file.path
(
R_PACKAGE_SOURCE
,
"src"
,
fsep
=
"/"
)
source_dir
<-
file.path
(
R_PACKAGE_SOURCE
,
"src"
,
fsep
=
"/"
)
build_dir
<-
file.path
(
source_dir
,
"build"
,
fsep
=
"/"
)
build_dir
<-
file.path
(
source_dir
,
"build"
,
fsep
=
"/"
)
...
@@ -133,7 +127,13 @@ if (WINDOWS && use_visual_studio) {
...
@@ -133,7 +127,13 @@ if (WINDOWS && use_visual_studio) {
}
}
# Prepare installation steps
# Prepare installation steps
cmake_args
<-
NULL
cmake_args
<-
c
(
"-D__BUILD_FOR_R=ON"
# pass in R version, to help FindLibR find the R library
,
sprintf
(
"-DCMAKE_R_VERSION='%s.%s'"
,
R.Version
()[[
"major"
]],
R.Version
()[[
"minor"
]])
# ensure CMake build respects how R is configured (`R CMD config SHLIB_EXT`)
,
sprintf
(
"-DCMAKE_SHARED_LIBRARY_SUFFIX_CXX='%s'"
,
SHLIB_EXT
)
)
build_cmd
<-
"make"
build_cmd
<-
"make"
build_args
<-
c
(
"_lightgbm"
,
make_args_from_build_script
)
build_args
<-
c
(
"_lightgbm"
,
make_args_from_build_script
)
lib_folder
<-
file.path
(
source_dir
,
fsep
=
"/"
)
lib_folder
<-
file.path
(
source_dir
,
fsep
=
"/"
)
...
@@ -174,18 +174,6 @@ windows_makefile_generator <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["makefil
...
@@ -174,18 +174,6 @@ windows_makefile_generator <- WINDOWS_BUILD_TOOLS[[windows_toolchain]][["makefil
if
(
use_gpu
)
{
if
(
use_gpu
)
{
cmake_args
<-
c
(
cmake_args
,
"-DUSE_GPU=ON"
)
cmake_args
<-
c
(
cmake_args
,
"-DUSE_GPU=ON"
)
}
}
cmake_args
<-
c
(
cmake_args
,
"-D__BUILD_FOR_R=ON"
)
# Pass in R version, used to help find R executable for linking
R_version_string
<-
paste
(
R.Version
()[[
"major"
]]
,
R.Version
()[[
"minor"
]]
,
sep
=
"."
)
r_version_arg
<-
sprintf
(
"-DCMAKE_R_VERSION='%s'"
,
R_version_string
)
# ensure CMake build respects how R is configured (`R CMD config SHLIB_EXT`)
shlib_ext_arg
<-
sprintf
(
"-DCMAKE_SHARED_LIBRARY_SUFFIX_CXX='%s'"
,
SHLIB_EXT
)
cmake_args
<-
c
(
cmake_args
,
r_version_arg
,
shlib_ext_arg
)
# the checks below might already run `cmake -G`. If they do, set this flag
# the checks below might already run `cmake -G`. If they do, set this flag
# to TRUE to avoid re-running it later
# to TRUE to avoid re-running it later
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment