]> SALOME platform Git repositories - modules/kernel.git/commitdiff
Salome HOME
CCAR:synchronize with V5_1_main head
authorcaremoli <caremoli>
Fri, 18 Jun 2010 07:05:19 +0000 (07:05 +0000)
committercaremoli <caremoli>
Fri, 18 Jun 2010 07:05:19 +0000 (07:05 +0000)
salome_adm/cmake_files/FindPLATFORM.cmake
salome_adm/cmake_files/am2cmake.py
salome_adm/unix/config_files/Makefile.am
salome_adm/unix/config_files/check_vtk.m4 [new file with mode: 0644]

index 01f1e1512618a7af4019eb07155f99a11f74ada6..f467aae1a3477ea126a63e2260bf04af666af4a4 100644 (file)
@@ -69,7 +69,7 @@ ELSE(WINDOWS)
   SET(PLATFORM_LIBADD ${PLATFORM_LIBADD} -ldl)
 ENDIF(WINDOWS)
 
-SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=4 -DSIZEOF_INT=4)
+SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DSIZEOF_FORTRAN_INTEGER=4 -DSIZEOF_LONG=${CMAKE_SIZEOF_VOID_P} -DSIZEOF_INT=4)
 
 #  SET(PLATFORM_CPPFLAGS)
 #  #  #  SET(PLATFORM_CPPFLAGS ${PLATFORM_CPPFLAGS} -DWNT -D_CRT_SECURE_NO_WARNINGS)
index 8e0774b1542b157557921752a3344e37889acdd3..8dafe3ee71e610b4ba2091da662805ac77d0a27b 100644 (file)
@@ -1386,6 +1386,13 @@ class CMakeFile(object):
         SET(var ${var} ${AM_CPPFLAGS})
         SET(var ${var} ${AM_CXXFLAGS})
         ''')
+        # --
+        newlines.append(r'''
+        IF(type STREQUAL STATIC)
+        SET(var ${var} -fPIC)
+        ENDIF(type STREQUAL STATIC)
+        ''')
+        # --
         if self.module == "yacs":
             newlines.append(r'''
             SET(var ${var} -DYACS_PTHREAD)
@@ -1493,9 +1500,15 @@ class CMakeFile(object):
         STRING(REPLACE ".f" ".c" src ${src})
         SET(src ${CMAKE_CURRENT_BINARY_DIR}/${src})
         SET(output ${src})
+        SET(cmd f2c)
+        IF(NOT WINDOWS)
+        IF(CMAKE_SIZEOF_VOID_P STREQUAL 8)
+        SET(cmd valgrind f2c)  # f2c seems to be buggy on 64 bits ... but with valgrind, it works :)
+        ENDIF()
+        ENDIF(NOT WINDOWS)
         ADD_CUSTOM_COMMAND(
         OUTPUT ${output}
-        COMMAND f2c ${input}
+        COMMAND ${cmd} ${input}
         MAIN_DEPENDENCY ${input}
         )
         ELSE(src STREQUAL trte.f)
index 9583f274bd3336a9fc85d644e382172480267e2a..6cffbfca482dbe5c1eaff90cb73283ed131a82e4 100644 (file)
@@ -72,6 +72,7 @@ check_mpich.m4 \
 check_omniorb.m4 \
 check_sockets.m4 \
 check_swig.m4 \
+check_vtk.m4 \
 check_withihm.m4 \
 enable_pthreads.m4 \
 production.m4 \
diff --git a/salome_adm/unix/config_files/check_vtk.m4 b/salome_adm/unix/config_files/check_vtk.m4
new file mode 100644 (file)
index 0000000..219e549
--- /dev/null
@@ -0,0 +1,236 @@
+dnl  Copyright (C) 2007-2010  CEA/DEN, EDF R&D, OPEN CASCADE
+dnl
+dnl  Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
+dnl  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
+dnl
+dnl  This library is free software; you can redistribute it and/or
+dnl  modify it under the terms of the GNU Lesser General Public
+dnl  License as published by the Free Software Foundation; either
+dnl  version 2.1 of the License.
+dnl
+dnl  This library is distributed in the hope that it will be useful,
+dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
+dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+dnl  Lesser General Public License for more details.
+dnl
+dnl  You should have received a copy of the GNU Lesser General Public
+dnl  License along with this library; if not, write to the Free Software
+dnl  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
+dnl
+dnl  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
+dnl
+
+dnl  OPTIONS_VTK
+dnl  ------------------------------------------------------------------------
+dnl  Adds the --with-vtk=path and --with-vtk-version configure options
+dnl
+AC_DEFUN([OPTIONS_VTK], [
+  AC_ARG_WITH([vtk],
+              [AC_HELP_STRING([--with-vtk], [The prefix where VTK is installed (default "" means taking from environment variable)])],
+              [with_vtk=$withval], [with_vtk=""])
+
+  AC_ARG_WITH([vtk-version],
+              [AC_HELP_STRING([--with-vtk-version], [VTK include directory name is vtk-suffix, e.g. vtk-5.0/. What is the suffix? (Default "yes" means taking from environment variable)])],
+              [vtk_suffix=$withval], [vtk_suffix="yes"])
+
+  AC_ARG_WITH([paraview],
+              [AC_HELP_STRING([--with-paraview], [ParaView from the specified location is used instead of VTK (default "" means ParaView should not be used)])])
+])
+
+dnl
+dnl  CHECK_VTK
+dnl  ------------------------------------------------------------------------
+dnl
+AC_DEFUN([CHECK_VTK], [
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_PROG_CXX])dnl
+AC_REQUIRE([AC_PROG_CPP])dnl
+AC_REQUIRE([AC_PROG_CXXCPP])dnl
+AC_REQUIRE([AC_LINKER_OPTIONS])dnl
+
+AC_REQUIRE([OPTIONS_VTK])dnl
+
+AC_CHECKING(for VTK)
+
+AC_LANG_SAVE
+AC_LANG_CPLUSPLUS
+
+AC_SUBST(VTK_INCLUDES)
+AC_SUBST(VTK_LIBS)
+AC_SUBST(VTKPY_MODULES)
+
+VTK_INCLUDES=""
+VTK_LIBS=""
+VTKPY_MODULES=""
+
+vtk_ok=no
+
+if test "x$OpenGL_ok" != "xyes" ; then
+   AC_MSG_WARN(VTK needs OpenGL correct configuration, check configure output)
+fi
+
+AC_PATH_X
+if test "x$x_libraries" != "x"
+then
+   LXLIB="-L$x_libraries"
+else
+   LXLIB=""
+fi
+
+if test "x$x_libraries" = "x/usr/lib"
+then
+   LXLIB=""
+fi
+
+if test "x$x_libraries" = "x/usr/lib${LIB_LOCATION_SUFFIX}"
+then
+   LXLIB=""
+fi
+
+LOCAL_INCLUDES="$OGL_INCLUDES"
+LOCAL_LIBS="-lvtkCommon -lvtkGraphics -lvtkImaging -lvtkFiltering -lvtkIO -lvtkRendering -lvtkHybrid -lvtkParallel -lvtkWidgets $LXLIB -lX11 -lXt"
+TRY_LINK_LIBS="-lvtkCommon $LXLIB -lX11 -lXt"
+
+dnl VTK version suffix
+if test -z $vtk_suffix ; then
+  vtk_suffix="yes"
+fi
+if test "x$vtk_suffix" == "xno" ; then
+  dnl in case user wrote --with-vtk-version=no, use empty suffix
+  vtk_suffix=""
+fi
+if test "x$vtk_suffix" != "xyes" ; then
+  VTKSUFFIX="$vtk_suffix"
+else
+  dnl in case user wrote --with-vtk-version=yes, get the suffix from env
+  if test -z $VTKSUFFIX ; then
+    VTKSUFFIX="-5.0"
+  fi
+fi
+
+dnl VTK install dir
+if test -z $with_vtk ; then
+  with_vtk=""
+fi
+if test "x$with_vtk" = "xyes" ; then
+  dnl in case user wrote --with-vtk=yes
+  with_vtk=""
+fi
+if test "x$with_vtk" = "xno" ; then
+  dnl in case user wrote --with-vtk=no
+  with_vtk=""
+  AC_MSG_WARN(Value "no", specified for option --with-vtk, is not supported)
+fi
+
+if test "x$with_vtk" != "x" ; then
+  VTKHOME="$with_vtk"
+else
+  if test -z $VTKHOME ; then
+    AC_MSG_WARN(undefined VTKHOME variable which specify where vtk was compiled)
+    for d in /usr/local /usr ; do
+      if test -f ${d}/include/vtk${VTKSUFFIX}/vtkPlane.h ; then
+        AC_MSG_RESULT(trying ${d})
+        VTKHOME="${d}"
+        break
+      fi
+      if test -f ${d}/include/vtk-5.0/vtkPlane.h ; then
+        AC_MSG_RESULT(trying ${d})
+        VTKHOME="${d}"
+        VTKSUFFIX="-5.0"
+        break
+      fi
+      if test -f ${d}/include/vtk-5.2/vtkPlane.h ; then
+        AC_MSG_RESULT(trying ${d})
+        VTKHOME="${d}"
+        VTKSUFFIX="-5.2"
+        break
+      fi
+      if test -f ${d}/include/vtk/vtkPlane.h ; then
+        AC_MSG_RESULT(trying ${d})
+        VTKHOME="${d}"
+        VTKSUFFIX=""
+        break
+      fi
+    done
+  fi
+fi
+
+# Using regular VTK installation
+if test "x$with_paraview" = "x" ; then
+  LOCAL_INCLUDES="-I$VTKHOME/include/vtk${VTKSUFFIX} $LOCAL_INCLUDES"
+  LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $LOCAL_LIBS"
+  TRY_LINK_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} -L$VTKHOME/lib${LIB_LOCATION_SUFFIX}/vtk${VTKSUFFIX} $TRY_LINK_LIBS"
+  if test "x$VTKHOME" != "x/usr" ; then
+    LOCAL_LIBS="-L$VTKHOME/lib${LIB_LOCATION_SUFFIX} $LOCAL_LIBS"
+  fi
+else
+# VTK from ParaView overrides other VTK versions
+  if test "${with_paraview}" = "yes" ; then
+    if test -z $PVHOME ; then
+      PVHOME="/usr"
+    fi
+  else
+    PVHOME=${with_paraview}
+  fi
+
+
+  LOCAL_INCLUDES="-I$PVHOME/include/paraview-$PVVERSION $LOCAL_INCLUDES"
+
+  LOCAL_LIBS="-L$PVHOME/lib/paraview-$PVVERSION -lvtksys -lvtkzlib -lvtkpng -lvtkjpeg -lvtktiff -lvtkexpat -lvtksqlite -lvtkmetaio -lvtkverdict -lvtkNetCDF -lvtkDICOMParser -lvtkfreetype -lvtkftgl -lvtkexoIIc $LOCAL_LIBS"
+  TRY_LINK_LIBS="-L$PVHOME/lib/paraview-$PVVERSION -lvtksys $TRY_LINK_LIBS"
+fi
+
+dnl vtk headers
+CPPFLAGS_old="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS $LOCAL_INCLUDES"
+
+AC_CHECK_HEADER(vtkPlane.h,vtk_ok="yes",vtk_ok="no")
+
+CPPFLAGS="$CPPFLAGS_old"
+
+if test "x$vtk_ok" = "xyes"
+then
+   VTK_INCLUDES="$LOCAL_INCLUDES"
+
+   dnl vtk libraries
+
+   AC_MSG_CHECKING(linking VTK library)
+
+   LIBS_old="$LIBS"
+   LIBS="$LIBS $TRY_LINK_LIBS"
+   #LIBS="$LIBS $LOCAL_LIBS"
+   CPPFLAGS_old="$CPPFLAGS"
+   CPPFLAGS="$CPPFLAGS $VTK_INCLUDES"
+
+   dnl VTKPY_MODULES="$VTKHOME/python"
+
+   AC_CACHE_VAL(salome_cv_lib_vtk,[
+     AC_TRY_LINK([#include "vtkPlane.h"
+                 ],
+                [vtkPlane::New()],
+                [salome_cv_lib_vtk=yes],
+                [salome_cv_lib_vtk=no])
+   ])
+   vtk_ok="$salome_cv_lib_vtk"
+   LIBS="$LIBS_old"
+   CPPFLAGS="$CPPFLAGS_old"
+fi
+
+if  test "x$vtk_ok" = "xno"
+then
+  AC_MSG_RESULT(no)
+  AC_MSG_WARN(unable to link with vtk library)
+else
+  AC_MSG_RESULT(yes)
+  VTK_LIBS="$LOCAL_LIBS"
+  VTK_MT_LIBS="$LOCAL_LIBS"
+fi
+
+AC_MSG_RESULT(for VTK: $vtk_ok)
+
+AC_LANG_RESTORE
+
+# Save cache
+AC_CACHE_SAVE
+
+])dnl