]> OCCT Git - occt.git/commitdiff
Coding - PCH improvements #160
authordpasukhi <dpasukhi@opencascade.com>
Sat, 16 Nov 2024 19:05:55 +0000 (19:05 +0000)
committerdpasukhi <dpasukhi@opencascade.com>
Sun, 17 Nov 2024 20:14:04 +0000 (20:14 +0000)
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.

17 files changed:
adm/cmake/occt_macros.cmake
src/TKBRep/CMakeLists.txt
src/TKBRep/TKBRep_pch.hxx
src/TKDEIGES/CMakeLists.txt
src/TKDEIGES/TKDEIGES_pch.hxx [new file with mode: 0644]
src/TKDESTEP/CMakeLists.txt
src/TKDESTEP/TKDESTEP_pch.hxx [new file with mode: 0644]
src/TKMath/CMakeLists.txt
src/TKMath/TKMath_pch.hxx
src/TKMesh/CMakeLists.txt
src/TKMesh/TKMesh_pch.hxx [new file with mode: 0644]
src/TKV3d/CMakeLists.txt
src/TKV3d/TKV3d_pch.hxx [new file with mode: 0644]
src/TKXSBase/CMakeLists.txt
src/TKXSBase/TKXSBase_pch.hxx [new file with mode: 0644]
src/TKernel/CMakeLists.txt
src/TKernel/TKernel_pch.hxx

index 800c2b42f9436bcb919e90d81c2914648ca8edc4..3d78b6f2d554068f26c1c19f66113bbb5d819d70 100644 (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)
index 66a3f6731ca9c862e7a2ac443aacaa1d3fa19687..f6622c2e748e3eb76b97c8c67554cfd6ec81c16a 100644 (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)
index 9912afd95baeb228507db48450284bf3583853d9..341ed29b7a67178acfe0d4e39b044862916c3c8b 100644 (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
\ No newline at end of file
index a7e09e50e441149cc7fe7798dc200835e244e552..2ba9c603828a4800aaea212de53bdb394ac00dbc 100644 (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)
diff --git a/src/TKDEIGES/TKDEIGES_pch.hxx b/src/TKDEIGES/TKDEIGES_pch.hxx
new file mode 100644 (file)
index 0000000..f525f09
--- /dev/null
@@ -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
index 7ae7872796f7467adeeb51e7cb941234eab0377d..5a6b02e23e03cd6b3f5818e5b1d3388b419d22f3 100644 (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)
diff --git a/src/TKDESTEP/TKDESTEP_pch.hxx b/src/TKDESTEP/TKDESTEP_pch.hxx
new file mode 100644 (file)
index 0000000..49d7770
--- /dev/null
@@ -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
index 7c49b4496f60c4ea6a112fe5c8a732e93c305292..57b6486378d1c8c69b5ab84ceae0e7cd4ba0a619 100644 (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)
index 92b7a786439bd0acade235ce76190d084b57e12e..c9ae8cd7d6f7aa90bfee4a1b87dcf27013d7267d 100644 (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>
 
index c63df5aa58578e846558c9402498bcc2cdc46ead..d4ca239ba361572e48caf9f92127f817cfc87782 100644 (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)
diff --git a/src/TKMesh/TKMesh_pch.hxx b/src/TKMesh/TKMesh_pch.hxx
new file mode 100644 (file)
index 0000000..ffd99b7
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef TKMESH_PCH_H
+#define TKMESH_PCH_H
+
+#include <IMeshData_Types.hxx>
+
+#endif // TKMESH_PCH_H
index 1fa271d26dc4de07a8f83c1c0889546c954d678a..9745c5b65eade3210055a834f85d29a987cde36f 100644 (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)
diff --git a/src/TKV3d/TKV3d_pch.hxx b/src/TKV3d/TKV3d_pch.hxx
new file mode 100644 (file)
index 0000000..93ff979
--- /dev/null
@@ -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
index 4b8ad112acdb9a6439c5fa3ab2e0af05a54ee6e8..e8c7631d001e6c67121027add89307c5079c9bad 100644 (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)
diff --git a/src/TKXSBase/TKXSBase_pch.hxx b/src/TKXSBase/TKXSBase_pch.hxx
new file mode 100644 (file)
index 0000000..ef4295d
--- /dev/null
@@ -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
index 4e4dfe0592a82b031980e907248a816fbc2fdb84..ff4e72705ba06c19b7f785de39ea39fcf5136d81 100644 (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)
index aec52cad760b2e31970fc2911a5f6fe2ac57deb5..7f72876c124f90c9f0db941d9a2c51ec1afba17a 100644 (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_GUID.hxx>
 #include <Standard_Handle.hxx>
+#include <Standard_Macro.hxx>
 #include <Standard_Stream.hxx>
-#include <Standard_GUID.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>
 #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
\ No newline at end of file