[Rinside-commits] r230 - pkg/inst/examples/standard/cmake

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sun Jan 15 23:15:13 CET 2012


Author: edd
Date: 2012-01-15 23:15:12 +0100 (Sun, 15 Jan 2012)
New Revision: 230

Modified:
   pkg/inst/examples/standard/cmake/CMakeLists.txt
Log:
committing updated CMakeLists.txt by Peter

Modified: pkg/inst/examples/standard/cmake/CMakeLists.txt
===================================================================
--- pkg/inst/examples/standard/cmake/CMakeLists.txt	2012-01-12 04:05:24 UTC (rev 229)
+++ pkg/inst/examples/standard/cmake/CMakeLists.txt	2012-01-15 22:15:12 UTC (rev 230)
@@ -1,5 +1,6 @@
 cmake_minimum_required(VERSION 2.8.4) 
 
+set (VERBOSE 1)
 set (SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..)
 
 execute_process(COMMAND R RHOME
@@ -11,6 +12,13 @@
 
 execute_process(COMMAND R CMD config --cppflags
                 OUTPUT_VARIABLE RCPPFLAGS)
+
+if (CMAKE_HOST_WIN32)
+    if (${RCPPFLAGS} MATCHES "[-][I]([^ ;])+")
+	set (RCPPFLAGS ${CMAKE_MATCH_0})
+    endif()
+endif()
+
 string(SUBSTRING ${RCPPFLAGS} ${NUM_TRUNC_CHARS} -1 RCPPFLAGS)
 include_directories(${RCPPFLAGS})
 
@@ -36,15 +44,7 @@
 
 execute_process(COMMAND Rscript -e "Rcpp:::LdFlags()"
                 OUTPUT_VARIABLE RCPPLIBS)
-if (${RCPPLIBS} MATCHES "[-][L]([^ ;])+")
-    string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RCPPLIBS_L)
-    link_directories(${RCPPLIBS_L} )
-endif()
 
-if (${RCPPLIBS} MATCHES "[-][l][R]([^;])+")
-    string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RCPPLIBS_l)
-endif()
-
 execute_process(COMMAND Rscript -e "RInside:::CxxFlags()"
                 OUTPUT_VARIABLE RINSIDEINCL)
 string(SUBSTRING ${RINSIDEINCL} ${NUM_TRUNC_CHARS} -1 RINSIDEINCL)
@@ -52,13 +52,52 @@
 
 execute_process(COMMAND Rscript -e "RInside:::LdFlags()"
                 OUTPUT_VARIABLE RINSIDELIBS)
-if (${RINSIDELIBS} MATCHES "[-][L]([^ ;])+")
-    string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RINSIDELIBS_L)
+
+if (CMAKE_HOST_WIN32)
+    string(LENGTH "libRcpp.a" lenRcppName)
+    string(LENGTH ${RCPPLIBS} lenRcppFQName)
+	
+    math(EXPR RLibPathLen ${lenRcppFQName}-${lenRcppName}-1)
+    string(SUBSTRING ${RCPPLIBS} 0 ${RLibPathLen} RCPPLIBS_L)
+    link_directories(${RCPPLIBS_L})
+	
+    math(EXPR RLibPathLen ${RLibPathLen}+1)
+    string(SUBSTRING ${RCPPLIBS} ${RLibPathLen} -1 RCPPLIBS_l)
+	
+	#Remove the quotes
+    string(SUBSTRING ${RINSIDELIBS} 1 -1 RINSIDELIBS)
+    string(LENGTH ${RINSIDELIBS} lenRInsideFQNameLen)
+    math(EXPR lenRInsideFQNameLen ${lenRInsideFQNameLen}-1)
+    string(SUBSTRING ${RINSIDELIBS} 0 ${lenRInsideFQNameLen} RINSIDELIBS)
+
+    string(LENGTH "libRInside.a" lenRInsideName)
+    string(LENGTH ${RINSIDELIBS} lenRInsideFQName)
+
+    math(EXPR RLibPathLen ${lenRInsideFQName}-${lenRInsideName}-1)
+    string(SUBSTRING ${RINSIDELIBS} 0 ${RLibPathLen} RINSIDELIBS_L)
+
+    math(EXPR RLibPathLen ${RLibPathLen}+1)
+    string(SUBSTRING ${RINSIDELIBS} ${RLibPathLen} -1 RINSIDELIBS_l)
+
     link_directories(${RINSIDELIBS_L})
-endif()
+else()	
+    if (${RCPPLIBS} MATCHES "[-][L]([^ ;])+")
+        string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RCPPLIBS_L)
+        link_directories(${RCPPLIBS_L} )
+    endif()
 
-if (${RINSIDELIBS} MATCHES "[-][l][R]([^;])+")
-    string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RINSIDELIBS_l)
+    if (${RCPPLIBS} MATCHES "[-][l][R]([^;])+")
+        string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RCPPLIBS_l)
+    endif()
+
+    if (${RINSIDELIBS} MATCHES "[-][L]([^ ;])+")
+        string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RINSIDELIBS_L)
+        link_directories(${RINSIDELIBS_L})
+    endif()
+
+    if (${RINSIDELIBS} MATCHES "[-][l][R]([^;])+")
+        string(SUBSTRING ${CMAKE_MATCH_0} ${NUM_TRUNC_CHARS} -1 RINSIDELIBS_l)
+    endif()
 endif()
 
 execute_process(COMMAND R CMD config CXXFLAGS
@@ -82,11 +121,11 @@
 foreach (next_SOURCE ${sources})
    get_filename_component(source_name ${next_SOURCE} NAME_WE)
    add_executable( ${source_name} ${next_SOURCE} )
-
-   target_link_libraries(${source_name} ${RCPPLIBS_l})
-   target_link_libraries(${source_name} ${RINSIDELIBS_l})
+   
    target_link_libraries(${source_name} ${RLDFLAGS_l})
    target_link_libraries(${source_name} ${BLAS_LIBS})
    target_link_libraries(${source_name} ${LAPACK_LIBS})
+   target_link_libraries(${source_name} ${RINSIDELIBS_l})
+   target_link_libraries(${source_name} ${RCPPLIBS_l})
+      
 endforeach (next_SOURCE ${sources})
-



More information about the Rinside-commits mailing list