Surface: use CMake to generate precompiled headers on all platforms

"Professional CMake" book suggest the following:

"Targets should build successfully with or without compiler support for precompiled headers. It
 should be considered an optimization, not a requirement. In particular, do not explicitly include a
 precompile header (e.g. stdafx.h) in the source code, let CMake force-include an automatically
 generated precompile header on the compiler command line instead. This is more portable across
 the major compilers and is likely to be easier to maintain. It will also avoid warnings being
 generated from certain code checking tools like iwyu (include what you use)."

Therefore, removed the "#include <PreCompiled.h>" from sources, also
there is no need for the "#ifdef _PreComp_" anymore
This commit is contained in:
Markus Reitböck
2025-09-21 16:39:50 +02:00
parent f523ab6ee3
commit d3dbc6158e
29 changed files with 23 additions and 126 deletions

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Console.h>
#include <Base/Interpreter.h>

View File

@@ -21,8 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BSplCLib.hxx>
#include <Geom_BezierCurve.hxx>
#include <Precision.hxx>
@@ -31,7 +29,7 @@
#include <gp_Pnt.hxx>
#include <math_Gauss.hxx>
#include <math_Matrix.hxx>
#endif
#include "Blending/BlendCurve.h"
#include "Blending/BlendCurvePy.h"
#include <Base/Vector3D.h>

View File

@@ -20,7 +20,6 @@
// * *
// ***************************************************************************/
#include "PreCompiled.h"
// clang-format off
#include "Blending/BlendCurvePy.h"

View File

@@ -21,11 +21,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <Precision.hxx>
#include <Standard_Real.hxx>
#endif
#include "Blending/BlendPoint.h"
#include "Blending/BlendPointPy.h"

View File

@@ -20,11 +20,9 @@
// * *
// ***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRepAdaptor_Curve.hxx>
#include <TopoDS.hxx>
#endif
// clang-format off
#include "Blending/BlendPoint.h"

View File

@@ -21,14 +21,12 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Standard_Version.hxx>
#include <TopoDS.hxx>
#include <gp_Pnt.hxx>
#endif
#include "Mod/Surface/App/Blending/BlendCurve.h"
#include "Mod/Surface/App/Blending/BlendPoint.h"

View File

@@ -30,7 +30,6 @@ SET(Surface_SRCS
${Blending_SRCS}
${BlendingPy_SRCS}
AppSurface.cpp
PreCompiled.cpp
PreCompiled.h
FeatureExtend.cpp
FeatureExtend.h
@@ -46,13 +45,14 @@ SET(Surface_SRCS
FeatureCut.h
)
add_library(Surface SHARED ${Surface_SRCS})
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${Surface_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Surface PreCompiled.h PreCompiled.cpp PCH_SRCS)
target_precompile_headers(Surface PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
add_library(Surface SHARED ${Surface_SRCS})
target_include_directories(
Surface
PRIVATE

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <TopoDS.hxx>
#endif
#include "FeatureCut.h"

View File

@@ -20,8 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <limits>
#include <BRepAdaptor_Surface.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRepLProp_SLProps.hxx>
@@ -33,8 +33,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <gp_Pnt.hxx>
#include <limits>
#endif
#include <Base/Tools.h>

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <string>
#include <BRepBuilderAPI_MakeWire.hxx>
@@ -30,7 +28,6 @@
#include <TopoDS.hxx>
#include <TopoDS_Face.hxx>
#include <gp_Pnt.hxx>
#endif
#include "FeatureFilling.h"

View File

@@ -21,9 +21,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRepBuilderAPI_Copy.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <BRep_Tool.hxx>
@@ -47,7 +45,7 @@
#include <TopoDS_Face.hxx>
#include <TopoDS_Wire.hxx>
#include <gp_Trsf.hxx>
#endif
#include "FeatureGeomFillSurface.h"

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRepAdaptor_Curve.hxx>
#include <BRepBuilderAPI_MakeFace.hxx>
#include <GeomFill_NSections.hxx>
@@ -31,7 +29,7 @@
#include <Standard_Version.hxx>
#include <TopLoc_Location.hxx>
#include <TopoDS.hxx>
#endif
#include "FeatureSections.h"

View File

@@ -20,12 +20,10 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRepBuilderAPI_Sewing.hxx>
#include <Precision.hxx>
#include <TopoDS.hxx>
#endif
#include "FeatureSewing.h"

View File

@@ -1,23 +0,0 @@
/***************************************************************************
* Copyright (c) 2014 Nathan Miller <Nathan.A.Mill[at]gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"

View File

@@ -25,14 +25,10 @@
#include <FCConfig.h>
#ifdef _PreComp_
// STL
#include <string>
// opencascade
#include <Mod/Part/App/OpenCascadeAll.h>
#endif //_PreComp_
#endif

View File

@@ -21,7 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Console.h>
#include <Base/Interpreter.h>

View File

@@ -19,13 +19,10 @@
* *
**************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QMenu>
#include <QMessageBox>
#include <QTimer>
#endif
#include <App/Document.h>
#include <Base/Tools.h>

View File

@@ -20,10 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QMenu>
#endif
#include "ViewProviderBlendCurve.h"
#include "TaskBlendCurve.h"

View File

@@ -38,7 +38,6 @@ SET(SurfaceGui_SRCS
TaskSections.h
AppSurfaceGui.cpp
Command.cpp
PreCompiled.cpp
PreCompiled.h
ViewProviderExtend.cpp
ViewProviderExtend.h
@@ -52,17 +51,17 @@ SET(SurfaceGuiIcon_SVG
Resources/icons/Surface_Workbench.svg
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${SurfaceGui_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(SurfaceGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(FREECAD_USE_PCH)
add_library(SurfaceGui SHARED
${SurfaceGui_SRCS}
${SurfaceGuiIcon_SVG}
)
if(FREECAD_USE_PCH)
target_precompile_headers(SurfaceGui PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_include_directories(
SurfaceGui
PRIVATE

View File

@@ -21,8 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QApplication>
#include <QMessageBox>
#include <sstream>
@@ -31,7 +29,6 @@
#include <GeomAPI_ProjectPointOnCurve.hxx>
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#endif
#include "Mod/Part/App/PartFeature.h"
#include <App/Document.h>

View File

@@ -1,23 +0,0 @@
/***************************************************************************
* Copyright (c) 2014 Nathan Miller <Nathan.A.Mill[at]gmail.com> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#include "PreCompiled.h"

View File

@@ -25,8 +25,6 @@
#include <FCConfig.h>
#ifdef _PreComp_
// STL
#include <sstream>
@@ -48,6 +46,4 @@
#include <TopoDS_Edge.hxx>
#include <TopoDS_Shape.hxx>
#endif //_PreComp_
#endif // GUI_PRECOMPILED_H

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QMenu>
#include <QMessageBox>
@@ -32,7 +30,6 @@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#endif
#include <App/Document.h>
#include <Base/Tools.h>

View File

@@ -21,8 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QMessageBox>
#include <QTimer>
@@ -32,7 +30,6 @@
#include <TopTools_IndexedDataMapOfShapeListOfShape.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#include <TopTools_ListIteratorOfListOfShape.hxx>
#endif
#include <App/Document.h>
#include <Base/Tools.h>

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QTimer>
#endif
#include <App/Document.h>
#include <Base/Tools.h>

View File

@@ -21,15 +21,13 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QMenu>
#include <QMessageBox>
#include <QTimer>
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#endif
#include <App/Document.h>
#include <Base/Console.h>

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QMenu>
#include <QMessageBox>
@@ -29,7 +27,6 @@
#include <TopExp.hxx>
#include <TopTools_IndexedMapOfShape.hxx>
#endif
#include <App/Document.h>
#include <Base/Tools.h>

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Gui/BitmapFactory.h>

View File

@@ -21,7 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Gui/MenuManager.h>
#include <Gui/ToolBarManager.h>