Skip to content

Commit

Permalink
trying to find MinGW
Browse files Browse the repository at this point in the history
  • Loading branch information
jameslamb committed Apr 19, 2020
1 parent 8264f4a commit 05c59f4
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 52 deletions.
12 changes: 7 additions & 5 deletions .ci/test_r_package_windows.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ function Download-File-With-Retries {
[string]$destfile
)
do {
Write-Output "Downloading '${url}'"
Write-Output "Downloading ${url}"
sleep 5;
(New-Object System.Net.WebClient).DownloadFile($url, $destfile)
} while(!$?);
Expand All @@ -15,7 +15,7 @@ function Download-File-With-Retries {
$env:R_WINDOWS_VERSION = "3.6.3"
$env:R_LIB_PATH = "$env:BUILD_SOURCESDIRECTORY/RLibrary" -replace '[\\]', '/'
Write-Output "R_LIB_PATH: $env:R_LIB_PATH"
$env:PATH = "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH
$env:PATH = "$env:R_LIB_PATH/Rtools/mingw_64/bin;" + "$env:R_LIB_PATH/Rtools/bin;" + "$env:R_LIB_PATH/R/bin/x64;" + "$env:R_LIB_PATH/miktex/texmfs/install/miktex/bin/x64;" + $env:PATH
$env:CRAN_MIRROR = "https://cloud.r-project.org/"
$env:CTAN_MIRROR = "https://ctan.math.illinois.edu/systems/win32/miktex/tm/packages/"

Expand Down Expand Up @@ -46,9 +46,9 @@ Write-Output "Installing Rtools"
Start-Process -FilePath Rtools.exe -NoNewWindow -Wait -ArgumentList "/VERYSILENT /DIR=$env:R_LIB_PATH/Rtools" ; Check-Output $?
Write-Output "Done installing Rtools"

# MiKTeX and pandoc can be skipped on MSVC builds, since we don't
# MiKTeX and pandoc can be skipped on Azure builds, since we don't
# build the package documentation for those
if ($env:COMPILER -ne "MSVC") {
if ($env:AZURE -ne "true") {

Write-Output "Downloading MiKTeX"
Download-File-With-Retries -url "https://miktex.org/download/win/miktexsetup-x64.zip" -destfile "miktexsetup-x64.zip"
Expand All @@ -66,6 +66,8 @@ if ($env:COMPILER -ne "MSVC") {

Add-Content .Renviron "R_LIBS=$env:R_LIB_PATH"

Get-ChildItem -Recurse "$env:R_LIB_PATH"

Write-Output "Installing dependencies"
$packages = "c('data.table', 'jsonlite', 'Matrix', 'R6', 'testthat'), dependencies = c('Imports', 'Depends', 'LinkingTo')"
Rscript --vanilla -e "options(install.packages.check.source = 'no'); install.packages($packages, repos = '$env:CRAN_MIRROR', type = 'binary', lib = '$env:R_LIB_PATH')" ; Check-Output $?
Expand All @@ -77,7 +79,7 @@ $PKG_FILE_NAME = Get-Item *.tar.gz
$LOG_FILE_NAME = "lightgbm.Rcheck/00check.log"

$env:_R_CHECK_FORCE_SUGGESTS_=0
if ($env:COMPILER -eq "MSVC") {
if ($env:AZURE -eq "true") {
Write-Output "Running R CMD check without checking documentation"
R.exe CMD check --no-multiarch --no-examples --no-manual --ignore-vignettes ${PKG_FILE_NAME} ; $check_succeeded=$?
} else {
Expand Down
94 changes: 47 additions & 47 deletions .vsts-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,50 +146,50 @@ jobs:
artifactName: PackageAssets
artifactType: container

###########################################
- job: Package
###########################################
dependsOn:
- Linux
- MacOS
- Windows
condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
pool:
vmImage: 'vs2017-win2016'
steps:
# Download all agent packages from all previous phases
- task: DownloadBuildArtifacts@0
displayName: Download package assets
inputs:
artifactName: PackageAssets
downloadPath: $(Build.SourcesDirectory)/binaries
- script: |
python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets
displayName: 'Create NuGet configuration files'
- task: NuGetCommand@2
inputs:
command: pack
packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec'
packDestination: '$(Build.ArtifactStagingDirectory)'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: '$(Build.ArtifactStagingDirectory)'
artifactName: NuGet
artifactType: container
- task: GitHubRelease@0
displayName: 'Create GitHub Release'
condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
inputs:
gitHubConnection: guolinke
repositoryName: '$(Build.Repository.Name)'
action: 'create'
target: '$(Build.SourceVersion)'
tagSource: 'auto'
title: '$(Build.SourceBranchName)'
assets: |
$(Build.SourcesDirectory)/binaries/PackageAssets/*
$(Build.ArtifactStagingDirectory)/*.nupkg
assetUploadMode: 'delete'
isDraft: true
isPreRelease: false
addChangeLog: false
# ###########################################
# - job: Package
# ###########################################
# dependsOn:
# - Linux
# - MacOS
# - Windows
# condition: and(succeeded(), not(startsWith(variables['Build.SourceBranch'], 'refs/pull/')))
# pool:
# vmImage: 'vs2017-win2016'
# steps:
# # Download all agent packages from all previous phases
# - task: DownloadBuildArtifacts@0
# displayName: Download package assets
# inputs:
# artifactName: PackageAssets
# downloadPath: $(Build.SourcesDirectory)/binaries
# - script: |
# python %BUILD_SOURCESDIRECTORY%/.nuget/create_nuget.py %BUILD_SOURCESDIRECTORY%/binaries/PackageAssets
# displayName: 'Create NuGet configuration files'
# - task: NuGetCommand@2
# inputs:
# command: pack
# packagesToPack: '$(Build.SourcesDirectory)/.nuget/*.nuspec'
# packDestination: '$(Build.ArtifactStagingDirectory)'
# - task: PublishBuildArtifacts@1
# inputs:
# pathtoPublish: '$(Build.ArtifactStagingDirectory)'
# artifactName: NuGet
# artifactType: container
# - task: GitHubRelease@0
# displayName: 'Create GitHub Release'
# condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v'))
# inputs:
# gitHubConnection: guolinke
# repositoryName: '$(Build.Repository.Name)'
# action: 'create'
# target: '$(Build.SourceVersion)'
# tagSource: 'auto'
# title: '$(Build.SourceBranchName)'
# assets: |
# $(Build.SourcesDirectory)/binaries/PackageAssets/*
# $(Build.ArtifactStagingDirectory)/*.nupkg
# assetUploadMode: 'delete'
# isDraft: true
# isPreRelease: false
# addChangeLog: false
8 changes: 8 additions & 0 deletions R-package/src/cmake/modules/FindLibR.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,12 @@ execute_process(
set(LIBR_HOME ${LIBR_HOME} CACHE PATH "R home directory")
set(LIBR_EXECUTABLE ${LIBR_EXECUTABLE} CACHE PATH "R executable")
set(LIBR_INCLUDE_DIRS ${LIBR_INCLUDE_DIRS} CACHE PATH "R include directory")

message(STATUS "LIBR_EXECUTABLE: ${LIBR_EXECUTABLE}")
message(STATUS "LIBR_INCLUDE_DIRS: ${LIBR_INCLUDE_DIRS}")
message(STATUS "LIBR_HOME: ${LIBR_HOME}")
message(STATUS "R_ARCH: ${R_ARCH}")

set(LIBR_LIB_DIR ${LIBR_LIB_DIR} CACHE PATH "R shared libraries directory")

# look for the core R library
Expand All @@ -186,6 +192,8 @@ find_library(
HINTS "${CMAKE_CURRENT_BINARY_DIR}" "${LIBR_HOME}/lib" "${LIBR_HOME}/bin/${R_ARCH}" "${LIBR_HOME}/bin" "${LIBR_LIBRARIES}"
)

# set (LIBR_CORE_LIBRARY ${LIBR_HOME}/bin/${R_ARCH}/R.dll CACHE PATH "R core shared library")

set(LIBR_CORE_LIBRARY ${LIBR_CORE_LIBRARY} CACHE PATH "R core shared library")

if(WIN32 AND MSVC)
Expand Down

0 comments on commit 05c59f4

Please sign in to comment.