[rkward-cvs] SF.net SVN: rkward:[2500] trunk/rkward

tfry at users.sourceforge.net tfry at users.sourceforge.net
Mon May 25 20:53:23 UTC 2009


Revision: 2500
          http://rkward.svn.sourceforge.net/rkward/?rev=2500&view=rev
Author:   tfry
Date:     2009-05-25 20:53:22 +0000 (Mon, 25 May 2009)

Log Message:
-----------
Simplify FindR.cmake. This version has less unix-specifics in it (but needs testing).

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-22 11:44:56 UTC (rev 2499)
+++ trunk/rkward/ChangeLog	2009-05-25 20:53:22 UTC (rev 2500)
@@ -1,3 +1,4 @@
+- 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-22 11:44:56 UTC (rev 2499)
+++ trunk/rkward/rkward/CMakeLists.txt	2009-05-25 20:53:22 UTC (rev 2500)
@@ -26,13 +26,15 @@
 # auto-gen sources
 #QT4_AUTOMOC(${RKWard_Sources})	# not needed here, as KDE4_ADD_EXECUTABLE mocs the sources in this dir.
 
-# 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})
+# link against R
+GET_DIRECTORY_PROPERTY(R_LDFLAGS DIRECTORY rbackend DEFINITION R_LDFLAGS)
+SET_TARGET_PROPERTIES(
+	rkward.bin
+	PROPERTIES LINK_FLAGS "${R_LDFLAGS}")
 
-KDE4_ADD_EXECUTABLE(rkward.bin ${RKWard_Sources})
 # wrapper script
-GET_DIRECTORY_PROPERTY(R_HOME DIRECTORY rbackend DEFINITION R_HOME)
+GET_DIRECTORY_PROPERTY(R_EXECUTABLE DIRECTORY rbackend DEFINITION R_EXECUTABLE)
 CONFIGURE_FILE(
 	rkward.sh.template
 	${CMAKE_CURRENT_BINARY_DIR}/rkward

Modified: trunk/rkward/rkward/rbackend/CMakeLists.txt
===================================================================
--- trunk/rkward/rkward/rbackend/CMakeLists.txt	2009-05-22 11:44:56 UTC (rev 2499)
+++ trunk/rkward/rkward/rbackend/CMakeLists.txt	2009-05-25 20:53:22 UTC (rev 2500)
@@ -25,11 +25,8 @@
 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
+	PROPERTIES COMPILE_FLAGS "-fno-strict-aliasing ${R_CPPFLAGS}"
 )
\ No newline at end of file

Modified: trunk/rkward/rkward/rbackend/FindR.cmake
===================================================================
--- trunk/rkward/rkward/rbackend/FindR.cmake	2009-05-22 11:44:56 UTC (rev 2499)
+++ trunk/rkward/rkward/rbackend/FindR.cmake	2009-05-25 20:53:22 UTC (rev 2500)
@@ -12,101 +12,40 @@
 	MESSAGE(STATUS "Using R at ${R_EXECUTABLE}")
 ENDIF(R_EXECUTABLE-NOTFOUND)
 
-# find R_HOME
+# CPP flags
 
-MESSAGE(STATUS "Looking for R_HOME")
-IF(NOT R_HOME)
+MESSAGE(STATUS "Quering R for CPP flags")
+IF(NOT R_CPPFLAGS)
 	EXEC_PROGRAM(${R_EXECUTABLE}
-		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)
+		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)
 
-# find R include dir
+# LD flags
 
-MESSAGE(STATUS "Looking for R include files")
-IF(NOT R_INCLUDEDIR)
+MESSAGE(STATUS "Quering R for LD flags")
+IF(NOT R_LDFLAGS)
 	EXEC_PROGRAM(${R_EXECUTABLE}
-		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)
+		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)
 
-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")
+# TODO: perhaps we should try to compile a simple prog at this point?
 
-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")
@@ -139,8 +78,7 @@
 	"${R_LIBDIR}")
 
 IF(NOT R_LIBDIR)
-	MESSAGE(STATUS "Not reliably determined or specified. Guessing.")
-	SET(R_LIBDIR ${R_HOME}/library)
+	MESSAGE(STATUS "Not detected and not specified.")
 ENDIF(NOT R_LIBDIR)
 
 SET(R_LIBDIRS ${R_LIBDIR})

Modified: trunk/rkward/rkward/rkward.sh.template
===================================================================
--- trunk/rkward/rkward/rkward.sh.template	2009-05-22 11:44:56 UTC (rev 2499)
+++ trunk/rkward/rkward/rkward.sh.template	2009-05-25 20:53:22 UTC (rev 2500)
@@ -19,8 +19,7 @@
   fi
 fi
 
-R_HOME_DIR=@R_HOME@
-export R_binary="$R_HOME_DIR/bin/R"
+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