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

@@ -22,7 +22,7 @@
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture1D,Graphic3d_TextureMap)
static const char *NameOfTexture_to_FileName[] =
static const char *NameOfTexture1d_to_FileName[] =
{
"1d_elevation.rgb"
};
@@ -44,12 +44,12 @@ Graphic3d_Texture1D::Graphic3d_Texture1D (const TCollection_AsciiString& theFile
// =======================================================================
Graphic3d_Texture1D::Graphic3d_Texture1D (const Graphic3d_NameOfTexture1D theNOT,
const Graphic3d_TypeOfTexture theType)
: Graphic3d_TextureMap (NameOfTexture_to_FileName[theNOT], theType),
: Graphic3d_TextureMap (NameOfTexture1d_to_FileName[theNOT], theType),
myName (theNOT)
{
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
myTexId = TCollection_AsciiString ("Graphic3d_Texture1D_")
+ NameOfTexture_to_FileName[theNOT];
+ NameOfTexture1d_to_FileName[theNOT];
}
// =======================================================================
@@ -78,7 +78,7 @@ Graphic3d_NameOfTexture1D Graphic3d_Texture1D::Name() const
// =======================================================================
Standard_Integer Graphic3d_Texture1D::NumberOfTextures()
{
return sizeof(NameOfTexture_to_FileName)/sizeof(char*);
return sizeof(NameOfTexture1d_to_FileName)/sizeof(char*);
}
// =======================================================================
@@ -92,7 +92,7 @@ TCollection_AsciiString Graphic3d_Texture1D::TextureName (const Standard_Integer
throw Standard_OutOfRange("BAD index of texture");
}
TCollection_AsciiString aFileName (NameOfTexture_to_FileName[theRank - 1]);
TCollection_AsciiString aFileName (NameOfTexture1d_to_FileName[theRank - 1]);
Standard_Integer i = aFileName.SearchFromEnd (".");
return aFileName.SubString (4, i - 1);
}

View File

@@ -20,7 +20,7 @@
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_Texture2D,Graphic3d_TextureMap)
static const char *NameOfTexture_to_FileName[] =
static const char *NameOfTexture2d_to_FileName[] =
{
"2d_MatraDatavision.rgb",
"2d_alienskin.rgb",
@@ -63,12 +63,12 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const TCollection_AsciiString& theFile
// =======================================================================
Graphic3d_Texture2D::Graphic3d_Texture2D (const Graphic3d_NameOfTexture2D theNOT,
const Graphic3d_TypeOfTexture theType)
: Graphic3d_TextureMap (NameOfTexture_to_FileName[theNOT], theType),
: Graphic3d_TextureMap (NameOfTexture2d_to_FileName[theNOT], theType),
myName (theNOT)
{
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
myTexId = TCollection_AsciiString ("Graphic3d_Texture2D_")
+ NameOfTexture_to_FileName[theNOT];
+ NameOfTexture2d_to_FileName[theNOT];
}
// =======================================================================
@@ -88,7 +88,7 @@ Graphic3d_Texture2D::Graphic3d_Texture2D (const Handle(Image_PixMap)& thePixM
// =======================================================================
Standard_Integer Graphic3d_Texture2D::NumberOfTextures()
{
return sizeof(NameOfTexture_to_FileName)/sizeof(char*);
return sizeof(NameOfTexture2d_to_FileName)/sizeof(char*);
}
// =======================================================================
@@ -111,7 +111,7 @@ TCollection_AsciiString Graphic3d_Texture2D::TextureName (const Standard_Integer
throw Standard_OutOfRange("BAD index of texture");
}
TCollection_AsciiString aFileName (NameOfTexture_to_FileName[theRank - 1]);
TCollection_AsciiString aFileName (NameOfTexture2d_to_FileName[theRank - 1]);
Standard_Integer i = aFileName.SearchFromEnd (".");
return aFileName.SubString (4, i - 1);
}

View File

@@ -25,7 +25,7 @@
IMPLEMENT_STANDARD_RTTIEXT(Graphic3d_TextureEnv,Graphic3d_TextureRoot)
static const char *NameOfTexture_to_FileName[] =
static const char *NameOfTextureEnv_to_FileName[] =
{
"env_clouds.rgb",
"env_cv.rgb",
@@ -56,12 +56,12 @@ Graphic3d_TextureEnv::Graphic3d_TextureEnv (const TCollection_AsciiString& theFi
// purpose :
// =======================================================================
Graphic3d_TextureEnv::Graphic3d_TextureEnv (const Graphic3d_NameOfTextureEnv theNOT)
: Graphic3d_TextureRoot (NameOfTexture_to_FileName[theNOT], Graphic3d_TOT_2D_MIPMAP),
: Graphic3d_TextureRoot (NameOfTextureEnv_to_FileName[theNOT], Graphic3d_TOT_2D_MIPMAP),
myName (theNOT)
{
myPath.SetTrek (Graphic3d_TextureRoot::TexturesFolder());
myTexId = TCollection_AsciiString ("Graphic3d_TextureEnv_")
+ NameOfTexture_to_FileName[theNOT];
+ NameOfTextureEnv_to_FileName[theNOT];
myParams->SetFilter (Graphic3d_TOTF_TRILINEAR);
myParams->SetGenMode (Graphic3d_TOTM_SPHERE,
@@ -98,7 +98,7 @@ Graphic3d_NameOfTextureEnv Graphic3d_TextureEnv::Name() const
// =======================================================================
Standard_Integer Graphic3d_TextureEnv::NumberOfTextures()
{
return sizeof(NameOfTexture_to_FileName)/sizeof(char*);
return sizeof(NameOfTextureEnv_to_FileName)/sizeof(char*);
}
// =======================================================================
@@ -112,7 +112,7 @@ TCollection_AsciiString Graphic3d_TextureEnv::TextureName (const Standard_Intege
throw Standard_OutOfRange("BAD index of texture");
}
TCollection_AsciiString aFileName (NameOfTexture_to_FileName[theRank - 1]);
TCollection_AsciiString aFileName (NameOfTextureEnv_to_FileName[theRank - 1]);
Standard_Integer i = aFileName.SearchFromEnd(".");
return aFileName.SubString (5, i - 1);
}