Robot: 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:22:18 +02:00
parent 68114945fa
commit 63a8d31bb6
62 changed files with 58 additions and 169 deletions

View File

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

View File

@@ -42,7 +42,6 @@ SET(Python_SRCS
SET(Mod_SRCS
AppRobot.cpp
PreCompiled.cpp
PreCompiled.h
)
@@ -74,9 +73,9 @@ SET(Robot_SRCS
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${Robot_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Robot PreCompiled.h PreCompiled.cpp PCH_SRCS)
target_precompile_headers(Robot PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
# FIXME: The bundled KDL has some extensions which makes it incompatible

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <BRepAdaptor_Curve.hxx>
#include <CPnts_AbscissaPoint.hxx>
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#endif
#include <Base/Sequencer.h>
#include <Mod/Part/App/PartFeature.h>

View File

@@ -25,6 +25,8 @@
#include <App/PropertyGeo.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TrajectoryObject.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,19 +25,6 @@
#include <FCConfig.h>
// Exporting of App classes
#ifdef FC_OS_WIN32
#define RobotExport __declspec(dllexport)
#define PartExport __declspec(dllimport)
#define MeshExport __declspec(dllimport)
#else // for Linux
#define RobotExport
#define PartExport
#define MeshExport
#endif
#ifdef _PreComp_
// STL
#include <memory>
#include <sstream>
@@ -63,5 +50,4 @@
#include <TopoDS.hxx>
#include <TopoDS_Edge.hxx>
#endif // _PreComp_
#endif

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include <Base/Reader.h>
#include <Base/Writer.h>

View File

@@ -26,6 +26,8 @@
#include <App/Property.h>
#include <Base/BoundBox.h>
#include <Mod/Robot/RobotGlobal.h>
#include "Trajectory.h"

View File

@@ -20,12 +20,10 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include "kdl_cp/chainfksolverpos_recursive.hpp"
#include "kdl_cp/chainiksolverpos_nr_jl.hpp"
#include "kdl_cp/chainiksolvervel_pinv.hpp"
#endif
#include <Base/FileInfo.h>
#include <Base/Reader.h>

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <sstream>
#endif
#include <Base/MatrixPy.h>
#include <Base/PlacementPy.h>

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include "kdl_cp/chainfksolverpos_recursive.hpp"
#include "kdl_cp/chainiksolverpos_nr.hpp"
#include "kdl_cp/chainiksolvervel_pinv.hpp"
#include "kdl_cp/frames_io.hpp"
#endif
#include "RobotAlgos.h"

View File

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

View File

@@ -26,6 +26,8 @@
#include <App/GeoFeature.h>
#include <App/PropertyFile.h>
#include <Mod/Robot/RobotGlobal.h>
#include "Robot6Axis.h"

View File

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

View File

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

View File

@@ -25,6 +25,8 @@
#include <Base/Placement.h>
#include <Mod/Robot/RobotGlobal.h>
#include "Robot6Axis.h"
#include "Trajectory.h"

View File

@@ -20,9 +20,7 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <memory>
#include "kdl_cp/path_line.hpp"
@@ -32,7 +30,6 @@
#include "kdl_cp/trajectory_segment.hpp"
#include "kdl_cp/utilities/error.h"
#include "kdl_cp/velocityprofile_trap.hpp"
#endif
#include <Base/Exception.h>
#include <Base/Reader.h>

View File

@@ -28,6 +28,8 @@
#include <Base/Persistence.h>
#include <Base/Placement.h>
#include <Mod/Robot/RobotGlobal.h>
#include "Waypoint.h"

View File

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

View File

@@ -25,6 +25,8 @@
#include <App/PropertyLinks.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TrajectoryObject.h"

View File

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

View File

@@ -26,6 +26,8 @@
#include <App/PropertyGeo.h>
#include <App/PropertyUnits.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TrajectoryObject.h"

View File

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

View File

@@ -26,6 +26,8 @@
#include <App/GeoFeature.h>
#include <App/PropertyGeo.h>
#include <Mod/Robot/RobotGlobal.h>
#include "PropertyTrajectory.h"
#include "Trajectory.h"

View File

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

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include "kdl_cp/chain.hpp"
#endif
#include <Base/Reader.h>
#include <Base/Writer.h>

View File

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

View File

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

View File

@@ -23,7 +23,6 @@ set(RobotGui_UIC_SRCS
SET(RobotGui_SRCS_Module
AppRobotGui.cpp
Resources/Robot.qrc
PreCompiled.cpp
PreCompiled.h
Workbench.cpp
Workbench.h
@@ -101,18 +100,18 @@ SET(RobotGui_SRCS
${RobotGui_SRCS_TaskDlg}
)
if(FREECAD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${RobotGui_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(RobotGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(FREECAD_USE_PCH)
SET(RobotGuiIcon_SVG
Resources/icons/RobotWorkbench.svg
)
add_library(RobotGui SHARED ${RobotGui_SRCS} ${RobotGuiIcon_SVG})
if(FREECAD_USE_PCH)
target_precompile_headers(RobotGui PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_include_directories(
RobotGui
PRIVATE

View File

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

View File

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

View File

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

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QInputDialog>
#include <QMessageBox>
#endif
#include <Gui/Application.h>
#include <Gui/Command.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,21 +25,6 @@
#include <FCConfig.h>
// Importing of App classes
#ifdef FC_OS_WIN32
#define RobotExport __declspec(dllimport)
#define PartExport __declspec(dllimport)
#define PartGuiExport __declspec(dllimport)
#define RobotGuiExport __declspec(dllexport)
#else // for Linux
#define PartExport
#define RobotExport
#define PartGuiExport
#define RobotGuiExport
#endif
#ifdef _PreComp_
// STL
#include <sstream>
@@ -71,6 +56,4 @@
#include <Inventor/nodes/SoMarkerSet.h>
#include <Inventor/nodes/SoSeparator.h>
#endif //_PreComp_
#endif // ROBOTGUI_PRECOMPILED_H

View File

@@ -20,10 +20,8 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QApplication>
#endif
#include <Base/Console.h>
#include <Base/Exception.h>

View File

@@ -26,6 +26,8 @@
#include <Gui/TaskView/TaskDialog.h>
#include <Mod/Robot/App/Edge2TracObject.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TaskEdge2TracParameter.h"

View File

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

View File

@@ -26,6 +26,7 @@
#include <Gui/TaskView/TaskDialog.h>
#include <Mod/Robot/App/RobotObject.h>
#include <Mod/Robot/App/TrajectoryObject.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TaskRobot6Axis.h"
#include "TaskRobotControl.h"

View File

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

View File

@@ -24,6 +24,8 @@
#define ROBOTGUI_TaskDlgTrajectoryCompound_H
#include <Gui/TaskView/TaskDialog.h>
#include <Mod/Robot/RobotGlobal.h>
#include <Mod/Robot/App/TrajectoryCompound.h>

View File

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

View File

@@ -26,6 +26,8 @@
#include <Gui/TaskView/TaskDialog.h>
#include <Mod/Robot/App/TrajectoryDressUpObject.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TaskTrajectoryDressUpParameter.h"

View File

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

View File

@@ -20,11 +20,9 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QString>
#include <qpalette.h>
#endif
#include <Gui/BitmapFactory.h>
#include <Gui/Placement.h>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -25,6 +25,8 @@
#include <Gui/TaskView/TaskWatcher.h>
#include <Mod/Robot/RobotGlobal.h>
#include "TaskRobot6Axis.h"
#include "TaskRobotControl.h"

View File

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

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Gui/Control.h>
#include <Mod/Robot/Gui/TaskDlgEdge2Trac.h>

View File

@@ -24,6 +24,8 @@
#ifndef ROBOT_VIEWPROVIDEREDGE2TRACOBJECT_H
#define ROBOT_VIEWPROVIDEREDGE2TRACOBJECT_H
#include <Mod/Robot/RobotGlobal.h>
#include "ViewProviderTrajectory.h"
namespace RobotGui

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QFile>
#include <sstream>
@@ -32,7 +30,6 @@
#include <Inventor/actions/SoSearchAction.h>
#include <Inventor/draggers/SoJackDragger.h>
#include <Inventor/nodes/SoSeparator.h>
#endif
#include <Base/Tools.h>
#include <App/Document.h>

View File

@@ -20,8 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QAction>
#include <QMenu>
#include <sstream>
@@ -32,7 +30,6 @@
#include <Inventor/nodes/SoLineSet.h>
#include <Inventor/nodes/SoMarkerSet.h>
#include <Inventor/nodes/SoSeparator.h>
#endif
#include <App/Application.h>
#include <App/Document.h>

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Gui/Control.h>
#include <Mod/Robot/App/TrajectoryCompound.h>

View File

@@ -24,6 +24,8 @@
#ifndef ROBOT_ViewProviderTrajectoryCompound_H
#define ROBOT_ViewProviderTrajectoryCompound_H
#include <Mod/Robot/RobotGlobal.h>
#include "ViewProviderTrajectory.h"
namespace RobotGui

View File

@@ -20,7 +20,6 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#include <Gui/Control.h>
#include <Mod/Robot/Gui/TaskDlgTrajectoryDressUp.h>

View File

@@ -24,6 +24,8 @@
#ifndef ROBOT_ViewProviderTrajectoryDressUp_H
#define ROBOT_ViewProviderTrajectoryDressUp_H
#include <Mod/Robot/RobotGlobal.h>
#include "ViewProviderTrajectory.h"
namespace RobotGui

View File

@@ -20,13 +20,11 @@
* *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <QDir>
#include <QFileInfo>
#include <QMessageBox>
#include <qobject.h>
#endif
#include <App/Application.h>
#include <Gui/Control.h>

View File

@@ -20,11 +20,10 @@
* *
***************************************************************************/
#include <FCGlobal.h>
#ifndef ROBOT_GLOBAL_H
#define ROBOT_GLOBAL_H
#include <FCGlobal.h>
// Robot
#ifndef RobotExport