[rkward-cvs] SF.net SVN: rkward:[2502] trunk/rkward
tfry at users.sourceforge.net
tfry at users.sourceforge.net
Tue May 26 12:42:35 UTC 2009
Revision: 2502
http://rkward.svn.sourceforge.net/rkward/?rev=2502&view=rev
Author: tfry
Date: 2009-05-26 12:42:35 +0000 (Tue, 26 May 2009)
Log Message:
-----------
Revert most of r2500. It does not work.
See http://www.mail-archive.com/rkward-devel@lists.sourceforge.net/msg00388.html
Modified Paths:
--------------
trunk/rkward/ChangeLog
trunk/rkward/rkward/CMakeLists.txt
trunk/rkward/rkward/rbackend/CMakeLists.txt
trunk/rkward/rkward/rbackend/FindR.cmake
trunk/rkward/rkward/rkward.sh.template
Modified: trunk/rkward/ChangeLog
===================================================================
--- trunk/rkward/ChangeLog 2009-05-26 11:54:31 UTC (rev 2501)
+++ trunk/rkward/ChangeLog 2009-05-26 12:42:35 UTC (rev 2502)
@@ -1,4 +1,3 @@
-- Internal: Simplify FindR.cmake. TODO: libRblas.so / libRlapack.so
- Add basic check for a correct installation of the RKWard resource files
- Remove "What to expect" dialog at startup
- Make keyboard shorcuts configurable
Modified: trunk/rkward/rkward/CMakeLists.txt
===================================================================
--- trunk/rkward/rkward/CMakeLists.txt 2009-05-26 11:54:31 UTC (rev 2501)
+++ trunk/rkward/rkward/CMakeLists.txt 2009-05-26 12:42:35 UTC (rev 2502)
@@ -26,13 +26,11 @@
# auto-gen sources
#QT4_AUTOMOC(${RKWard_Sources}) # not needed here, as KDE4_ADD_EXECUTABLE mocs the sources in this dir.
-KDE4_ADD_EXECUTABLE(rkward.bin ${RKWard_Sources})
-# link against R
-GET_DIRECTORY_PROPERTY(R_LDFLAGS DIRECTORY rbackend DEFINITION R_LDFLAGS)
-SET_TARGET_PROPERTIES(
- rkward.bin
- PROPERTIES LINK_FLAGS "${R_LDFLAGS}")
+# somehow the needed libdirs for R do not get passed down automatically
+GET_DIRECTORY_PROPERTY(R_SHAREDLIBDIR DIRECTORY rbackend LINK_DIRECTORIES)
+LINK_DIRECTORIES(${R_SHAREDLIBDIR})
+KDE4_ADD_EXECUTABLE(rkward.bin ${RKWard_Sources})
# wrapper script
GET_DIRECTORY_PROPERTY(R_EXECUTABLE DIRECTORY rbackend DEFINITION R_EXECUTABLE)
CONFIGURE_FILE(
Modified: trunk/rkward/rkward/rbackend/CMakeLists.txt
===================================================================
--- trunk/rkward/rkward/rbackend/CMakeLists.txt 2009-05-26 11:54:31 UTC (rev 2501)
+++ trunk/rkward/rkward/rbackend/CMakeLists.txt 2009-05-26 12:42:35 UTC (rev 2502)
@@ -25,8 +25,11 @@
QT4_AUTOMOC(${rbackend_STAT_SRCS})
ADD_LIBRARY(rbackend STATIC ${rbackend_STAT_SRCS})
+TARGET_LINK_LIBRARIES(rbackend ${R_USED_LIBS})
+LINK_DIRECTORIES(${R_SHAREDLIBDIR})
+INCLUDE_DIRECTORIES(${R_INCLUDEDIR})
SET_SOURCE_FILES_PROPERTIES(
rembedinternal.cpp
- PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing ${R_CPPFLAGS}"
+ PROPERTIES COMPILE_FLAGS -fno-strict-aliasing
)
\ No newline at end of file
Modified: trunk/rkward/rkward/rbackend/FindR.cmake
===================================================================
--- trunk/rkward/rkward/rbackend/FindR.cmake 2009-05-26 11:54:31 UTC (rev 2501)
+++ trunk/rkward/rkward/rbackend/FindR.cmake 2009-05-26 12:42:35 UTC (rev 2502)
@@ -12,40 +12,101 @@
MESSAGE(STATUS "Using R at ${R_EXECUTABLE}")
ENDIF(R_EXECUTABLE-NOTFOUND)
-# CPP flags
+# find R_HOME
-MESSAGE(STATUS "Quering R for CPP flags")
-IF(NOT R_CPPFLAGS)
+MESSAGE(STATUS "Looking for R_HOME")
+IF(NOT R_HOME)
EXEC_PROGRAM(${R_EXECUTABLE}
- ARGS CMD config --cppflags
- OUTPUT_VARIABLE R_CPPFLAGS)
-ELSE(NOT R_CPPFLAGS)
- MESSAGE(STATUS "Overridded by user")
-ENDIF(NOT R_CPPFLAGS)
-IF(NOT R_CPPFLAGS)
- MESSAGE(STATUS "CPP flags are empty. This looks suspicious, but we'll proceed...")
-ELSE(NOT R_CPPFLAGS)
- MESSAGE(STATUS "CPP flags are '${R_CPPFLAGS}'")
-ENDIF(NOT R_CPPFLAGS)
+ ARGS CMD sh -c 'echo $R_HOME'
+ OUTPUT_VARIABLE R_HOME)
+ELSE(NOT R_HOME)
+ MESSAGE(STATUS "Specified by user")
+ENDIF(NOT R_HOME)
+IF(NOT R_HOME)
+ MESSAGE(FATAL_ERROR "Could NOT determine R_HOME (probably you misspecified the location of R)")
+ELSE(NOT R_HOME)
+ MESSAGE(STATUS "R_HOME is ${R_HOME}")
+ENDIF(NOT R_HOME)
-# LD flags
+# find R include dir
-MESSAGE(STATUS "Quering R for LD flags")
-IF(NOT R_LDFLAGS)
+MESSAGE(STATUS "Looking for R include files")
+IF(NOT R_INCLUDEDIR)
EXEC_PROGRAM(${R_EXECUTABLE}
- ARGS CMD config --ldflags
- OUTPUT_VARIABLE R_LDFLAGS)
-ELSE(NOT R_LDFLAGS)
- MESSAGE(STATUS "Overridded by user")
-ENDIF(NOT R_LDFLAGS)
-IF(NOT R_LDFLAGS)
- MESSAGE(STATUS "LD flags are empty. This looks suspicious, but we'll proceed...")
-ELSE(NOT R_LDFLAGS)
- MESSAGE(STATUS "LD flags are '${R_LDFLAGS}'")
-ENDIF(NOT R_LDFLAGS)
+ ARGS CMD sh -c 'echo $R_INCLUDE_DIR'
+ OUTPUT_VARIABLE R_INCLUDEDIR)
+ELSE(NOT R_INCLUDEDIR)
+ MESSAGE(STATUS "Location specified by user")
+ENDIF(NOT R_INCLUDEDIR)
-# TODO: perhaps we should try to compile a simple prog at this point?
+IF(NOT R_INCLUDEDIR)
+ SET(R_INCLUDEDIR ${R_HOME}/include)
+ MESSAGE(STATUS "Not findable via R. Guessing")
+ENDIF(NOT R_INCLUDEDIR)
+MESSAGE(STATUS "Include files should be at ${R_INCLUDEDIR}. Checking for R.h")
+FIND_FILE(R_H
+ R.h
+ PATHS ${R_INCLUDEDIR}
+ NO_DEFAULT_PATH)
+IF(NOT R_H)
+ MESSAGE(FATAL_ERROR "Not found")
+ELSE(NOT R_H)
+ MESSAGE(STATUS "Found at ${R_H}")
+ GET_FILENAME_COMPONENT(R_INCLUDEDIR ${R_H}
+ PATH)
+ENDIF(NOT R_H)
+
+# check for existence of libR.so
+
+MESSAGE(STATUS "Checking for existence of libR.so")
+FIND_FILE(LIBR_SO
+ libR.so
+ PATHS ${R_HOME}/lib ${R_SHAREDLIBDIR}
+ NO_DEFAULT_PATH)
+IF(NOT LIBR_SO)
+ MESSAGE(FATAL_ERROR "Not found. Make sure the location of R was detected correctly, above, and R was compiled with the --enable-shlib option")
+ELSE(NOT LIBR_SO)
+ MESSAGE(STATUS "Exists at ${LIBR_SO}")
+ GET_FILENAME_COMPONENT(R_SHAREDLIBDIR ${LIBR_SO}
+ PATH)
+ SET(R_USED_LIBS R)
+ENDIF(NOT LIBR_SO)
+
+# for at least some versions of R, we seem to have to link against -lRlapack. Else loading some
+# R packages will fail due to unresolved symbols. However, we can't do this unconditionally,
+# as this is not available in some configurations of R
+
+MESSAGE(STATUS "Checking whether we should link against libRlapack.so")
+FIND_FILE(LIBR_LAPACK
+ libRlapack.so
+ PATHS ${R_SHAREDLIBDIR}
+ NO_DEFAULT_PATH)
+IF(NOT LIBR_LAPACK)
+ MESSAGE(STATUS "No, ${R_SHAREDLIBDIR}/libRlapack.so does not exist")
+ELSE(NOT LIBR_LAPACK)
+ MESSAGE(STATUS "Yes, ${LIBR_LAPACK} exists")
+ SET(R_USED_LIBS ${R_USED_LIBS} Rlapack gfortran)
+ENDIF(NOT LIBR_LAPACK)
+
+# for at least some versions of R, we seem to have to link against -lRblas. Else loading some
+# R packages will fail due to unresolved symbols. However, we can't do this unconditionally,
+# as this is not available in some configurations of R
+
+MESSAGE(STATUS "Checking whether we should link against libRblas.so")
+FIND_FILE(LIBR_BLAS
+ libRblas.so
+ PATHS ${R_SHAREDLIBDIR}
+ NO_DEFAULT_PATH)
+IF(NOT LIBR_BLAS)
+ MESSAGE(STATUS "No, ${R_SHAREDLIBDIR}/libRblas.so does not exist")
+ELSE(NOT LIBR_BLAS)
+ MESSAGE(STATUS "Yes, ${LIBR_BLAS} exists")
+ SET(R_USED_LIBS ${R_USED_LIBS} Rblas)
+ENDIF(NOT LIBR_BLAS)
+
+
+
# find R package library location
MESSAGE(STATUS "Checking for R package library location to use")
@@ -78,7 +139,8 @@
"${R_LIBDIR}")
IF(NOT R_LIBDIR)
- MESSAGE(STATUS "Not detected and not specified.")
+ MESSAGE(STATUS "Not reliably determined or specified. Guessing.")
+ SET(R_LIBDIR ${R_HOME}/library)
ENDIF(NOT R_LIBDIR)
SET(R_LIBDIRS ${R_LIBDIR})
Modified: trunk/rkward/rkward/rkward.sh.template
===================================================================
--- trunk/rkward/rkward/rkward.sh.template 2009-05-26 11:54:31 UTC (rev 2501)
+++ trunk/rkward/rkward/rkward.sh.template 2009-05-26 12:42:35 UTC (rev 2502)
@@ -19,7 +19,7 @@
fi
fi
-export R_binary=@R_EXECUTABLE@
+export R_binary="@R_EXECUTABLE@"
## Location of R may have moved, so check
if test -x "${R_binary}"; then
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the rkward-tracker
mailing list