Enable building rabit on Windows (#6105)

This commit is contained in:
Jiaming Yuan
2020-09-11 11:54:46 +08:00
committed by GitHub
parent 08bdb2efc8
commit c92d751ad1
17 changed files with 215 additions and 352 deletions

View File

@@ -26,22 +26,13 @@ def get_mingw_bin():
def test_with_autotools(args):
with DirectoryExcursion(r_package):
if args.compiler == 'mingw':
mingw_bin = get_mingw_bin()
CXX = os.path.join(mingw_bin, 'g++.exe')
CC = os.path.join(mingw_bin, 'gcc.exe')
cmd = ['R.exe', 'CMD', 'INSTALL', str(os.path.curdir)]
env = os.environ.copy()
env.update({'CC': CC, 'CXX': CXX})
subprocess.check_call(cmd, env=env)
elif args.compiler == 'msvc':
cmd = ['R.exe', 'CMD', 'INSTALL', str(os.path.curdir)]
env = os.environ.copy()
# autotool favor mingw by default.
env.update({'CC': 'cl.exe', 'CXX': 'cl.exe'})
subprocess.check_call(cmd, env=env)
else:
raise ValueError('Wrong compiler')
mingw_bin = get_mingw_bin()
CXX = os.path.join(mingw_bin, 'g++.exe')
CC = os.path.join(mingw_bin, 'gcc.exe')
cmd = ['R.exe', 'CMD', 'INSTALL', str(os.path.curdir)]
env = os.environ.copy()
env.update({'CC': CC, 'CXX': CXX})
subprocess.check_call(cmd, env=env)
subprocess.check_call([
'R.exe', '-q', '-e',
"library(testthat); setwd('tests'); source('testthat.R')"