+ add option to switch off precompiled header

This commit is contained in:
wmayer
2018-07-25 20:17:11 +02:00
parent 08fcd58e9d
commit d3ef6905ff
17 changed files with 49 additions and 28 deletions

View File

@@ -182,6 +182,7 @@ if(MSVC)
OPTION(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." ON)
OPTION(FREECAD_LIBPACK_USEPYSIDE "Use PySide in LibPack rather to PyQt and Swig." ON)
set(FREECAD_LIBPACK_DIR ${CMAKE_SOURCE_DIR} CACHE PATH "Directory of the FreeCAD LibPack")
OPTION(BUILD_USE_PCH "Activate precompiled headers where it's used." ON)
else(MSVC)
OPTION(FREECAD_LIBPACK_USE "Use the LibPack to Build FreeCAD (only Win32 so far)." OFF)
set(FREECAD_LIBPACK_DIR "" CACHE PATH "Directory of the FreeCAD LibPack")

View File

@@ -266,10 +266,10 @@ SET(FreeCADApp_SRCS
PreCompiled.h
)
if(MSVC)
if(BUILD_USE_PCH)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADApp PreCompiled.h PreCompiled.cpp FreeCADApp_CPP_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
add_library(FreeCADApp SHARED ${FreeCADApp_SRCS})

View File

@@ -26,6 +26,7 @@
#include "Material.h"
#include <algorithm>
#include <deque>
#include <string>
#include <vector>

View File

@@ -31,11 +31,17 @@
#pragma warning( disable : 4251 )
#pragma warning( disable : 4273 )
#pragma warning( disable : 4275 )
#pragma warning( disable : 4482 ) // nonstandard extension used: enum 'App::ObjectStatus' used in qualified name
#pragma warning( disable : 4503 )
#pragma warning( disable : 4786 ) // specifier longer then 255 chars
#endif
#ifdef FC_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#endif
#ifdef _PreComp_
// standard
@@ -46,8 +52,6 @@
#ifdef FC_OS_WIN32
#include <direct.h>
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <windows.h>
#include <crtdbg.h>
#endif

View File

@@ -26,6 +26,7 @@
#ifndef _PreComp_
# include <cassert>
# include <algorithm>
# include <functional>
#endif
/// Here the FreeCAD includes sorted by Base,App,Gui......

View File

@@ -370,10 +370,10 @@ else(FREECAD_USE_EXTERNAL_ZIPIOS)
endif(FREECAD_USE_EXTERNAL_ZIPIOS)
if(MSVC)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADBase PreCompiled.h PreCompiled.cpp FreeCADBase_CPP_SRCS)
endif(MSVC)
if(BUILD_USE_PCH)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADBase PreCompiled.h PreCompiled.cpp FreeCADBase_CPP_SRCS)
endif(BUILD_USE_PCH)
add_library(FreeCADBase SHARED ${FreeCADBase_SRCS})

View File

@@ -23,9 +23,12 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <sstream>
# ifdef FC_OS_WIN32
# define _USE_MATH_DEFINES
# endif // FC_OS_WIN32
# include <cmath>
#endif
#include <cmath>
#include "Quantity.h"
#include "Exception.h"
#include "UnitsApi.h"

View File

@@ -1171,7 +1171,6 @@ SET(FreeCADGui_SRCS
)
if(MSVC)
add_definitions(-D_PreComp_)
SET(FreeCADGui_CPP_SRCS
Language/Translator.cpp
propertyeditor/PropertyEditor.cpp
@@ -1196,15 +1195,18 @@ if(MSVC)
${Workbench_CPP_SRCS}
${FreeCADGui_CPP_SRCS}
)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADGui PreCompiled.h PreCompiled.cpp FreeCADGui_CPP_SRCS)
endif(MSVC)
add_library(FreeCADGui SHARED ${FreeCADGui_SRCS})
if (BUILD_USE_PCH)
add_definitions(-D_PreComp_)
ADD_MSVC_PRECOMPILED_HEADER(FreeCADGui PreCompiled.h PreCompiled.cpp FreeCADGui_CPP_SRCS)
endif(BUILD_USE_PCH)
if (FREECAD_USE_QT_FILEDIALOG)
set_source_files_properties(FileDialog.cpp PROPERTIES COMPILE_FLAGS -DUSE_QT_FILEDIALOG)
endif()
add_library(FreeCADGui SHARED ${FreeCADGui_SRCS})
target_link_libraries(FreeCADGui ${FreeCADGui_LIBS})
SET_BIN_DIR(FreeCADGui FreeCADGui)

View File

@@ -23,6 +23,7 @@
#include "PreCompiled.h"
#ifndef _PreComp_
# include <algorithm>
# include <cfloat>
# include "InventorAll.h"
# include <QAction>

View File

@@ -26,7 +26,10 @@
#include <FCConfig.h>
#ifdef _PreComp_
#ifdef FC_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#endif
// here get the warnings of too long specifiers disabled (needed for VC6)
#ifdef _MSC_VER
@@ -37,6 +40,8 @@
#pragma warning( disable : 4786 ) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
// standard
#include <stdio.h>
#include <assert.h>
@@ -47,8 +52,6 @@
#include <limits.h>
#ifdef FC_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#include <Windows.h>
#include <io.h>
#include <shellapi.h>

View File

@@ -80,11 +80,11 @@ SET(Drawing_Templates
Templates/A4_Portrait_plain.svg
)
if(MSVC)
if(BUILD_USE_PCH)
#add_definitions(-D_PreComp_)
#GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Drawing_CPP_SRCS ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS})
#ADD_MSVC_PRECOMPILED_HEADER(Drawing PreCompiled.h PreCompiled.cpp Drawing_CPP_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
add_library(Drawing SHARED ${Drawing_SRCS} ${Features_SRCS} ${DrawingAlgos_SRCS})
target_link_libraries(Drawing ${Drawing_LIBS})

View File

@@ -83,11 +83,11 @@ SET(DrawingGuiTaskDlgs_SRCS
)
SOURCE_GROUP("TaskDialogs" FILES ${DrawingGuiTaskDlgs_SRCS})
if(MSVC)
if(BUILD_USE_PCH)
#add_definitions(-D_PreComp_)
#GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS})
#ADD_MSVC_PRECOMPILED_HEADER(DrawingGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
add_library(DrawingGui SHARED ${DrawingGui_SRCS} ${DrawingGuiView_SRCS} ${DrawingGuiViewProvider_SRCS})
target_link_libraries(DrawingGui ${DrawingGui_LIBS})

View File

@@ -47,11 +47,11 @@ SET(Measure_SRCS
${Python_SRCS}
)
if(MSVC)
if(BUILD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" Measure_CPP_SRCS ${Measure_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Measure PreCompiled.h PreCompiled.cpp Measure_CPP_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
# Set special compiler flag to convert a SIGSEV into an exception
# to handle issue #0000478.

View File

@@ -37,6 +37,11 @@
# define MeshExport
#endif
#ifdef FC_OS_WIN32
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#endif
#ifdef _PreComp_
// standard
@@ -63,4 +68,4 @@
#elif defined(FC_OS_WIN32)
#include <windows.h>
#endif // _PreComp_
#endif
#endif

View File

@@ -361,11 +361,11 @@ SET(Mesh_SRCS
Segment.h
)
if(MSVC)
if(BUILD_USE_PCH)
add_definitions(-D_PreComp_)
GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${Core_SRCS} ${Mesh_SRCS})
ADD_MSVC_PRECOMPILED_HEADER(Mesh PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
add_library(Mesh SHARED ${Core_SRCS} ${WildMagic4_SRCS} ${Mesh_SRCS})
target_link_libraries(Mesh ${Mesh_LIBS})

View File

@@ -162,11 +162,11 @@ SET(TechDraw_LineGroupFile
LineGroup/LineGroup.csv
)
if(MSVC)
if(BUILD_USE_PCH)
#add_definitions(-D_PreComp_)
#GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" TechDrawCPP_SRCS ${TechDraw_SRCS} ${Draw_SRCS} )
#ADD_MSVC_PRECOMPILED_HEADER(TechDraw PreCompiled.h PreCompiled.cpp TechDrawCPP_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
add_library(TechDraw SHARED ${TechDraw_SRCS} ${Draw_SRCS} ${TechDrawAlgos_SRCS}
${Geometry_SRCS} ${Python_SRCS})

View File

@@ -226,11 +226,11 @@ SET(TechDrawGuiTaskDlgs_SRCS
)
SOURCE_GROUP("TaskDialogs" FILES ${TechDrawGuiTaskDlgs_SRCS})
if(MSVC)
if(BUILD_USE_PCH)
#add_definitions(-D_PreComp_)
#GET_MSVC_PRECOMPILED_SOURCE("PreCompiled.cpp" PCH_SRCS ${TechDrawGui_SRCS} ${TechDrawGuiView_SRCS} ${TechDrawGuiViewProvider_SRCS})
#ADD_MSVC_PRECOMPILED_HEADER(TechDrawGui PreCompiled.h PreCompiled.cpp PCH_SRCS)
endif(MSVC)
endif(BUILD_USE_PCH)
add_library(TechDrawGui SHARED ${TechDrawGui_SRCS} ${TechDrawGuiView_SRCS} ${TechDrawGuiViewProvider_SRCS})
target_link_libraries(TechDrawGui ${TechDrawGui_LIBS})