1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-08-09 13:22:24 +03:00

0028417: Using PRECOMPILED HEADER to speed up compilation time

Use of Cotire tool is introduced for acceleration of CMake builds, by usage of precompiled headers.
CMake option BUILD_USE_PCH is added to enable / disable use of precompiled headers

When precompiled headers are used, additional compiler macros are defined globally in the build system to avoid problems due to different order of included files:
- NOMINMAX is defined on Windows to prevent defining "min" and "max" as macros by windows.h
- STRSAFE_NO_DEPRECATE and _SCL_SECURE_NO_WARNINGS are defined on Windows to prevent declaring functions of standard C library as deprecated by #pragma, and other warnings in system headers
- GL_GLEXT_LEGACY and GLX_GLEXT_LEGACY are defined to ensure that only OCCT's own glext.h is used
- __STDC_FORMAT_MACROS is defined to have standard C print format macros always defined

Code is corrected to avoid conflicts with system headers and in case of compiling together as unity builds (partially):
- Some locally defined variables in TKV3d, TKHLR are renamed to be unique
- Duplicated definitions of macros and global functions are eliminated in TKSTEP
- Useless header WNT_UInt.hxx is removed
- Usage of local variables conflicting with X11 macro is avoided in Draw_Viewer.cxx
- Local variables in AIS_ConcentricRelation.cxx are renamed to avoid conflict with macros defined in windows.h
- HXX files containing code are renamed to PXX or merged with corresponding CXX files.

IVtkTools classes are corrected to avoid compiler warnings disabled in non-PCH builds by inclusion of VTK headers.

Useless pragmas disabling warnings on MSVC are removed
This commit is contained in:
abv
2017-06-29 20:17:39 +03:00
committed by bugmaster
parent a07cff6957
commit 896faa7296
91 changed files with 5213 additions and 1746 deletions

View File

@@ -204,12 +204,6 @@ static Handle(PipelinePtr) PipelineByActorName (const TCollection_AsciiString& t
return PipelineByActor (anActor);
}
static Standard_Boolean IsEqual (const TopoDS_Shape& theLeft,
const TopoDS_Shape& theRight)
{
return theLeft.IsEqual (theRight);
}
#ifdef _WIN32
static Handle(WNT_Window)& GetWindow()
@@ -373,7 +367,7 @@ void IVtkDraw::ViewerInit (Standard_Integer thePxLeft,
// Init picker
GetPicker() = vtkSmartPointer<IVtkTools_ShapePicker>::New();
GetPicker()->SetTolerance (0.025);
GetPicker()->SetTolerance (0.025f);
GetPicker()->SetRenderer (GetRenderer());
GetInteractor()->SetShapePicker (GetPicker());

View File

@@ -653,34 +653,34 @@ LRESULT CALLBACK ViewerWindowProc (HWND theHWnd,
theInteractor->Render();
break;
case WM_SIZE:
theInteractor->OnSize (theHWnd, theWParam, LOWORD(theLParam), HIWORD(theLParam));
theInteractor->OnSize (theHWnd, (UINT)theWParam, LOWORD(theLParam), HIWORD(theLParam));
break;
case WM_LBUTTONDBLCLK:
theInteractor->OnLButtonDown (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 1);
theInteractor->OnLButtonDown (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 1);
break;
case WM_LBUTTONDOWN:
theInteractor->OnLButtonDown (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 0);
theInteractor->OnLButtonDown (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 0);
break;
case WM_LBUTTONUP:
theInteractor->OnLButtonUp (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
theInteractor->OnLButtonUp (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
break;
case WM_MBUTTONDBLCLK:
theInteractor->OnMButtonDown (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 1);
theInteractor->OnMButtonDown (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 1);
break;
case WM_MBUTTONDOWN:
theInteractor->OnMButtonDown (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 0);
theInteractor->OnMButtonDown (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 0);
break;
case WM_MBUTTONUP:
theInteractor->OnMButtonUp (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
theInteractor->OnMButtonUp (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
break;
case WM_RBUTTONDBLCLK:
theInteractor->OnRButtonDown (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 1);
theInteractor->OnRButtonDown (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 1);
break;
case WM_RBUTTONDOWN:
theInteractor->OnRButtonDown (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 0);
theInteractor->OnRButtonDown (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y, 0);
break;
case WM_RBUTTONUP:
theInteractor->OnRButtonUp (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
theInteractor->OnRButtonUp (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
break;
case WM_MOUSELEAVE:
{
@@ -689,7 +689,7 @@ LRESULT CALLBACK ViewerWindowProc (HWND theHWnd,
}
break;
case WM_MOUSEMOVE:
theInteractor->OnMouseMove (theHWnd, theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
theInteractor->OnMouseMove (theHWnd, (UINT)theWParam, MAKEPOINTS(theLParam).x, MAKEPOINTS(theLParam).y);
break;
case WM_MOUSEWHEEL:
{
@@ -699,16 +699,16 @@ LRESULT CALLBACK ViewerWindowProc (HWND theHWnd,
::ScreenToClient(theHWnd, &pt);
if( GET_WHEEL_DELTA_WPARAM(theWParam) > 0)
{
theInteractor->OnMouseWheelForward (theHWnd, theWParam, pt.x, pt.y);
theInteractor->OnMouseWheelForward (theHWnd, (UINT)theWParam, pt.x, pt.y);
}
else
{
theInteractor->OnMouseWheelBackward (theHWnd, theWParam, pt.x, pt.y);
theInteractor->OnMouseWheelBackward (theHWnd, (UINT)theWParam, pt.x, pt.y);
}
}
break;
case WM_TIMER:
theInteractor->OnTimer (theHWnd, theWParam);
theInteractor->OnTimer (theHWnd, (UINT)theWParam);
break;
}
return DefWindowProc(theHWnd, theMsg, theWParam, theLParam);