Points: 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-13 17:29:53 +02:00
parent 4400cb2bec
commit 52d94684c7
22 changed files with 21 additions and 101 deletions

View File

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

View File

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

View File

@@ -49,7 +49,6 @@ SET(Points_SRCS
PointsFeature.h
PointsGrid.cpp
PointsGrid.h
PreCompiled.cpp
PreCompiled.h
Properties.cpp
Properties.h
@@ -65,9 +64,9 @@ set(Points_Scripts
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${Points_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Points PreCompiled.h PreCompiled.cpp PCH_SRCS)
target_precompile_headers(Points PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_sources(Points PRIVATE ${Points_SRCS} ${Points_Scripts})

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QtConcurrentMap>
#include <boost/math/special_functions/fpclassify.hpp>
#include <cmath>
#include <iostream>
#endif
#include <Base/Matrix.h>
#include <Base/Stream.h>

View File

@@ -20,8 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <FCConfig.h>
#ifdef FC_OS_LINUX
#include <unistd.h>
#endif
@@ -32,7 +32,6 @@
#include <boost/lexical_cast.hpp>
#include <boost/math/special_functions/fpclassify.hpp> // needed for compilation on some systems
#include <boost/regex.hpp>
#endif
#include <Base/Console.h>
#include <Base/Converter.h>

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <vector>
#endif
#include "PointsFeature.h"

View File

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

View File

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

View File

@@ -1,24 +0,0 @@
/***************************************************************************
* Copyright (c) 2002 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 <cstdio>
@@ -48,6 +46,4 @@
// Qt
#include <QtConcurrentMap>
#endif //_PreComp_
#endif

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QtConcurrentMap>
#include <algorithm>
#include <cmath>
#include <iostream>
#endif
#include <Base/Converter.h>
#include <Base/Matrix.h>

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <algorithm>
#include <cmath>
#include <iostream>
#endif
#include <Base/Matrix.h>
#include <Base/Writer.h>

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <vector>
#endif
#include "Structured.h"

View File

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

View File

@@ -32,7 +32,6 @@ SET(PointsGui_SRCS
${Resource_SRCS}
AppPointsGui.cpp
Command.cpp
PreCompiled.cpp
PreCompiled.h
ViewProvider.cpp
ViewProvider.h
@@ -48,18 +47,18 @@ SET(PointsGuiIcon_SVG
Resources/icons/PointsWorkbench.svg
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${PointsGui_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(PointsGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(FREECAD_USE_PCH)
add_library(PointsGui SHARED
${PointsGui_SRCS}
${PointsGui_Scripts}
${PointsGuiIcon_SVG}
)
if(FREECAD_USE_PCH)
target_precompile_headers(PointsGui PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_include_directories(
PointsGui
PRIVATE

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <Inventor/events/SoMouseButtonEvent.h>
#include <QInputDialog>
#include <QMessageBox>
#include <algorithm>
#endif
#include <App/Application.h>
#include <App/Document.h>

View File

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

View File

@@ -23,6 +23,8 @@
#ifndef POINTSGUI_DLGREADPOINTS_H
#define POINTSGUI_DLGREADPOINTS_H
#include <FCGlobal.h>
#include <QDialog>
#include <memory>

View File

@@ -1,24 +0,0 @@
/***************************************************************************
* Copyright (c) 2002 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,7 +25,6 @@
#include <FCConfig.h>
#ifdef _PreComp_
// STL
#include <algorithm>
@@ -53,6 +52,4 @@
#include <Inventor/nodes/SoNormal.h>
#include <Inventor/nodes/SoPointSet.h>
#endif //_PreComp_
#endif // POINTSGUI_PRECOMPILED_H

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/math/special_functions/fpclassify.hpp>
#include <limits>
@@ -35,7 +33,6 @@
#include <Inventor/nodes/SoMaterialBinding.h>
#include <Inventor/nodes/SoNormal.h>
#include <Inventor/nodes/SoPointSet.h>
#endif
#include <App/Document.h>
#include <Base/Vector3D.h>

View File

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