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

Configuration - CMake extension with PCH and symlink #90

Removed cotire PCH
Integrated native PCH by CMake with the same BUILD_USE_PCH flag
Added new option to avoid extra files in 'build/include' folder and replace it by symlink
  Symlink creates link to the origin file, it has some benefits from debug and build side.
The CMake parameter for symlink is 'BUILD_INCLUDE_SYMLINK'
This commit is contained in:
dpasukhi
2024-10-07 22:04:51 +00:00
parent 55527ad756
commit 1b5fc7f980
40 changed files with 555 additions and 4747 deletions

View File

@@ -27,6 +27,10 @@ OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
unset (EXECUTABLE_PROJECT)
unset (CUSTOM_EXTERNLIB)
if (NOT BUILD_SHARED_LIBS)
CONFIGURE_DRACO_DEPS()
endif()
if (EMSCRIPTEN)
# Look for Tcl version string from file tcl.h
set (TCL_MAJOR_VERSION 8)

View File

@@ -1,3 +1,6 @@
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")

33
src/TKBRep/TKBRep_pch.hxx Normal file
View File

@@ -0,0 +1,33 @@
#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_CompSolid.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Builder.hxx>
#include <TopoDS_Iterator.hxx>
#include <BRep_Builder.hxx>
#include <BRep_Tool.hxx>
#include <BRepTools.hxx>
#endif // TKBRep_HXX

View File

@@ -1,3 +1,5 @@
project(TKDEGLTF)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
CONFIGURE_DRACO_DEPS()

View File

@@ -1,3 +1,5 @@
project(TKDESTEP)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
FLEX_AND_BISON_TARGET_APPLY ("StepFile" src)

View File

@@ -1,3 +1,7 @@
project(TKDraw)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
if (APPLE AND BUILD_USE_PCH)
set_target_properties(TKDraw PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()

View File

@@ -1,3 +1,6 @@
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")

View File

@@ -4,7 +4,6 @@ ElSLib
BSplCLib
BSplSLib
PLib
Precision
GeomAbs
Poly
CSLib

29
src/TKMath/TKMath_pch.hxx Normal file
View File

@@ -0,0 +1,29 @@
#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_Quaternion.hxx>
#include <TopLoc_Location.hxx>
#endif // TKMATH_PCH_H

View File

@@ -1,5 +1,7 @@
project(TKOpenGl)
set (TKOpenGl_DISABLE_COTIRE ON)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
if (APPLE AND BUILD_USE_PCH)
set_target_properties(TKOpenGl PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()

View File

@@ -1,6 +1,7 @@
project(TKOpenGles)
set (TKOpenGles_DISABLE_COTIRE ON)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
#add_definitions("-DOCCT_OPENGL")
if (APPLE AND BUILD_USE_PCH)
set_target_properties(TKOpenGles PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()

View File

@@ -1,3 +1,5 @@
project(TKRWMesh)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
CONFIGURE_DRACO_DEPS()

View File

@@ -1,5 +1,7 @@
project(TKService)
set (TKService_DISABLE_COTIRE ON)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
if (APPLE AND BUILD_USE_PCH)
set_target_properties(TKService PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()

View File

@@ -1,3 +1,7 @@
project(TKViewerTest)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)
if (APPLE AND BUILD_USE_PCH)
set_target_properties(TKViewerTest PROPERTIES DISABLE_PRECOMPILE_HEADERS ON)
endif()

View File

@@ -1,5 +1,3 @@
project(TKXCAF)
set (TKXCAF_DISABLE_COTIRE ON)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)

View File

@@ -1,5 +1,3 @@
project(TKXDEDRAW)
set (TKXDEDRAW_DISABLE_COTIRE ON)
OCCT_INCLUDE_CMAKE_FILE (adm/cmake/occt_toolkit)

View File

@@ -12,3 +12,6 @@ elseif ("${USE_MMGR_TYPE}" STREQUAL "JEMALLOC")
else ()
message (STATUS "Info: Used native memory manager")
endif()
# Add the precompiled header
ADD_PRECOMPILED_HEADER(TKernel "${CMAKE_CURRENT_SOURCE_DIR}/TKernel_pch.hxx")

View File

@@ -15,3 +15,4 @@ UnitsMethods
NCollection
Message
FlexLexer
Precision

View File

@@ -0,0 +1,51 @@
#ifndef TKERNEL_PCH_H
#define TKERNEL_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
// 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 <Precision.hxx>
#include <Quantity_Color.hxx>
#include <Quantity_ColorRGBA.hxx>
#include <Quantity_HArray1OfColor.hxx>
#include <Quantity_TypeOfColor.hxx>
#include <TCollection_AsciiString.hxx>
#include <TCollection_ExtendedString.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_DataMap.hxx>
#include <NCollection_List.hxx>
#include <NCollection_Sequence.hxx>
#include <NCollection_IndexedDataMap.hxx>
#include <NCollection_IndexedMap.hxx>
#endif // TKERNEL_PCH_H