Fix mingw build with R. (#5918)

This commit is contained in:
Jiaming Yuan 2020-07-22 02:56:49 +08:00 committed by GitHub
parent 8d7702766a
commit 9b688aca3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 10 deletions

View File

@ -37,8 +37,8 @@ endif()
# Creates R.lib and R.def in the build directory for linking with MSVC # Creates R.lib and R.def in the build directory for linking with MSVC
function(create_rlib_for_msvc) function(create_rlib_for_msvc)
# various checks and warnings # various checks and warnings
if(NOT WIN32 OR NOT MSVC) if(NOT WIN32 OR (NOT MSVC AND NOT MINGW))
message(FATAL_ERROR "create_rlib_for_msvc() can only be used with MSVC") message(FATAL_ERROR "create_rlib_for_msvc() can only be used with MSVC or MINGW")
endif() endif()
if(NOT EXISTS "${LIBR_LIB_DIR}") if(NOT EXISTS "${LIBR_LIB_DIR}")
message(FATAL_ERROR "LIBR_LIB_DIR was not set!") message(FATAL_ERROR "LIBR_LIB_DIR was not set!")
@ -158,7 +158,7 @@ message(STATUS "LIBR_CORE_LIBRARY [${LIBR_CORE_LIBRARY}]")
endif() endif()
if(WIN32 AND MSVC) if((WIN32 AND MSVC) OR (WIN32 AND MINGW))
# create a local R.lib import library for R.dll if it doesn't exist # create a local R.lib import library for R.dll if it doesn't exist
if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/R.lib") if(NOT EXISTS "${CMAKE_CURRENT_BINARY_DIR}/R.lib")
create_rlib_for_msvc() create_rlib_for_msvc()

View File

@ -94,7 +94,7 @@ TEST(GPUPredictor, ExternalMemoryTest) {
gpu_predictor->Configure({}); gpu_predictor->Configure({});
LearnerModelParam param; LearnerModelParam param;
param.num_feature = 2; param.num_feature = 5;
const int n_classes = 3; const int n_classes = 3;
param.num_output_group = n_classes; param.num_output_group = n_classes;
param.base_score = 0.5; param.base_score = 0.5;