App: 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 11:33:00 +02:00
parent f0eca551b3
commit d05e2a0431
96 changed files with 27 additions and 259 deletions
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "Annotation.h"
+1 -3
View File
@@ -21,9 +21,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <FCConfig.h>
#ifndef _PreComp_
# if defined(FC_OS_LINUX) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD)
# include <unistd.h>
# include <pwd.h>
@@ -48,7 +47,6 @@
# include <tuple>
# include <vector>
# include <fmt/format.h>
#endif
#ifdef FC_OS_WIN32
# include <Shlobj.h>
+2 -3
View File
@@ -19,18 +19,17 @@
* *
**************************************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <fmt/format.h>
#include <utility>
#include <QDir>
#include <QProcessEnvironment>
#include <QStandardPaths>
#include <QCoreApplication>
#endif
#include "ApplicationDirectories.h"
#include <FCConfig.h>
#if defined(FC_OS_LINUX) || defined(FC_OS_MACOSX) || defined(FC_OS_BSD)
#include <pwd.h>
#endif
+5
View File
@@ -22,6 +22,7 @@
#ifndef SRC_APP_APPLICATIONDIRECTORIES_H_
#define SRC_APP_APPLICATIONDIRECTORIES_H_
#include "FCConfig.h"
#include "FCGlobal.h"
#include <filesystem>
@@ -29,6 +30,10 @@
#include <string>
#include <vector>
#ifdef FC_OS_WIN32
#include <QString>
#endif
namespace App {
/// A helper class to handle application-wide directory management on behalf of the main
+1 -2
View File
@@ -21,8 +21,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <FCConfig.h>
#include <Base/Console.h>
#include <Base/Exception.h>
-1
View File
@@ -20,7 +20,6 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#include <Base/Interpreter.h>
-4
View File
@@ -21,13 +21,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/algorithm/string/replace.hpp>
#include <boost/regex.hpp>
#include <string>
#endif
#include <Base/TimeInfo.h>
#include <Base/Console.h>
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include <QFile>
+3 -3
View File
@@ -344,13 +344,13 @@ SET(FreeCADApp_SRCS
${FreeCADApp_Pyi_SRCS}
FreeCADInit.py
FreeCADTest.py
PreCompiled.cpp
PreCompiled.h
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADApp PreCompiled.h PreCompiled.cpp FreeCADApp_CPP_SRCS)
target_precompile_headers(FreeCADApp PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_sources(FreeCADApp PRIVATE ${FreeCADApp_SRCS})
-1
View File
@@ -21,7 +21,6 @@
* *
**************************************************************************/
#include "PreCompiled.h"
#include <list>
#include "CleanupProcess.h"
-4
View File
@@ -20,11 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cstdlib>
#endif
#include <Base/Exception.h>
-5
View File
@@ -23,13 +23,8 @@
* *
***************************************************************************/
#include "PreCompiled.h" // NOLINT
#ifndef _PreComp_
#include <cstdlib>
#include <limits>
#endif
#include <boost/regex.hpp>
-4
View File
@@ -20,11 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <memory>
#endif
#include "ComplexGeoData.h"
#include "StringHasher.h"
-3
View File
@@ -21,10 +21,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <string>
#endif
#include <App/Document.h>
#include <Base/Exception.h>
+2 -4
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <bitset>
#include <stack>
#include <deque>
@@ -36,7 +33,6 @@
#include <list>
#include <algorithm>
#include <filesystem>
#endif
#include <boost/algorithm/string.hpp>
#include <boost/bimap.hpp>
@@ -50,6 +46,8 @@
#include <QCryptographicHash>
#include <QCoreApplication>
#include <FCConfig.h>
#include <App/DocumentPy.h>
#include <Base/Interpreter.h>
#include <Base/Console.h>
-4
View File
@@ -21,16 +21,12 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <stack>
#include <memory>
#include <map>
#include <set>
#include <vector>
#include <string>
#endif
#include <Base/Console.h>
#include <Base/Matrix.h>
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "DocumentObjectExtension.h"
#include "DocumentObjectExtensionPy.h"
#include "DocumentObject.h"
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of PropertyContainerPy.xml)
#include "DocumentObjectExtensionPy.h"
#include "DocumentObjectExtensionPy.cpp"
-2
View File
@@ -21,8 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "DocumentObjectFileIncluded.h"
using namespace App;
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "DocumentObjectGroup.h"
#include "DocumentObjectGroupPy.h"
#include "FeaturePythonPyImp.h"
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "DocumentObjectGroup.h"
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/GeometryPyCXX.h>
#include <Base/MatrixPy.h>
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Tools.h>
#include "Application.h"
-4
View File
@@ -20,11 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <functional>
#endif
#include <CXX/Objects.hxx>
#include "Application.h"
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/FileInfo.h>
#include <Base/Interpreter.h>
#include <Base/Stream.h>
-4
View File
@@ -20,13 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <map>
#include <vector>
#include <string>
#endif
#include <Base/Reader.h>
#include <Base/Tools.h>
-3
View File
@@ -1,10 +1,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
#include <unordered_map>
#ifndef FC_DEBUG
#include <random>
#endif
#endif
#include "ElementMap.h"
#include "ElementNamingUtils.h"
-1
View File
@@ -1,4 +1,3 @@
#include "PreCompiled.h"
#include "ElementNamingUtils.h"
#include <boost/algorithm/string/predicate.hpp>
-3
View File
@@ -20,11 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cassert>
#include <cstring>
#endif
#include <Base/Exception.h>
#include "Enumeration.h"
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifdef __GNUC__
# include <unistd.h>
#endif
-3
View File
@@ -20,11 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <string>
#include <tuple>
#endif
#include "ExpressionParser.h"
#include "ExpressionTokenizer.h"
-5
View File
@@ -20,15 +20,10 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cassert>
#include <vector>
#include <map>
#include <string>
#endif
#include <Base/PyObjectBase.h>
-4
View File
@@ -20,13 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <map>
#include <vector>
#include <string>
#endif
#include <Base/Console.h>
#include <Base/Exception.h>
-5
View File
@@ -20,12 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include "Application.h"
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ExtensionContainer.h"
// inclusion of the generated files (generated out of ExtensionPy.pyi)
-4
View File
@@ -20,11 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include <App/DocumentObjectPy.h>
#include <Base/Interpreter.h>
-3
View File
@@ -21,11 +21,8 @@
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/core/ignore_unused.hpp>
#include <sstream>
#endif
#include <Base/Console.h>
#include <Base/Exception.h>
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <App/GeoFeaturePy.h>
#include <Base/Tools.h>
-3
View File
@@ -21,9 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <App/Document.h>
#include <Base/Tools.h>
@@ -22,7 +22,6 @@
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of GeoFeatureGroupExtensionPy.xml)
#include "GeoFeatureGroupExtensionPy.h"
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of GeoFeaturePy.xml)
#include "GeoFeaturePy.h"
#include "GeoFeaturePy.cpp"
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <boost/graph/graphviz.hpp>
#include <random>
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Tools.h>
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "DocumentObject.h"
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "ImagePlane.h"
-3
View File
@@ -23,12 +23,9 @@
***************************************************************************/
// NOLINTNEXTLINE
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cstdlib>
#include <unordered_set>
#endif
#include "IndexedName.h"
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "InventorObject.h"
#include "DocumentObjectPy.h"
-4
View File
@@ -20,11 +20,7 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <limits>
#endif
#include <boost/algorithm/string/predicate.hpp>
#include <boost/range.hpp>
-4
View File
@@ -20,11 +20,7 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include "DocumentObjectPy.h"
#include "LinkBaseExtensionPy.h"
-5
View File
@@ -20,13 +20,8 @@
* *
**************************************************************************************************/
// NOLINTNEXTLINE
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cstdlib>
#include <unordered_set>
#endif
#include "DocumentObject.h"
#include "MappedElement.h"
-4
View File
@@ -20,11 +20,7 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <unordered_set>
#endif
#include "MappedName.h"
-5
View File
@@ -20,13 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cstring>
#include <random>
#endif
#include "Application.h"
#include "Material.h"
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "MaterialObject.h"
-2
View File
@@ -21,8 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of MaterialPy.xml)
#include "MaterialPy.h"
+1 -1
View File
@@ -19,7 +19,7 @@
* <https://www.gnu.org/licenses/>. *
* *
**************************************************************************/
#include "PreCompiled.h"
#include <Base/Console.h>
#include <Base/Interpreter.h>
#include <Base/VectorPy.h>
-1
View File
@@ -20,7 +20,6 @@
* *
**************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of MeasureManagerPy.xml)
#include "MeasureManagerPy.h"
-3
View File
@@ -20,10 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <stack>
#endif
#include <QCoreApplication>
#include <zipios++/zipinputstream.h>
+2 -4
View File
@@ -20,19 +20,17 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/core/ignore_unused.hpp>
#include <memory>
#include <sstream>
#endif
#include <xercesc/framework/LocalFileFormatTarget.hpp>
#include <xercesc/framework/LocalFileInputSource.hpp>
#include <xercesc/framework/MemBufInputSource.hpp>
#include <xercesc/sax/HandlerBase.hpp>
#include <FCConfig.h>
#include "App/Application.h"
#include "App/Expression.h"
#include "Base/XMLTools.h"
-1
View File
@@ -20,7 +20,6 @@
* *
**************************************************************************/
#include "PreCompiled.h"
#include "Metadata.h"
-4
View File
@@ -20,12 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cassert>
#include <limits>
#endif
#include <boost/algorithm/string/predicate.hpp>
-1
View File
@@ -21,7 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <App/Document.h>
#include <Base/Placement.h>
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <App/Document.h>
#include <Base/Console.h>
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of OriginGroupPy.xml)
#include "OriginGroupExtensionPy.h"
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include <App/DocumentObject.h>
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
// inclusion of the generated files (generated out of PartPy.xml)
#include "PartPy.h"
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "Path.h"
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Placement.h>
-24
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"
-4
View File
@@ -25,8 +25,6 @@
#include <FCConfig.h>
#ifdef _PreComp_
// standard
#include <cassert>
#include <csignal>
@@ -92,6 +90,4 @@
#include <QStandardPaths>
#include <QString>
#endif //_PreComp_
#endif // APP_PRECOMPILED_H
+2
View File
@@ -24,6 +24,8 @@
#ifndef PROGRAMOPTIONSUTILITIES_H
#define PROGRAMOPTIONSUTILITIES_H
#include <FCConfig.h>
#include <algorithm>
#include <array>
#include <string>
-1
View File
@@ -22,7 +22,6 @@
**************************************************************************/
#include "PreCompiled.h"
#include <cassert>
#include <xercesc/util/PlatformUtils.hpp>
-5
View File
@@ -20,12 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cassert>
#endif
#include <atomic>
#include <Base/Tools.h>
-4
View File
@@ -20,13 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <map>
#include <vector>
#include <string>
#endif
#include <Base/Console.h>
#include <Base/Exception.h>
-5
View File
@@ -20,12 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include "PropertyContainer.h"
#include "Property.h"
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <App/Application.h>
#include <App/Document.h>
+6 -1
View File
@@ -24,12 +24,17 @@
#define EXPRESSIONENGINE_H
#include <functional>
#include <set>
#include <boost/unordered/unordered_map.hpp>
#include <boost/signals2.hpp>
#include <boost_graph_adjacency_list.hpp>
#include <boost/graph/topological_sort.hpp>
#include <FCConfig.h>
#include <App/PropertyLinks.h>
#include <set>
namespace Base
{
-2
View File
@@ -21,8 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Console.h>
#include <Base/PyObjectBase.h>
#include <Base/Reader.h>
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/MatrixPy.h>
#include <Base/PlacementPy.h>
#include <Base/Reader.h>
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <QDir>
#include <QFileInfo>
#include <boost/algorithm/string/predicate.hpp>
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include <iostream>
#include <boost/regex.hpp>
-4
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <algorithm>
#include <set>
#include <limits>
@@ -31,7 +28,6 @@
#include <map>
#include <string>
#include <vector>
#endif
#include <boost/algorithm/string/predicate.hpp>
#include <boost/math/special_functions/round.hpp>
-3
View File
@@ -20,10 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <limits>
#endif
#include <Base/QuantityPy.h>
#include <Base/UnitPy.h>
-3
View File
@@ -20,15 +20,12 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <boost/regex.hpp>
#include <cassert>
#include <sstream>
#include <string>
#include <cmath>
#include <regex>
#endif
#include <string_view>
#include <Base/Exception.h>
-1
View File
@@ -21,7 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <QTemporaryDir>
-2
View File
@@ -21,8 +21,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "Services.h"
std::optional<Base::Vector3d>
-1
View File
@@ -20,7 +20,6 @@
* *
**************************************************************************************************/
#include "PreCompiled.h"
#include <QCryptographicHash>
#include <QHash>
-1
View File
@@ -20,7 +20,6 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#include "StringHasher.h"
-1
View File
@@ -20,7 +20,6 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#include "StringHasher.h"
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Base/Tools.h>
-1
View File
@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "DocumentObject.h"
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "TextDocument.h"
#include "DocumentObject.h"
-1
View File
@@ -21,7 +21,6 @@
***************************************************************************/
#include "PreCompiled.h"
#include "TransactionalObject.h"
#include "Document.h"
-5
View File
@@ -21,12 +21,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <cassert>
#endif
#include <atomic>
#include <Base/Console.h>
-3
View File
@@ -20,9 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include "VRMLObject.h"
#include "Document.h"
#include "DocumentObjectPy.h"
-4
View File
@@ -20,11 +20,7 @@
* *
****************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <iostream>
#endif
#include "VarSet.h"
#include "DocumentObject.h"
+2
View File
@@ -23,6 +23,8 @@
#include <gtest/gtest.h>
#include <FCConfig.h>
#include <Base/Writer.h>
#include <Base/Reader.h>
#include <Base/Interpreter.h>