ReverseEngineering: 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:33:50 +02:00
parent 93830929ae
commit 914f6bec44
21 changed files with 19 additions and 103 deletions

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <Geom_BSplineSurface.hxx>
#include <TColgp_Array1OfPnt.hxx>
#endif
#include <Base/Console.h>
#include <Base/Converter.h>

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QFuture>
#include <QFutureWatcher>
#include <QtConcurrentMap>
@@ -30,7 +28,6 @@
#include <Precision.hxx>
#include <math_Gauss.hxx>
#include <math_Householder.hxx>
#endif
#include <Base/Sequencer.h>
#include <Base/Tools.h>

View File

@@ -20,9 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#if defined(HAVE_PCL_OPENNURBS)
#ifndef _PreComp_
#include <map>
#include <Geom_BSplineSurface.hxx>
@@ -30,7 +28,6 @@
#include <TColStd_Array1OfReal.hxx>
#include <TColStd_Array2OfReal.hxx>
#include <TColgp_Array2OfPnt.hxx>
#endif
#include <Mod/Points/App/PointsPy.h>

View File

@@ -48,18 +48,17 @@ SET(Reen_SRCS
Segmentation.h
SurfaceTriangulation.cpp
SurfaceTriangulation.h
PreCompiled.cpp
PreCompiled.h
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${Reen_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(ReverseEngineering PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(FREECAD_USE_PCH)
add_library(ReverseEngineering SHARED ${Reen_SRCS})
if(FREECAD_USE_PCH)
target_precompile_headers(ReverseEngineering PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_include_directories(
ReverseEngineering
PRIVATE

View File

@@ -1,23 +0,0 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
* *
* 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

@@ -30,7 +30,6 @@
#define BOOST_BIND_GLOBAL_PLACEHOLDERS
#endif
#ifdef _PreComp_
// standard
#include <map>
@@ -50,5 +49,4 @@
#include <QFutureWatcher>
#include <QtConcurrentMap>
#endif // _PreComp_
#endif

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/math/special_functions/fpclassify.hpp>
#endif
#include <Base/Tools.h>
#include <Mod/Points/App/Points.h>

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/math/special_functions/fpclassify.hpp>
#endif
#include <Base/Exception.h>
#include <Mod/Points/App/Points.h>

View File

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

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Exception.h>
#include <Mod/Mesh/App/Core/Algorithm.h>

View File

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

View File

@@ -39,7 +39,6 @@ SET(ReenGui_SRCS
AppReverseEngineeringGui.cpp
Command.cpp
Resources/ReverseEngineering.qrc
PreCompiled.cpp
PreCompiled.h
Workbench.cpp
Workbench.h
@@ -49,17 +48,17 @@ SET(ReverseEngineeringGuiIcon_SVG
Resources/icons/ReverseEngineeringWorkbench.svg
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${ReenGui_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(ReverseEngineeringGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(FREECAD_USE_PCH)
add_library(ReverseEngineeringGui SHARED
${ReenGui_SRCS}
${ReverseEngineeringGuiIcon_SVG}
)
if(FREECAD_USE_PCH)
target_precompile_headers(ReverseEngineeringGui PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_include_directories(
ReverseEngineeringGui
PRIVATE

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QApplication>
#include <QMessageBox>
#include <limits>
@@ -30,7 +28,6 @@
#include <BRepBuilderAPI_MakePolygon.hxx>
#include <BRep_Builder.hxx>
#include <TopoDS_Compound.hxx>
#endif
#include <App/Application.h>
#include <App/Document.h>

View File

@@ -21,11 +21,9 @@
* *
**************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <algorithm>
#include <QMessageBox>
#endif
#include <Gui/CommandT.h>
#include <Gui/WaitCursor.h>

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QMessageBox>
#include <algorithm>
#endif
#include <App/ComplexGeoData.h>
#include <App/Document.h>

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QMessageBox>
#endif
#include <App/Document.h>
#include <Gui/BitmapFactory.h>

View File

@@ -1,23 +0,0 @@
/***************************************************************************
* Copyright (c) 2008 Jürgen Riegel <juergen.riegel@web.de> *
* *
* 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_
// standard
#include <algorithm>
#include <sstream>
@@ -45,6 +43,4 @@
#include <QMessageBox>
#include <QPushButton>
#endif //_PreComp_
#endif // __PRECOMPILED_GUI__

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#include <BRepBuilderAPI_MakePolygon.hxx>
@@ -31,7 +29,6 @@
#include <Standard_Failure.hxx>
#include <TopoDS_Compound.hxx>
#include <TopoDS_Wire.hxx>
#endif
#include <App/Application.h>
#include <App/Document.h>

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QPushButton>
#endif
#include <App/Document.h>
#include <Gui/Application.h>

View File

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