JtReader: 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 17:27:32 +02:00
parent 499742eea2
commit ba03cf1ed6
9 changed files with 9 additions and 32 deletions

View File

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

View File

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

View File

@@ -16,7 +16,6 @@ set(JtReader_LIBS
SET(JtReader_SRCS
AppJtReader.cpp
AppJtReaderPy.cpp
PreCompiled.cpp
PreCompiled.h
TestJtReader.cpp
TestJtReader.h
@@ -48,6 +47,13 @@ SOURCE_GROUP("JrJt" FILES ${JRJT_SRCS} )
SOURCE_GROUP("Module" FILES ${JtReader_SRCS})
add_library(JtReader SHARED ${JtReader_SRCS} ${JRJT_SRCS} ${JtReader_Scripts})
if(FREECAD_USE_PCH)
target_precompile_headers(JtReader PRIVATE
$<$<COMPILE_LANGUAGE:CXX>:"${CMAKE_CURRENT_LIST_DIR}/PreCompiled.h">
)
endif(FREECAD_USE_PCH)
target_link_libraries(JtReader ${JtReader_LIBS})
if (MSVC)

View File

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

View File

@@ -3,13 +3,11 @@
* LGPL *
***************************************************************************/
#include "PreCompiled.h"
#ifndef _PreComp_
#include <string.h>
#include <strstream>
#include <sys/types.h>
#include <vector>
#endif
#include <JtTk/JtkCADExporter.h>
#include <JtTk/JtkCADImporter.h>

View File

@@ -1,7 +0,0 @@
/***************************************************************************
* Copyright (c) Juergen Riegel 2007 <juergen.riegel@web.de> *
* LGPL *
***************************************************************************/
#include "PreCompiled.h"

View File

@@ -8,19 +8,7 @@
#include <FCConfig.h>
// Importing of App classes
#ifdef FC_OS_WIN32
#define MeshExport __declspec(dllimport)
#define AppJtReaderExport __declspec(dllexport)
#else // for Linux
#define MeshExport
#define AppJtReaderExport
#endif
#ifdef _PreComp_
// standard
#include <cassert>
#include <cstdio>
@@ -41,6 +29,4 @@
// sys
#include <sys/types.h>
#endif //_PreComp_
#endif

View File

@@ -21,7 +21,6 @@
* *
**************************************************************************/
#include "PreCompiled.h"
#include <gp_Trsf.hxx>
#include "TKJtReader.h"

View File

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