]> OCCT Git - occt-wok.git/commitdiff
0025506: Procedure of OCCT configure must be improved to make VTK product fully optio...
authorski <ski@opencascade.com>
Fri, 5 Dec 2014 07:47:03 +0000 (10:47 +0300)
committerski <ski@opencascade.com>
Fri, 5 Dec 2014 07:47:03 +0000 (10:47 +0300)
Changes of current procedure of configuration
- configure.ac : changed a way VTK is checked
- Makefile.am (to be put to adm/lib/amk) : make IVTK and IVTKDraw packages optional, according to the configure results.

src/WOKTclLib/osutils.tcl
src/WOKTclLib/templates/template.ac

index 6b490b5bd3ed104a2e492d8d45d92be4a0b9f75d..595e8eb3a4a3c1a20443cc6d713ff864f1b4accd 100755 (executable)
@@ -1325,15 +1325,33 @@ proc osutils:am:adm { dir {lesmodules {}} } {
   set vpath "VPATH = @srcdir@ ${dir}: "
   set make ""
   set phony ".PHONY:"
+  set AllVTKToolkits {}
   foreach theModule $lesmodules {
     set units [osutils:tk:sort [$theModule:toolkits]]
     set units [concat $units [OS:executable $theModule]]
     append amstring "${theModule}_PKGS ="
     append vpath "\\\n"
+    set VTKToolkitsIndexs [lsearch -regexp -nocase -all $units ".*vtk.*"]
+    set VTKToolkits {}
+    if { "$VTKToolkitsIndexs" != "" } {
+      foreach vtktk [lreverse $VTKToolkitsIndexs] {
+        lappend VTKToolkits [lindex $units $vtktk]
+        set units [lreplace $units $vtktk $vtktk]
+      }
+    }
     foreach unit $units {
       append amstring " ${unit}"
       append vpath "${dir}/${unit}: "
     }
+    if {[llength $VTKToolkits]} {
+      append amstring "\nif HAVE_VTK\n"
+      append amstring "  ${theModule}_PKGS +="
+      foreach vtktk $VTKToolkits {
+        append amstring " $vtktk"
+        lappend AllVTKToolkits $vtktk
+      }
+      append amstring "\nendif"
+    }
     set up ${theModule}
     if { [info procs ${theModule}:alias] != "" } {
       set up [${theModule}:alias]
@@ -1352,7 +1370,16 @@ proc osutils:am:adm { dir {lesmodules {}} } {
     append phony " ${theModule}"
   }
   append amstring "$subdirs\n\n"
-  append amstring "$vpath\n\n"
+  append amstring "$vpath\n"
+  if {[llength $AllVTKToolkits]} {
+    append amstring "\nif HAVE_VTK\n"
+    append amstring "  VPATH +="
+    foreach vtktk $AllVTKToolkits {
+      append amstring " ${dir}/$vtktk:"
+    }
+    append amstring "\nendif\n"
+  }
+  append amstring "\n"
   append amstring $make
   append amstring $phony
   wokUtils:FILES:StringToFile $amstring [set fmam [file join $dir Makefile.am]]
@@ -1461,11 +1488,13 @@ proc osutils:am:root { dir theSubPath {lesmodules {}} } {
       append confstr "  fi\n"
     }
     foreach dep $acdeplist {
-      append confstr "  if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$HAVE_${dep}\"; then\n"
-      append confstr "    AC_MSG_NOTICE(\[Disabling ${theModule}: ${dep} not found\])\n"
-      append confstr "    DISABLE_${up}_REASON=\"(${dep} not found)\"\n"
-      append confstr "    ENABLE_${up}=no\n"
-      append confstr "  fi\n"
+      if { "${dep}" != "VTK" } {
+        append confstr "  if test \"xyes\" = \"x\$ENABLE_${up}\" -a \"xyes\" != \"x\$HAVE_${dep}\"; then\n"
+        append confstr "    AC_MSG_NOTICE(\[Disabling ${theModule}: ${dep} not found\])\n"
+        append confstr "    DISABLE_${up}_REASON=\"(${dep} not found)\"\n"
+        append confstr "    ENABLE_${up}=no\n"
+        append confstr "  fi\n"
+      }
     }
     if { [llength $deplist] > 0 || [llength $acdeplist] > 0 } {
       append confstr "else\n"
index ed67b6ed63ae7022587e0d757097034912e75685..88a4993ec234486ae9e9ef6424506b5c4b854f21 100644 (file)
@@ -779,20 +779,24 @@ AC_ARG_WITH([vtk-include],
 
 if test "xno$vtk_inc" = "xno"; then
   # user specified --without-vtk-lib
-  HAVE_VTK=no
   HAVE_VTK_INC=no
-  DISABLE_VTK_REASON_INC="(--with-vtk-include=DIR option was not defined)"
+  DISABLE_VTK_REASON="(--with-vtk-include=DIR option was not defined)"
 else
   CSF_VTK_INCLUDES=""
   AC_LANG([C++])
   HAVE_VTK_INC=yes
   if test ! -d $vtk_inc; then
-    DISABLE_VTK_REASON_INC="($vtk_inc directory does not exists)"
+    DISABLE_VTK_REASON="($vtk_inc directory does not exists)"
     AC_MSG_ERROR([$vtk_inc directory does not exists])
+  elif test ! -f $vtk_inc/vtkVersion.h; then
+    DISABLE_VTK_REASON="(vtk headers are not found in $vtk_inc)"
+    AC_MSG_ERROR([vtk headers are not found in $vtk_inc])
   elif test "x$vtk_inc" != "x"; then
      CPPFLAGS="-I$vtk_inc $CPPFLAGS";
   else
-     AC_MSG_NOTICE("--with-vtk-include key is not defined")
+     HAVE_VTK_INC=no
+     DISABLE_VTK_REASON="(--with-vtk-include=DIR option was not defined)"
+     AC_MSG_NOTICE("--with-vtk-include=DIR option was not defined")
   fi
 fi
 
@@ -1017,7 +1021,9 @@ AC_ARG_WITH([vtk-library],
 if test "xno" = "xno$vtk_lib"; then
 # user specified --without-vtk
   HAVE_VTK=no
-  DISABLE_VTK_REASON_LIB="(--with-vtk-library=DIR option was not defined)"
+  if test "x$DISABLE_VTK_REASON" = "x" ; then
+    DISABLE_VTK_REASON="(--with-vtk-library=DIR option was not defined)"
+  fi
 else
   CSF_VTK_LIB=""
   HAVE_VTK=yes
@@ -1025,39 +1031,25 @@ else
   #CPP_FLAGS="-I$vtk $CPPFLAGS"
   #AC_CHECK_HEADER( [Vtk/vtkConfigure.h], [HAVE_VTK_INC=yes], [HAVE_VTK_INC=no] )
   if test "x$HAVE_VTK_INC" = "xyes"; then
-    if test ! -d $vtk; then
-      DISABLE_VTK_REASON_LIB="($vtk_lib directory does not exist)"
+    if test ! -d $vtk_lib; then
+      DISABLE_VTK_REASON="($vtk_lib directory does not exist)"
       AC_MSG_ERROR([$vtk_lib directory does not exist])
-    elif test "x$vtk_lib" != "x"; then
-      LDFLAGS="-L$vtk_lib $LDFLAGS"
-    fi
-  else
-    HAVE_VTK=no
-  fi
-  
-  if test "x$HAVE_VTK" = "xyes"; then
-    if test "x$vtk_inc" != "x"; then
-      CSF_VTK_INCLUDES=""
-      CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$vtk_inc -DHAVE_VTK"
-    else
-      HAVE_VTK=no
-    fi
-    if test "x$vtk_lib" != "x"; then
+    elif test ! -f $vtk_lib/libvtkCommonCore-6.1.so; then
+      DISABLE_VTK_REASON="(vtk libraries are not found in $vtk_lib)"
+      AC_MSG_ERROR([vtk libraries are not found in $vtk_lib])
+    elif test "x$vtk_lib" != "x" -a "x$vtk_inc" != "x"; then
       CSF_VTK_LIB="-L$vtk_lib -lvtkCommonCore-6.1 -lvtkCommonDataModel-6.1 -lvtkCommonExecutionModel-6.1 -lvtkCommonMath-6.1 -lvtkCommonTransforms-6.1 "
       CSF_VTK_LIB="${CSF_VTK_LIB} -lvtkRenderingCore-6.1 -lvtkRenderingOpenGL-6.1  -lvtkFiltersGeneral-6.1 -lvtkIOCore-6.1 -lvtkIOImage-6.1 -lvtkImagingCore-6.1 -lvtkInteractionStyle-6.1 "
-    else
-      HAVE_VTK=no
-    fi
-
-    if test "x$HAVE_VTK" = "xyes"; then
       CSF_OPT_INC="$vtk_inc:${CSF_OPT_INC}"
       CSF_OPT_LIB="$vtk_lib:${CSF_OPT_LIB}"
+      CSF_OPT_INCLUDES="${CSF_OPT_INCLUDES} -I$vtk_inc -DHAVE_VTK"
     else
-      DISABLE_VTK_REASON="(VTK was not found)"
+      HAVE_VTK=no
+      AC_MSG_NOTICE("--with-vtk-library=DIR option was not defined")
+      DISABLE_VTK_REASON="(--with-vtk-library=DIR option was not defined)"
     fi
   else
-    AC_MSG_NOTICE("Specify --with-vtk-library to enable VTK support")
-    DISABLE_VTK_REASON_LIB="(VTK libraries were not found)"
+    HAVE_VTK=no
   fi
 fi