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
f2566311
Commit
f2566311
authored
Jul 14, 2017
by
Guolin Ke
Browse files
[python] update build command in setup.py
parent
fc59fce0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
7 deletions
+31
-7
R-package/src/install.libs.R
R-package/src/install.libs.R
+2
-1
python-package/setup.py
python-package/setup.py
+29
-6
No files found.
R-package/src/install.libs.R
View file @
f2566311
...
@@ -62,10 +62,11 @@ if (!use_precompile) {
...
@@ -62,10 +62,11 @@ if (!use_precompile) {
vs_def
<-
paste0
(
" -G \""
,
vs
,
"\""
)
vs_def
<-
paste0
(
" -G \""
,
vs
,
"\""
)
tmp_cmake_cmd
<-
paste0
(
cmake_cmd
,
vs_def
)
tmp_cmake_cmd
<-
paste0
(
cmake_cmd
,
vs_def
)
try_vs
<-
system
(
paste0
(
tmp_cmake_cmd
,
" .."
))
try_vs
<-
system
(
paste0
(
tmp_cmake_cmd
,
" .."
))
unlink
(
"./*"
,
recursive
=
TRUE
)
# Clean up build directory
if
(
try_vs
==
0
)
{
if
(
try_vs
==
0
)
{
local_vs_def
=
vs_def
local_vs_def
=
vs_def
break
break
}
else
{
unlink
(
"./*"
,
recursive
=
TRUE
)
# Clean up build directory
}
}
}
}
if
(
try_vs
==
1
)
{
if
(
try_vs
==
1
)
{
...
...
python-package/setup.py
View file @
f2566311
...
@@ -46,24 +46,47 @@ def copy_files(use_gpu=False):
...
@@ -46,24 +46,47 @@ def copy_files(use_gpu=False):
distutils
.
file_util
.
copy_file
(
"../LICENSE"
,
"./"
)
distutils
.
file_util
.
copy_file
(
"../LICENSE"
,
"./"
)
def
clear_path
(
path
):
contents
=
os
.
listdir
(
path
)
for
file
in
contents
:
file_path
=
os
.
path
.
join
(
path
,
file
)
if
os
.
path
.
isfile
(
file_path
):
os
.
remove
(
file_path
)
else
:
shutil
.
rmtree
(
file_path
)
def
compile_cpp
(
use_mingw
=
False
,
use_gpu
=
False
):
def
compile_cpp
(
use_mingw
=
False
,
use_gpu
=
False
):
if
not
os
.
path
.
exists
(
"build"
):
if
os
.
path
.
exists
(
"build"
):
shutil
.
rmtree
(
"build"
)
os
.
makedirs
(
"build"
)
os
.
makedirs
(
"build"
)
os
.
chdir
(
"build"
)
os
.
chdir
(
"build"
)
cmake_cmd
=
"cmake "
cmake_cmd
=
"cmake "
build_cmd
=
"make _lightgbm"
build_cmd
=
"make _lightgbm"
if
use_gpu
:
cmake_cmd
+=
" -DUSE_GPU=ON "
if
os
.
name
==
"nt"
:
if
os
.
name
==
"nt"
:
if
use_mingw
:
if
use_mingw
:
cmake_cmd
+=
" -G
\"
MinGW Makefiles
\"
"
cmake_cmd
+=
" -G
\"
MinGW Makefiles
\"
"
os
.
system
(
cmake_cmd
+
" ../lightgbm/"
)
build_cmd
=
"mingw32-make.exe _lightgbm"
build_cmd
=
"mingw32-make.exe _lightgbm"
else
:
else
:
cmake_cmd
+=
" -DCMAKE_GENERATOR_PLATFORM=x64 "
vs_versions
=
[
"Visual Studio 15 2017 Win64"
,
"Visual Studio 14 2015 Win64"
,
"Visual Studio 12 2013 Win64"
]
try_vs
=
1
for
vs
in
vs_versions
:
tmp_cmake_cmd
=
"%s -G
\"
%s
\"
"
%
(
cmake_cmd
,
vs
)
try_vs
=
os
.
system
(
tmp_cmake_cmd
+
" ../lightgbm/"
)
if
try_vs
==
0
:
cmake_cmd
=
tmp_cmake_cmd
break
else
:
clear_path
(
"./"
)
if
try_vs
!=
0
:
raise
Exception
(
'Please install Visual Studio or MS Build first'
)
build_cmd
=
"cmake --build . --target _lightgbm --config Release"
build_cmd
=
"cmake --build . --target _lightgbm --config Release"
if
use_gpu
:
cmake_cmd
+=
" -DUSE_GPU=ON "
print
(
"Start to compile libarary."
)
print
(
"Start to compile libarary."
)
os
.
system
(
cmake_cmd
+
" ../lightgbm/"
)
os
.
system
(
cmake_cmd
+
" ../lightgbm/"
)
os
.
system
(
build_cmd
)
os
.
system
(
build_cmd
)
...
...
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