1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-04-02 17:46:22 +03:00

Coding - PCH improvements #160

Refactor precompiled headers and improve Windows compatibility.
Extend TKernel, TKMath and TKBRep pch with more usage headers.
Implement PCH for TKDEIGES, TKDESTEP, TKMesh, and TKXSBase.
This commit is contained in:
dpasukhi 2024-11-16 19:05:55 +00:00
parent 4ebc468140
commit ac5a612645
17 changed files with 124 additions and 64 deletions

View File

@ -456,11 +456,15 @@ function (COLLECT_AND_INSTALL_OCCT_HEADER_FILES THE_ROOT_TARGET_OCCT_DIR THE_OCC
install (FILES ${OCCT_HEADER_FILES_COMPLETE} DESTINATION "${INSTALL_DIR}/${THE_OCCT_INSTALL_DIR_PREFIX}")
endfunction()
function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER)
function(ADD_PRECOMPILED_HEADER INPUT_TARGET PRECOMPILED_HEADER THE_IS_PRIVATE)
if (NOT BUILD_USE_PCH)
return()
endif()
target_precompile_headers(${INPUT_TARGET} PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
if (${THE_IS_PRIVATE})
target_precompile_headers(${INPUT_TARGET} PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
else()
target_precompile_headers(${INPUT_TARGET} PUBLIC "$<$<COMPILE_LANGUAGE:CXX>:${PRECOMPILED_HEADER}>")
endif()
endfunction()
macro (OCCT_COPY_FILE_OR_DIR BEING_COPIED_OBJECT DESTINATION_PATH)

View File

@ -3,4 +3,4 @@ project(TKBRep)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKBRep "${CMAKE_CURRENT_SOURCE_DIR}/TKBRep_pch.hxx")
ADD_PRECOMPILED_HEADER(TKBRep "${CMAKE_CURRENT_SOURCE_DIR}/TKBRep_pch.hxx" FALSE)

View File

@ -1,33 +1,19 @@
#ifndef TKBRep_HXX
#define TKBRep_HXX
// Windows-specific headers (for MSVC)
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> // For Windows API functions like WideCharToMultiByte
#include <tchar.h> // For Unicode/MBCS mappings
#ifdef GetObject
#undef GetObject
#endif
#endif
#include <TopoDS_Shape.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_CompSolid.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Face.hxx>
#include <TopoDS_Iterator.hxx>
#include <TopoDS_Shape.hxx>
#include <TopoDS_Shell.hxx>
#include <TopoDS_Solid.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopoDS_Wire.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#endif // TKBRep_HXX

View File

@ -1,3 +1,6 @@
project(TKDEIGES)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKDEIGES "${CMAKE_CURRENT_SOURCE_DIR}/TKDEIGES_pch.hxx" TRUE)

View File

@ -0,0 +1,9 @@
#ifndef TKDEIGES_PCH_H
#define TKDEIGES_PCH_H
#include <IGESData_HArray1OfIGESEntity.hxx>
#include <IGESData_IGESEntity.hxx>
#include <IGESData_IGESReaderData.hxx>
#include <IGESData_ParamReader.hxx>
#endif // TKDEIGES_PCH_H

View File

@ -2,4 +2,7 @@ project(TKDESTEP)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKDESTEP "${CMAKE_CURRENT_SOURCE_DIR}/TKDESTEP_pch.hxx" TRUE)
FLEX_AND_BISON_TARGET_APPLY ("StepFile" src)

View File

@ -0,0 +1,11 @@
#ifndef TKDESTEP_PCH_H
#define TKDESTEP_PCH_H
#include <StepData_StepReaderData.hxx>
#include <StepData_StepWriter.hxx>
#include <StepGeom_GeometricRepresentationItem.hxx>
#include <StepKinematics_KinematicPair.hxx>
#include <StepRepr_Representation.hxx>
#include <StepRepr_RepresentationItem.hxx>
#endif // TKDESTEP_PCH_H

View File

@ -3,4 +3,4 @@ project(TKMath)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKMath "${CMAKE_CURRENT_SOURCE_DIR}/TKMath_pch.hxx")
ADD_PRECOMPILED_HEADER(TKMath "${CMAKE_CURRENT_SOURCE_DIR}/TKMath_pch.hxx" FALSE)

View File

@ -1,28 +1,23 @@
#ifndef TKMATH_PCH_H
#define TKMATH_PCH_H
// Standard library headers
#include <type_traits>
// Windows-specific headers (for MSVC)
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> // For Windows API functions like WideCharToMultiByte
#include <tchar.h> // For Unicode/MBCS mappings
#ifdef GetObject
#undef GetObject
#endif
#endif
#include <gp_Pnt.hxx>
#include <gp_Vec.hxx>
#include <gp_Dir.hxx>
#include <gp_Ax1.hxx>
#include <gp_Ax2.hxx>
#include <gp_Trsf.hxx>
#include <gp_Ax3.hxx>
#include <gp_Circ.hxx>
#include <gp_Dir.hxx>
#include <gp_Elips.hxx>
#include <gp_Hypr.hxx>
#include <gp_Lin.hxx>
#include <gp_Lin2d.hxx>
#include <gp_Pnt.hxx>
#include <gp_Quaternion.hxx>
#include <gp_Trsf.hxx>
#include <gp_Vec.hxx>
#include <PLib.hxx>
#include <BSplCLib.hxx>
#include <TopLoc_Location.hxx>

View File

@ -1,3 +1,6 @@
project(TKMesh)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKMesh "${CMAKE_CURRENT_SOURCE_DIR}/TKMesh_pch.hxx" TRUE)

View File

@ -0,0 +1,6 @@
#ifndef TKMESH_PCH_H
#define TKMESH_PCH_H
#include <IMeshData_Types.hxx>
#endif // TKMESH_PCH_H

View File

@ -1,3 +1,6 @@
project(TKV3d)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKV3d "${CMAKE_CURRENT_SOURCE_DIR}/TKV3d_pch.hxx" TRUE)

9
src/TKV3d/TKV3d_pch.hxx Normal file
View File

@ -0,0 +1,9 @@
#ifndef TKTKV3d_PCH_H
#define TKTKV3d_PCH_H
#include <AIS_InteractiveObject.hxx>
#include <PrsMgr_PresentableObject.hxx>
#include <SelectMgr_EntityOwner.hxx>
#include <SelectMgr_SelectableObject.hxx>
#endif // TKTKV3d_PCH_H

View File

@ -1,3 +1,6 @@
project(TKXSBase)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKXSBase "${CMAKE_CURRENT_SOURCE_DIR}/TKXSBase_pch.hxx" TRUE)

View File

@ -0,0 +1,10 @@
#ifndef TKXSBASE_PCH_H
#define TKXSBASE_PCH_H
#include <Interface_Check.hxx>
#include <Interface_CheckIterator.hxx>
#include <Interface_EntityIterator.hxx>
#include <Interface_FileReaderData.hxx>
#include <Interface_Graph.hxx>
#endif // TKXSBASE_PCH_H

View File

@ -14,4 +14,4 @@ else ()
endif()
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKernel "${CMAKE_CURRENT_SOURCE_DIR}/TKernel_pch.hxx")
ADD_PRECOMPILED_HEADER(TKernel "${CMAKE_CURRENT_SOURCE_DIR}/TKernel_pch.hxx" FALSE)

View File

@ -2,35 +2,41 @@
#define TKERNEL_PCH_H
// Standard library headers
#include <atomic>
#include <iostream>
#include <limits>
#include <ostream>
#include <random>
#include <sstream>
#include <string>
#include <type_traits>
// Windows-specific headers (for MSVC)
#ifdef _WIN32
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <windows.h> // For Windows API functions like WideCharToMultiByte
#include <tchar.h> // For Unicode/MBCS mappings
#ifdef GetObject
#undef GetObject
#endif
#ifndef NOMINMAX
#define NOMINMAX
#endif
#include <tchar.h> // For Unicode/MBCS mappings
#include <windows.h> // For Windows API functions like WideCharToMultiByte
#ifdef GetObject
#undef GetObject
#endif
#endif
// TKernel headers
#include <Standard.hxx>
#include <Standard_Type.hxx>
#include <Standard_DefineHandle.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Stream.hxx>
#include <Standard_GUID.hxx>
#include <Standard_Handle.hxx>
#include <Standard_Macro.hxx>
#include <Standard_Stream.hxx>
#include <Standard_Transient.hxx>
#include <Standard_Type.hxx>
#include <Precision.hxx>
#include <Quantity_Color.hxx>
#include <Quantity_ColorRGBA.hxx>
#include <Quantity_HArray1OfColor.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <TCollection_AsciiString.hxx>
@ -38,14 +44,23 @@
#include <TCollection_HAsciiString.hxx>
#include <TCollection_HExtendedString.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_Array1.hxx>
#include <NCollection_Array2.hxx>
#include <NCollection_Map.hxx>
#include <NCollection_BaseAllocator.hxx>
#include <NCollection_Buffer.hxx>
#include <NCollection_DataMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Sequence.hxx>
#include <NCollection_DefineHArray1.hxx>
#include <NCollection_IndexedDataMap.hxx>
#include <NCollection_IndexedMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Map.hxx>
#include <NCollection_Sequence.hxx>
#include <Message_ProgressIndicator.hxx>
#include <Message_ProgressRange.hxx>
#include <Message_ProgressScope.hxx>
#include <OSD_Parallel.hxx>
#include <OSD_Path.hxx>
#endif // TKERNEL_PCH_H