Attached is a patch that gets plplot building correctly with the Intel
Fortran compiler.  It still doesn't link correctly because of the
mismatch in runtime libraries.  I'm not enough of a cmake guru to track
that down.  Maybe some can read my previous message about win32
libraries and suggest a fix.

Here is my cmake configuration
C:\cygwin\opt\cmake-2.4.5-win32-x86\bin\cmake ^
  -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_BUILD_TYPE=Debug ^
  -DCMAKE_INSTALL_PREFIX=\opt\test ^
  -DCMAKE_INSTALL_LIBDIR=\opt\test\lib\i686-pc-win32-ivf ^
  -DBUILD_SHARED_LIBS=OFF -G "NMake Makefiles" ^
  -DBUILD_TEST=ON ^
  ..\plplot-cvs

Quick description of the patch.  I'm by no means a cmake guru nor do I
understand the plplot CMake configuration--this is my attempt at it.  I
do find it easier than autotools to sort out.

bindings/f77/CMakeLists.txt

If compiling on a win32 plattform, adds a define to the fortran compiler
flag that specifies the target fortran compiler.  This change should be
propagated to f95 when all the kinks are worked out.

bindings/f77/plstubs.h

Collects the win32 related stub linkage and checks the target fortran
compiler.  This change should be propagated to f95 when all the kinks
are worked out

cmake/modules/fortran.cmake

Determines which fortran compiler is being used and sets the
TARGET_FORTRAN variable.

cmake/modules/summary.cmake

Adds the display of the TARGET_FORTRAN variable to the summary

Index: bindings/f77/CMakeLists.txt
===================================================================
RCS file: /cvsroot/plplot/plplot/bindings/f77/CMakeLists.txt,v
retrieving revision 1.15
diff -u -r1.15 CMakeLists.txt
--- bindings/f77/CMakeLists.txt	7 Jan 2007 15:07:59 -0000	1.15
+++ bindings/f77/CMakeLists.txt	8 Jan 2007 16:36:06 -0000
@@ -39,6 +39,16 @@
   )
 endif(PL_DOUBLE)
 
+if(WIN32)
+  # Set the flags for the C compiler.  The C stubs need to have the
+  # correction case and convention for the Fortran compiler
+  if(TARGET_FORTRAN MATCHES "IVF")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DIVF")
+  elseif(TARGET_FORTRAN MATCHES "CVF")
+    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /DCVF")
+  endif(TARGET_FORTRAN MATCHES "IVF")
+endif(WIN32)
+
 if(F77_CMD_LINE)
   set(HAVE_F77PARSE_CL_FALSE C)
 else(F77_CMD_LINE)
Index: bindings/f77/plstubs.h
===================================================================
RCS file: /cvsroot/plplot/plplot/bindings/f77/plstubs.h,v
retrieving revision 1.42
diff -u -r1.42 plstubs.h
--- bindings/f77/plstubs.h	7 Jan 2007 21:43:02 -0000	1.42
+++ bindings/f77/plstubs.h	12 Jan 2007 06:13:04 -0000
@@ -90,14 +90,20 @@
 #endif
 #endif
 
-#ifdef MSDOS				/* MS-DOS based */
-#define STUB_LINKAGE STUB_FORTRAN
-#endif
+#ifdef WIN32                            /* Windows 32-bit */
 
-#ifdef _MSC_VER				/* MSVC/CVF based */
+#ifdef IVF                              /* Intel Visual Fortran */
+#define STUB_LINKAGE STUB_U
+#elif CVF
+#define STUB_LINKAGE STUB_U
+#elif MSDOS				/* MS-DOS based */
+#define STUB_LINKAGE STUB_FORTRAN
+#elif _MSC_VER				/* MSVC/CVF based */
 #define STUB_LINKAGE STUB_STDCALL
 #endif
 
+#endif /* ifdef WIN32 */
+
 #ifndef STUB_LINKAGE			/* The default */
 #define STUB_LINKAGE STUB_LAU
 #endif
Index: cmake/modules/fortran.cmake
===================================================================
RCS file: /cvsroot/plplot/plplot/cmake/modules/fortran.cmake,v
retrieving revision 1.9
diff -u -r1.9 fortran.cmake
--- cmake/modules/fortran.cmake	6 Nov 2006 23:28:32 -0000	1.9
+++ cmake/modules/fortran.cmake	8 Jan 2007 15:45:33 -0000
@@ -56,4 +56,18 @@
   if(ENABLE_f77)
     include(TestF77CmdLine)
   endif(ENABLE_f77)
+
+  # Determine which Fortran compiler we have.  We do not need to
+  # do this for all compilers, just the ones that have a test in
+  # bindings/f77/plstubs.h and bindings/f95/plstubs.h
+  if(CMAKE_Fortran_COMPILER MATCHES "ifort")
+    # Intel Visual Fortran
+    message(STATUS "NOTICE: " "Found Intel Visual Fortran")
+    set(TARGET_FORTRAN "IVF" CACHE STRING "Target Fortran Compiler")
+  endif(CMAKE_Fortran_COMPILER MATCHES "ifort")
+  if(CMAKE_Fortran_COMPILER MATCHES "DF")
+    # DEC Fortran aka Compaq Visual Fortran
+    message(STATUS "NOTICE: " "Found Compaq Visual Fortran")
+    set(TARGET_FORTRAN "CVF" CACHE STRING "Target Fortran Compiler")
+  endif(CMAKE_Fortran_COMPILER MATCHES "DF")
 endif(ENABLE_f77 OR ENABLE_f95)
Index: cmake/modules/summary.cmake
===================================================================
RCS file: /cvsroot/plplot/plplot/cmake/modules/summary.cmake,v
retrieving revision 1.8
diff -u -r1.8 summary.cmake
--- cmake/modules/summary.cmake	28 Dec 2006 14:36:51 -0000	1.8
+++ cmake/modules/summary.cmake	8 Jan 2007 15:42:38 -0000
@@ -75,7 +75,8 @@
 set(
 _output_results
 "${_output_results}
-CMAKE_Fortran_COMPILER CMAKE_Fortran_FLAGS:	${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_FLAGS}")
+CMAKE_Fortran_COMPILER CMAKE_Fortran_FLAGS:	${CMAKE_Fortran_COMPILER} ${CMAKE_Fortran_FLAGS}
+TARGET_FORTRAN:         ${TARGET_FORTRAN}")
 endif(ENABLE_f77 OR ENABLE_f95)
 
 set(
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to