Changeset: e12a2261f3c7 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=e12a2261f3c7
Modified Files:
        CMakeLists.txt
        cmake/FindCfitsio.cmake
        sql/backends/monet5/vaults/fits/fits.c
Branch: cmake-fun
Log Message:

Compiling R integration on Windows, plus check fitsio.h file correctly.


diffs (98 lines):

diff --git a/CMakeLists.txt b/CMakeLists.txt
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1282,32 +1282,45 @@ if(NOT VALGRIND_FOUND)
        set(VALGRIND_LIBRARIES "")
 endif()
 
-set(R_HOME "")
+set(R_HOME "") # No R_HOME on Windows
 set(R_INCLUDE_DIR "")
 set(R_LIBRARIES "")
 set(ENABLE_RINTEGRATION "AUTO" CACHE STRING "Enable support for R integration 
into MonetDB (default=AUTO)") # Check with HAVE_LIBR
 if(NOT ${ENABLE_RINTEGRATION} STREQUAL "NO")
-       if(${ENABLE_RINTEGRATION} MATCHES "^YES|AUTO$")
-               set(R_INTERPRETER "R")
+       message(STATUS "Checking for R interpreter instalation")
+       if(WIN32)
+               find_path(R_INCLUDE R.h)
+               find_library(R_LIBRARY R)
+               if(R_INCLUDE AND R_LIBRARY)
+                       set(R_INCLUDE_DIR "${R_INCLUDE}")
+                       set(R_LIBRARIES "${R_LIBRARY}")
+                       set(HAVE_LIBR ON)
+               elseif(${ENABLE_RINTEGRATION} STREQUAL "YES")
+                       message(FATAL_ERROR "R.h and R.lib required for R 
integration support")
+               else()
+                       message(STATUS "R.h and R.lib required for R 
integration support")
+               endif()
        else()
-               set(R_INTERPRETER "${ENABLE_RINTEGRATION}")
-       endif()
-
-       message(STATUS "Checking major version of R interpreter")
-       exec_program("${R_INTERPRETER}" ARGS "RHOME" OUTPUT_VARIABLE 
R_HOME_OUTPUT RETURN_VALUE R_HOME_RC)
-       exec_program("${R_INTERPRETER}" ARGS "CMD config --cppflags" 
OUTPUT_VARIABLE R_CPP_OUTPUT RETURN_VALUE R_CPP_RC)
-       exec_program("${R_INTERPRETER}" ARGS "CMD config --ldflags" 
OUTPUT_VARIABLE R_LD_OUTPUT RETURN_VALUE R_LD_RC)
-       if(R_HOME_RC EQUAL 0 AND R_CPP_RC EQUAL 0 AND R_LD_RC EQUAL 0)
-               MT_clibsToCmake(${R_CPP_OUTPUT} R_INCLUDE_DIR)
-               string(REPLACE "-fopenmp" "" R_LD_OUTPUT ${R_LD_OUTPUT}) # We 
don't want to link to OpenMP
-               string(REPLACE "-fopenmp=libgomp" "" R_LD_OUTPUT ${R_LD_OUTPUT})
-               set(R_LIBRARIES "${R_LD_OUTPUT}")
-               set(HAVE_LIBR ON)
-               set(RHOME ${R_HOME_OUTPUT})
-       elseif(${ENABLE_RINTEGRATION} STREQUAL "YES")
-               message(FATAL_ERROR "R executable required for R integration 
support")
-       else()
-               message(STATUS "R executable not found")
+               if(${ENABLE_RINTEGRATION} MATCHES "^YES|AUTO$")
+                       set(R_INTERPRETER "R")
+               else()
+                       set(R_INTERPRETER "${ENABLE_RINTEGRATION}")
+               endif()
+               exec_program("${R_INTERPRETER}" ARGS "RHOME" OUTPUT_VARIABLE 
R_HOME_OUTPUT RETURN_VALUE R_HOME_RC)
+               exec_program("${R_INTERPRETER}" ARGS "CMD config --cppflags" 
OUTPUT_VARIABLE R_CPP_OUTPUT RETURN_VALUE R_CPP_RC)
+               exec_program("${R_INTERPRETER}" ARGS "CMD config --ldflags" 
OUTPUT_VARIABLE R_LD_OUTPUT RETURN_VALUE R_LD_RC)
+               if(R_HOME_RC EQUAL 0 AND R_CPP_RC EQUAL 0 AND R_LD_RC EQUAL 0)
+                       MT_clibsToCmake(${R_CPP_OUTPUT} R_INCLUDE_DIR)
+                       string(REPLACE "-fopenmp" "" R_LD_OUTPUT 
${R_LD_OUTPUT}) # We don't want to link to OpenMP
+                       string(REPLACE "-fopenmp=libgomp" "" R_LD_OUTPUT 
${R_LD_OUTPUT})
+                       set(R_LIBRARIES "${R_LD_OUTPUT}")
+                       set(HAVE_LIBR ON)
+                       set(RHOME ${R_HOME_OUTPUT})
+               elseif(${ENABLE_RINTEGRATION} STREQUAL "YES")
+                       message(FATAL_ERROR "R executable required for R 
integration support")
+               else()
+                       message(STATUS "R executable not found")
+               endif()
        endif()
 endif()
 
diff --git a/cmake/FindCfitsio.cmake b/cmake/FindCfitsio.cmake
--- a/cmake/FindCfitsio.cmake
+++ b/cmake/FindCfitsio.cmake
@@ -6,7 +6,7 @@
 # CFITSIO_FOUND        - True if cfitsio found.
 
 # Look for the header file.
-find_path(CFITSIO_INCLUDE_DIR NAMES fitsio.h)
+find_path(CFITSIO_INCLUDE_DIR NAMES cfitsio/fitsio.h)
 
 # Look for the library.
 find_library(CFITSIO_LIBRARIES NAMES cfitsio)
diff --git a/sql/backends/monet5/vaults/fits/fits.c 
b/sql/backends/monet5/vaults/fits/fits.c
--- a/sql/backends/monet5/vaults/fits/fits.c
+++ b/sql/backends/monet5/vaults/fits/fits.c
@@ -17,9 +17,9 @@
 
 /* clash with GDK? */
 #undef ttype
-#include <fitsio.h>
-#include <fitsio2.h>
-#include <longnam.h>
+#include <cfitsio/fitsio.h>
+#include <cfitsio/fitsio2.h>
+#include <cfitsio/longnam.h>
 
 #include "fits.h"
 #include "mutils.h"
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to