#5459 Build System : Add optional support for precompiled headers

This commit is contained in:
Magne Sjaastad 2020-02-03 22:17:46 +01:00
parent a85745cb91
commit 6db2da7561
2 changed files with 48 additions and 1 deletions

View File

@ -7,7 +7,6 @@ if(RESINSIGHT_ENABLE_UNITY_BUILD)
set(CMAKE_UNITY_BUILD true)
endif()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations")
endif()
@ -387,6 +386,16 @@ endif(RESINSIGHT_ENABLE_GRPC)
add_executable( ResInsight ${EXE_FILES})
option(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS "Use Precompiled Headers" OFF)
mark_as_advanced(FORCE RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
if(RESINSIGHT_ENABLE_PRECOMPILED_HEADERS)
message("Precompiled Headers is enabled on : ${PROJECT_NAME}")
target_precompile_headers(ResInsight PRIVATE pch.h)
set_source_files_properties(${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
endif()
if (MSVC)
# The following warnings are supposed to be used in ResInsight, but temporarily disabled to avoid too much noise
# warning C4245: 'return': conversion from 'int' to 'size_t', signed/unsigned mismatch

38
ApplicationCode/pch.h Normal file
View File

@ -0,0 +1,38 @@
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2019- Equinor ASA
//
// ResInsight is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// ResInsight 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 General Public License at <http://www.gnu.org/licenses/gpl.html>
// for more details.
//
/////////////////////////////////////////////////////////////////////////////////
#include "cvfMath.h"
#include "cvfObject.h"
#include "cvfVector3.h"
#include "cafAppEnum.h"
#include "cafCmdFeature.h"
#include "cafPdmField.h"
#include "cafPdmObject.h"
#include "cafSelectionManager.h"
#include <QApplication>
#include <QString>
#include <map>
#include <vector>
#include "RiaApplication.h"
#include "RiaPreferences.h"
#include "RiuMainWindow.h"
#include "RiuPlotMainWindow.h"