CAM: 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 23:36:45 +02:00
parent b15f3c1155
commit b864ccda60
54 changed files with 32 additions and 226 deletions

View File

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

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRep_Tool.hxx>
#include <BRepAdaptor_Curve.hxx>
#include <gp_Circ.hxx>
@@ -31,7 +29,7 @@
#include <TopoDS_Shape.hxx>
#include <TopoDS_Vertex.hxx>
#include <TopExp_Explorer.hxx>
#endif
#include <App/Application.h>
#include <App/Document.h>

View File

@@ -20,12 +20,10 @@
* *
****************************************************************************/
#include "PreCompiled.h"
// From Boost 1.75 on the geometry component requires C++14
#define BOOST_GEOMETRY_DISABLE_DEPRECATED_03_WARNING
#ifndef _PreComp_
#include <limits>
#include <boost/geometry.hpp>
@@ -67,7 +65,6 @@
#include <TopExp_Explorer.hxx>
#include <TopoDS_Compound.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#endif
#include <App/Application.h>
#include <App/Document.h>

View File

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

View File

@@ -42,7 +42,6 @@ SET(Python_SRCS
SET(Mod_SRCS
AppPath.cpp
AppPathPy.cpp
PreCompiled.cpp
PreCompiled.h
)
@@ -128,9 +127,9 @@ endif()
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Path_CPP_SRCS ${Path_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Path PreCompiled.h PreCompiled.cpp Path_CPP_SRCS)
target_precompile_headers(Path PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
SET_BIN_DIR(Path PathApp /Mod/CAM)

View File

@@ -20,12 +20,10 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cinttypes>
#include <iomanip>
#include <boost/algorithm/string.hpp>
#endif
#include <Base/Exception.h>
#include <Base/Reader.h>

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/algorithm/string.hpp>
#endif
#include <Base/Exception.h>
#include <Base/PlacementPy.h>

View File

@@ -20,12 +20,10 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRep_Builder.hxx>
#include <Precision.hxx>
#include <TopoDS_Compound.hxx>
#endif
#include <Base/Console.h> // for FC_LOG_LEVEL_INIT
#include <Base/Placement.h>

View File

@@ -20,7 +20,6 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#include <Base/PyWrapParseTupleAndKeywords.h>
#include <Mod/Part/App/TopoShapePy.h>

View File

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

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "FeaturePathCompound.h"
#include "Command.h"

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of FeaturePathCompoundPy.xml)
#include "FeaturePathCompoundPy.h"

View File

@@ -21,11 +21,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <Standard_Version.hxx>
#include <TopoDS_Shape.hxx>
#endif
#include "FeaturePathShape.h"

View File

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

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "Base/GeometryPyCXX.h"

View File

@@ -19,7 +19,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <vector>

View File

@@ -1,24 +0,0 @@
/***************************************************************************
* Copyright (c) 2014 Yorik van Havre <yorik@uncreated.net> *
* *
* 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,19 +25,6 @@
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
#define PathExport __declspec(dllexport)
// # define RobotExport __declspec(dllexport) uncomment this to use KDL
#define PartExport __declspec(dllimport)
#else // for Linux
#define PathExport
// # define RobotExport uncomment this to use KDL
#define PartExport
#endif
#ifdef _PreComp_
// standard
#include <cinttypes>
#include <iomanip>
@@ -97,5 +84,4 @@
#include <TopExp_Explorer.hxx>
#include <TopTools_HSequenceOfShape.hxx>
#endif // _PreComp_
#endif

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include <App/DocumentObject.h>
#include <App/PropertyContainer.h>

View File

@@ -20,10 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#endif
#include <Base/Vector3D.h>
#include <Base/Tools.h>

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "VoronoiCell.h"

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "Base/Vector3D.h"
#include "Base/VectorPy.h"

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "VoronoiEdge.h"

View File

@@ -20,12 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <limits>
#include <BRepBuilderAPI_MakeEdge.hxx>
#include <Geom_Parabola.hxx>
#endif
#include "Mod/Part/App/Geometry.h"
#include "Mod/Part/App/TopoShapeEdgePy.h"

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "Base/GeometryPyCXX.h"
#include "Base/Vector3D.h"

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "VoronoiVertex.h"

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "Base/Vector3D.h"
#include "Base/VectorPy.h"