Skip to content

Commit

Permalink
Add basic appveyor testing
Browse files Browse the repository at this point in the history
  • Loading branch information
SylvainCorlay committed Jul 5, 2017
1 parent a967430 commit 37b776b
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 19 deletions.
31 changes: 31 additions & 0 deletions .appveyor.yml
@@ -0,0 +1,31 @@
build: false

os: Visual Studio 2015

platform:
- x64
- x86

environment:
matrix:
- MINICONDA: C:\xtensor-conda

init:
- "ECHO %MINICONDA%"
- C:\"Program Files (x86)"\"Microsoft Visual Studio 14.0"\VC\vcvarsall.bat %PLATFORM%
- ps: if($env:Platform -eq "x64"){Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86_64.exe' C:\Miniconda.exe; echo "Done"}
- ps: if($env:Platform -eq "x86"){Start-FileDownload 'http://repo.continuum.io/miniconda/Miniconda3-latest-Windows-x86.exe' C:\Miniconda.exe; echo "Done"}
- cmd: C:\Miniconda.exe /S /D=C:\xtensor-conda
- "set PATH=%MINICONDA%;%MINICONDA%\\Scripts;%MINICONDA%\\Library\\bin;%PATH%"

install:
- conda config --set always_yes yes --set changeps1 no
- conda update -q conda
- conda install gtest cmake -c conda-forge
# Testing
- conda install r r-rcpp r-base -c r
- conda install xtensor==0.10.5 -c conda-forge
- R -e "install.packages('RInside', repos='http://cran.us.r-project.org')"
- mkdir build
- cd build
- cmake -G "NMake Makefiles" -DCMAKE_PREFIX_PATH=-DCMAKE_PREFIX_PATH=C:\mingw64 -D CMAKE_INSTALL_PREFIX=%MINICONDA%\\Library -D BUILD_TESTS=ON ..
7 changes: 6 additions & 1 deletion .travis.yml
Expand Up @@ -33,6 +33,7 @@ matrix:
- llvm-toolchain-precise-3.6
packages:
- clang-3.6
compiler: clang
env: COMPILER=clang CLANG=3.6
- os: linux
addons:
Expand All @@ -42,6 +43,7 @@ matrix:
- llvm-toolchain-precise-3.7
packages:
- clang-3.7
compiler: clang
env: COMPILER=clang CLANG=3.7
- os: linux
addons:
Expand All @@ -51,10 +53,13 @@ matrix:
- llvm-toolchain-precise-3.8
packages:
- clang-3.8
compiler: clang
env: COMPILER=clang CLANG=3.8
- os: osx
osx_image: xcode8
compiler: clang
allow_failures:
- compiler: clang
env:
global:
- MINCONDA_VERSION="latest"
Expand Down Expand Up @@ -94,7 +99,7 @@ install:
- conda install gtest cmake
# Testing
- conda install r r-rcpp r-base -c r
- conda install xtensor==0.10.4 -c conda-forge
- conda install xtensor==0.10.5 -c conda-forge
- R -e "install.packages('RInside', repos='http://cran.us.r-project.org')"
- mkdir build
- cd build
Expand Down
24 changes: 11 additions & 13 deletions CMakeLists.txt
Expand Up @@ -47,45 +47,43 @@ if(DOWNLOAD_GTEST OR GTEST_SRC_DIR)
endif()

if(BUILD_TESTS)
include_directories(${XTENSOR_R_INCLUDE_DIR})
find_package(R REQUIRED)
find_package(xtensor REQUIRED)
include_directories(${xtensor_INCLUDE_DIRS})
include_directories(${XTENSOR_R_INCLUDE_DIR})

# Locate Rcpp by invoking R
execute_process(
COMMAND "R" "-q -e find.package('Rcpp')"
COMMAND ${R_COMMAND} -q -e "find.package('Rcpp')"
OUTPUT_VARIABLE RCPP_FIND_RESULT_STRING
RESULT_VARIABLE RCPP_FIND_RESULT)

string(REGEX MATCH "\".+\"" RCPP_LOCATION_LINE ${RCPP_FIND_RESULT_STRING})
string(REGEX REPLACE "\"" "" RCPP_LOCATION_LINE ${RCPP_LOCATION_LINE})

string(CONCAT Rcpp_INCLUDE_DIRS ${RCPP_LOCATION_LINE} "/include/")
message("RCpp Include Directory: " ${Rcpp_INCLUDE_DIRS})

include_directories(${Rcpp_INCLUDE_DIRS})

# Locate RInside by invoking R
execute_process(
COMMAND "R" "-q -e find.package('RInside')"
COMMAND ${R_COMMAND} -q -e "find.package('RInside')"
OUTPUT_VARIABLE RINSIDE_FIND_RESULT_STRING
RESULT_VARIABLE RINSIDE_FIND_RESULT)

string(REGEX MATCH "\".+\"" RINSIDE_LOCATION_LINE ${RINSIDE_FIND_RESULT_STRING})
string(REGEX REPLACE "\"" "" RINSIDE_LOCATION_LINE ${RINSIDE_LOCATION_LINE})

string(CONCAT RInside_INCLUDE_DIRS ${RINSIDE_LOCATION_LINE} "/include/")
message("RInside Include Directory: " ${RInside_INCLUDE_DIRS})

set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} ".dll")
find_library(RINSIDE_LIBRARIES
NAMES RInside
HINTS ${RINSIDE_LOCATION_LINE}/lib/
HINTS ${RINSIDE_LOCATION_LINE}/lib ${RINSIDE_LOCATION_LINE}/libs/${R_LIB_ARCH}
)

set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
include_directories(${RInside_INCLUDE_DIRS})

find_package(R REQUIRED)

# Include the tests
add_subdirectory(test)
# add_subdirectory(benchmark)
endif()

# Installation
Expand Down
4 changes: 4 additions & 0 deletions README.md
@@ -1,5 +1,9 @@
# ![xtensor-r](http://quantstack.net/assets/images/xtensor-r.svg)

[![Travis](https://travis-ci.org/QuantStack/xtensor-r.svg?branch=master)](https://travis-ci.org/QuantStack/xtensor-r)
[![Appveyor](https://ci.appveyor.com/api/projects/status/5pe90pdw4wddaxx7?svg=true)](https://ci.appveyor.com/project/QuantStack/xtensor-r)
[![Join the Gitter Chat](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/QuantStack/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)

**THIS IS A SUPER EARLY PREVIEW OF THE R BINDINGS, PLEASE DON'T USE IT JUST YET**

R bindings for the [xtensor](https://github.com/QuantStack/xtensor) C++ multi-dimensional array library.
Expand Down
27 changes: 22 additions & 5 deletions cmake/FindR.cmake
Expand Up @@ -2,6 +2,9 @@
#
# - This module locates an installed R distribution.
#
# Input:
# R_LIB_ARCH - For windows (i386 or x64)
#
# Defines the following:
# R_COMMAND - Path to R command
# R_HOME - Path to 'R home', as reported by R
Expand All @@ -24,12 +27,24 @@
# 3. Within external system libraries
#

if(NOT R_LIB_ARCH)
if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8")
set(R_LIB_ARCH x64)
else()
set(R_LIB_ARCH i386)
endif()
endif()

set(TEMP_CMAKE_FIND_APPBUNDLE ${CMAKE_FIND_APPBUNDLE})
set(CMAKE_FIND_APPBUNDLE "NEVER")
find_program(R_COMMAND R DOC "R executable.")
set(CMAKE_FIND_APPBUNDLE ${TEMP_CMAKE_FIND_APPBUNDLE})

if(R_COMMAND)
# temporarily append ".dll" to the cmake find_library suffixes
set(OLD_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES} ".dll")

execute_process(WORKING_DIRECTORY .
COMMAND ${R_COMMAND} RHOME
OUTPUT_VARIABLE R_ROOT_DIR
Expand All @@ -46,26 +61,28 @@ if(R_COMMAND)
set(R_HOME ${R_ROOT_DIR} CACHE PATH "R home directory obtained from R RHOME")

find_path(R_INCLUDE_DIR R.h
HINTS ${R_ROOT_DIR}
HINTS ${R_ROOT_DIR} ${R_ROOT_DIR}/bin/${R_LIB_ARCH}
PATHS /usr/local/lib /usr/local/lib64 /usr/share
PATH_SUFFIXES include R/include
DOC "Path to file R.h")

find_library(R_LIBRARY_BASE R
HINTS ${R_ROOT_DIR}/lib
HINTS ${R_ROOT_DIR}/lib ${R_ROOT_DIR}/bin/${R_LIB_ARCH}
DOC "R library (example libR.a, libR.dylib, etc.).")

find_library(R_LIBRARY_BLAS NAMES Rblas blas
HINTS ${R_ROOT_DIR}/lib
HINTS ${R_ROOT_DIR}/lib ${R_ROOT_DIR}/bin/${R_LIB_ARCH}
DOC "Rblas library (example libRblas.a, libRblas.dylib, etc.).")

find_library(R_LIBRARY_LAPACK NAMES Rlapack lapack
HINTS ${R_ROOT_DIR}/lib
HINTS ${R_ROOT_DIR}/lib ${R_ROOT_DIR}/bin/${R_LIB_ARCH}
DOC "Rlapack library (example libRlapack.a, libRlapack.dylib, etc.).")

find_library(R_LIBRARY_READLINE readline
DOC "(Optional) system readline library. Only required if the R libraries were built with readline support.")

# reset cmake find_library to initial value
set(CMAKE_FIND_LIBRARY_SUFFIXES ${OLD_SUFFIXES})
else()
message(SEND_ERROR "FindR.cmake requires the following variables to be set: R_COMMAND")
endif()
Expand All @@ -74,4 +91,4 @@ endif()
set(R_LIBRARIES ${R_LIBRARY_BASE} ${R_LIBRARY_BLAS} ${R_LIBRARY_LAPACK} ${R_LIBRARY_BASE})
if(R_LIBRARY_READLINE)
set(R_LIBRARIES ${R_LIBRARIES} ${R_LIBRARY_READLINE})
endif()
endif()

0 comments on commit 37b776b

Please sign in to comment.