From 1c29294ea00e112217a600adde3f9d208f245530 Mon Sep 17 00:00:00 2001 From: abv Date: Fri, 17 Jul 2015 19:20:06 +0300 Subject: [PATCH] 0026457: Failed build with OCCT_DEBUG enabled Debug code enabled with OCCT_DEBUG macro corrected for compiling with new handles. QANCollection_Handle.cxx simplified so as to avoid need of using /bigobj option when building by Visual Studio; templates of project files, CMake projects, and test perf fclasses handle corrected accordingly. Script genproj corrected to recognize VTK and to build DRAWEXE as executable (rather than DLL). --- adm/genproj.tcl | 53 ++++++++++++++----- adm/templates/template.vc10 | 6 +-- adm/templates/template.vc11 | 6 +-- adm/templates/template.vc12 | 6 +-- adm/templates/template.vc9 | 6 +-- src/DNaming/DNaming_RevolutionDriver.cxx | 8 +-- src/DNaming/DNaming_SelectionDriver.cxx | 3 +- src/QANCollection/QANCollection_Handle.cxx | 29 +--------- src/STEPCAFControl/STEPCAFControl_Reader.cxx | 2 +- .../STEPConstruct_ValidationProps.cxx | 4 +- src/TKQADraw/CMakeLists.txt | 7 --- src/TNaming/TNaming.cxx | 4 +- .../TopoDSToStep_MakeStepFace.cxx | 2 +- src/UnitsAPI/UnitsAPI.cxx | 2 +- tests/perf/fclasses/handle | 19 +++---- 15 files changed, 72 insertions(+), 85 deletions(-) diff --git a/adm/genproj.tcl b/adm/genproj.tcl index 0adf812093..06e187d124 100644 --- a/adm/genproj.tcl +++ b/adm/genproj.tcl @@ -1066,6 +1066,9 @@ proc osutils:csfList { theOS theCsfMap } { # Note: Tcl library name depends on version and is chosen by #pragma set aCsfMap(CSF_QT) "QtCore4.lib QtGui4.lib" + #-- VTK + set aCsfMap(CSF_VTK) [osutils:vtkCsf "wnt"] + } else { #-- Tcl/Tk configuration @@ -1108,10 +1111,42 @@ proc osutils:csfList { theOS theCsfMap } { set aCsfMap(CSF_GL2PS) "gl2ps" #-- VTK - set aCsfMap(CSF_VTK) "vtkCommonCore-6.1 vtkCommonDataModel-6.1 vtkCommonExecutionModel-6.1 vtkCommonMath-6.1 vtkCommonTransforms-6.1 vtkRenderingCore-6.1" + set aCsfMap(CSF_VTK) [osutils:vtkCsf "unix"] } } +# Returns string of library dependencies for generation of Visual Studio project or make lists. +proc osutils:vtkCsf {{theOS ""}} { + set aVtkVer "6.1" + + set aLibSuffix "" + set aPathSplitter ":" + + if {"$theOS" == "wnt"} { + set aPathSplitter ";" + set aLibSuffix ".lib" + } + + set anOptIncs [split $::env(CSF_OPT_INC) "$aPathSplitter"] + foreach anIncItem $anOptIncs { + if {[regexp -- "vtk-(.*)$" [file tail $anIncItem] dummy aFoundVtkVer]} { + set aVtkVer $aFoundVtkVer + } + } + + set aLibArray [list vtkCommonCore vtkCommonDataModel vtkCommonExecutionModel vtkCommonMath vtkCommonTransforms vtkRenderingCore \ + vtkRenderingOpenGL vtkFiltersGeneral vtkIOCore vtkIOImage vtkImagingCore vtkInteractionStyle] + + # Additional suffices for the libraries + set anIdx 0 + foreach anItem $aLibArray { + lset aLibArray $anIdx $anItem-$aVtkVer$aLibSuffix + incr anIdx + } + + return [join $aLibArray " "] +} + proc osutils:usedOsLibs { theToolKit theOS } { global path set aUsedLibs [list] @@ -1603,13 +1638,6 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} } set aUsedToolKits [concat $aCommonUsedTK [osutils:usedOsLibs $theToolKit "wnt"]] - #puts "\t 7 $WOKSteps_exec_link($theToolKit)" - if { [regexp {WOKStep_DLLink} [_get_options wnt WOKSteps_exec_link $theToolKit]] || [regexp {WOKStep_Libink} [_get_options wnt WOKSteps_exec_link $theToolKit]] } { - set aUsedToolKits [concat $aUsedToolKits "\/dll"] - set binext 2 - } else { - set binext 1 - } # correct names of referred third-party libraries that are named with suffix # depending on VC version @@ -1647,12 +1675,9 @@ proc osutils:vcprojx { theVcVer theOutDir theToolKit theGuidsMap {theProjTmpl {} regsub -all -- {__TKINC__} $aProjTmpl $anIncPaths aProjTmpl regsub -all -- {__TKDEFS__} $aProjTmpl $aTKDefines aProjTmpl regsub -all -- {__FILES__} $aProjTmpl $aFilesSection aProjTmpl - regsub -all -- {__CONF__} $aProjTmpl $binext aProjTmpl - if { $binext == 2 } { - regsub -all -- {__XQTEXT__} $aProjTmpl "dll" aProjTmpl - } else { - regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl - } + regsub -all -- {__CONF__} $aProjTmpl Application aProjTmpl + + regsub -all -- {__XQTEXT__} $aProjTmpl "exe" aProjTmpl set aFile [open [set aVcFilePath [file join $theOutDir ${aProjName}.[osutils:vcproj:ext $theVcVer]]] w] fconfigure $aFile -translation crlf diff --git a/adm/templates/template.vc10 b/adm/templates/template.vc10 index 61b3790a5c..ee763aea74 100644 --- a/adm/templates/template.vc10 +++ b/adm/templates/template.vc10 @@ -120,7 +120,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true Disabled @@ -166,7 +166,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true MaxSpeed @@ -209,7 +209,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true Disabled diff --git a/adm/templates/template.vc11 b/adm/templates/template.vc11 index 876dadeb4c..5c09f22d72 100644 --- a/adm/templates/template.vc11 +++ b/adm/templates/template.vc11 @@ -123,7 +123,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true Disabled @@ -168,7 +168,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true MaxSpeed @@ -211,7 +211,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true Disabled diff --git a/adm/templates/template.vc12 b/adm/templates/template.vc12 index 7cbdfeda49..6e180d990a 100644 --- a/adm/templates/template.vc12 +++ b/adm/templates/template.vc12 @@ -123,7 +123,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true Disabled @@ -168,7 +168,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true MaxSpeed @@ -211,7 +211,7 @@ - /bigobj %(AdditionalOptions) + %(AdditionalOptions) __TKINC__;$(CSF_OPT_INC);%(AdditionalIncludeDirectories) true Disabled diff --git a/adm/templates/template.vc9 b/adm/templates/template.vc9 index 69cbaaf9b3..9bd7358289 100644 --- a/adm/templates/template.vc9 +++ b/adm/templates/template.vc9 @@ -146,7 +146,7 @@ /> Get().TShape(); - cout << "TShape = " << (Standard_Address)aTS <(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 1: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 2: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 3: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 4: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 5: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 6: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 7: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 8: qaCastAs(theDI, *aHandle, aNbIters); break; \ - case 10 * theTens + 9: qaCastAs(theDI, *aHandle, aNbIters); break; - switch (aPtrTo) { // vc11 requires /bigobj option - //QA_TEST_CASTAS10(0) - //QA_TEST_CASTAS10(1) - //QA_TEST_CASTAS10(2) - //QA_TEST_CASTAS10(3) - //QA_TEST_CASTAS10(4) case 0: qaCastAs(theDI, *aHandle, aNbIters); break; case 10: qaCastAs(theDI, *aHandle, aNbIters); break; case 20: qaCastAs(theDI, *aHandle, aNbIters); break; diff --git a/src/STEPCAFControl/STEPCAFControl_Reader.cxx b/src/STEPCAFControl/STEPCAFControl_Reader.cxx index d3ab997d39..31a8e50452 100644 --- a/src/STEPCAFControl/STEPCAFControl_Reader.cxx +++ b/src/STEPCAFControl/STEPCAFControl_Reader.cxx @@ -184,7 +184,7 @@ TCollection_AsciiString AddrToString(const TopoDS_Shape& theShape) { std::string anAddrStr; std::ostringstream ost; - ost << theShape.TShape().Access(); + ost << theShape.TShape().get(); anAddrStr = ost.str(); TCollection_AsciiString aStr = diff --git a/src/STEPConstruct/STEPConstruct_ValidationProps.cxx b/src/STEPConstruct/STEPConstruct_ValidationProps.cxx index 6bd3aabd32..6df3c0ab4e 100644 --- a/src/STEPConstruct/STEPConstruct_ValidationProps.cxx +++ b/src/STEPConstruct/STEPConstruct_ValidationProps.cxx @@ -673,7 +673,7 @@ Standard_Boolean STEPConstruct_ValidationProps::GetPropReal (const Handle(StepRe else if ( Name == "VOLUME_MEASURE" ) isArea = Standard_False; else { #ifdef OCCT_DEBUG - cout << "Warning: Measure " << Model()->StringLabel ( M ) << " is neither area not volume" << endl; + cout << "Warning: Measure " << Model()->StringLabel ( M )->String() << " is neither area not volume" << endl; #endif return Standard_False; } @@ -696,7 +696,7 @@ Standard_Boolean STEPConstruct_ValidationProps::GetPropPnt (const Handle(StepRep Handle(StepGeom_CartesianPoint) P = Handle(StepGeom_CartesianPoint)::DownCast ( item ); if ( P.IsNull() || P->NbCoordinates() != 3 ) { #ifdef OCCT_DEBUG - cout << "Warning: Point " << Model()->StringLabel ( P ) << " is not valid for centroid" << endl; + cout << "Warning: Point " << Model()->StringLabel ( P )->String() << " is not valid for centroid" << endl; #endif return Standard_False;; } diff --git a/src/TKQADraw/CMakeLists.txt b/src/TKQADraw/CMakeLists.txt index 78c03b0268..175f79a12b 100644 --- a/src/TKQADraw/CMakeLists.txt +++ b/src/TKQADraw/CMakeLists.txt @@ -21,11 +21,4 @@ else() endif() endif() -if(MSVC) - # /bigobj is required for windows builds because of the size of - # some object files (CastImage for instance) - set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /bigobj") -endif() - include(${OCCT_SOURCE_DIR}/adm/cmake/BuildToolkit.cmake) diff --git a/src/TNaming/TNaming.cxx b/src/TNaming/TNaming.cxx index 24691de33a..dfea6cb71d 100644 --- a/src/TNaming/TNaming.cxx +++ b/src/TNaming/TNaming.cxx @@ -831,8 +831,8 @@ TopoDS_Shape TNaming::FindUniqueContext(const TopoDS_Shape& Selection, const Top #ifdef OCCT_DEBUG TopTools_DataMapIteratorOfDataMapOfOrientedShapeShape it (aMap); for (;it.More();it.Next()) { - cout <<"FindUniqueContext: Key - " < 1.05 } { } # Check performance of down casting at different nesting depths. -# OCCT is expected to be at least twice faster on deep nesting on x64, -# however can be slower on 32-bit +# OCCT is expected to be the same as C++ set depths {3 5 10 50} -if { [regexp x86 [dversion]] } { - set thresholds {2. 1.5 1. 1.2} -} else { - set thresholds {1.6 1.1 0.7 0.5} -} +set threshold_std 1.15 +set threshold_ptr 1.05 for {set i 0} {$i < [llength $depths]} {incr i} { set depth [lindex $depths $i] - set threshold [lindex $thresholds $i] puts "\nTesting DownCast at nesting depth $depth" set res [QAHandleCast $depth 0 100000] set res_lines [split $res \n] - set time_occt [lindex [lindex [split [lindex $res_lines end-2] :] end] $depth] - set time_std [lindex [lindex [split [lindex $res_lines end-1] :] end] $depth] - set time_ptr [lindex [lindex [split [lindex $res_lines end ] :] end] $depth] + set time_occt [lindex [lindex [split [lindex $res_lines end-2] :] end] end] + set time_std [lindex [lindex [split [lindex $res_lines end-1] :] end] end] + set time_ptr [lindex [lindex [split [lindex $res_lines end ] :] end] end] set ratio_std [expr $time_occt / $time_std] set ratio_ptr [expr $time_occt / $time_ptr] puts "Ratio of time of OCCT DownCast() to dynamic_cast<>: $ratio_std" puts "Ratio of time of OCCT DownCast() to dynamic_pointer_cast<>: $ratio_ptr" - if { $ratio_std > $threshold || $ratio_ptr > $threshold } { + if { $ratio_std > $threshold_std || $ratio_ptr > $threshold_ptr } { puts "Error: OCCT DownCast() is expected to be faster!" } } \ No newline at end of file