Add an 'R' Chart

.. first part just to get the configuration ready to
   build out a chart for the trend and activity view

.. src.pro and gcconfig.pri are updated to link in with
   the RInside/Rcpp package install (new dependency)

.. there is a script in util called install-packages.R
   which can be run to install the packages so long as
   R is available:

   $ R CMD BATCH util/install-packages.R
This commit is contained in:
Mark Liversedge
2016-04-08 11:45:34 +01:00
parent 25e8f30454
commit ba5b797aba
3 changed files with 53 additions and 0 deletions

View File

@@ -11,6 +11,12 @@
# Uncomment when WebKit is not available (e.g. QT >= 5.6)
#DEFINES += NOWEBKIT
# Uncomment below if you want an R chart
# You will need R installed along with the Rcpp and RInside
# packages. There is an R script in the `util' directory that
# can be run to install these packages; see it for more info.
#DEFINES += GC_WANT_R
# put output into a separate dir
# to keep main directory clear
#DESTDIR = .

View File

@@ -224,6 +224,43 @@ RESOURCES = $${PWD}/Resources/application.qrc $${PWD}/Resources/RideWindow.qrc
###====================
### OPTIONAL => Embed R
###====================
contains(DEFINES, "GC_WANT_R") {
# not platform dependant at this point, but have
# only just started developing on Linux
# see: http://dirk.eddelbuettel.com/blog/2011/03/25/#rinside_and_qt
R_HOME = $$system(R RHOME)
## include headers and libraries for R
RCPPFLAGS = $$system($$R_HOME/bin/R CMD config --cppflags)
RLDFLAGS = $$system($$R_HOME/bin/R CMD config --ldflags)
RBLAS = $$system($$R_HOME/bin/R CMD config BLAS_LIBS)
RLAPACK = $$system($$R_HOME/bin/R CMD config LAPACK_LIBS)
## if you need to set an rpath to R itself, also uncomment
#RRPATH = -Wl,-rpath,$$R_HOME/lib
## include headers and libraries for Rcpp interface classes
RCPPINCL = $$system($$R_HOME/bin/Rscript -e \'Rcpp:::CxxFlags\(\)\')
RCPPLIBS = $$system($$R_HOME/bin/Rscript -e \'Rcpp:::LdFlags\(\)\')
## for some reason when building with Qt we get this each time
## so we turn unused parameter warnings off
RCPPWARNING = -Wno-unused-parameter
## include headers and libraries for RInside embedding classes
RINSIDEINCL = $$system($$R_HOME/bin/Rscript -e \'RInside:::CxxFlags\(\)\')
RINSIDELIBS = $$system($$R_HOME/bin/Rscript -e \'RInside:::LdFlags\(\)\')
## compiler etc settings used in default make rules
QMAKE_CXXFLAGS += $$RCPPWARNING $$RCPPFLAGS $$RCPPINCL $$RINSIDEINCL
QMAKE_LFLAGS += $$RLDFLAGS $$RBLAS $$RLAPACK $$RCPPLIBS $$RINSIDELIBS
}
###====================
### OPTIONAL => KQOAUTH
###====================

10
util/install-packages.R Normal file
View File

@@ -0,0 +1,10 @@
## R script to install packages for embedded R
##
## to run this script:
## $ R CMD BATCH install-packages.R
## $ cat install-packages.Rout
##
## personal libs
dir.create(Sys.getenv("R_LIBS_USER"), showWarnings = FALSE, recursive = TRUE)
install.packages("Rcpp", Sys.getenv("R_LIBS_USER"), repos = "http://cran.case.edu" )
install.packages("RInside", Sys.getenv("R_LIBS_USER"), repos = "http://cran.case.edu" )