mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Merge pull request #5371 from OPM/unity-support
Add support for CMake Unity Build
This commit is contained in:
commit
dc4d4e0fa2
@ -5,16 +5,15 @@ branches:
|
||||
image: Visual Studio 2017
|
||||
clone_depth: 1
|
||||
environment:
|
||||
QT5: C:\Qt\5.10.1\msvc2017_64
|
||||
configuration: Release
|
||||
QT5: C:\Qt\5.13.2\msvc2017_64
|
||||
build_script:
|
||||
- cmd: >-
|
||||
mkdir cmakebuild
|
||||
|
||||
|
||||
cd cmakebuild
|
||||
|
||||
if exist "%QT5%" set Path=%QT5%\bin;%Path%
|
||||
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_INCLUDE_APPLICATION_UNIT_TESTS=true -DRESINSIGHT_ENABLE_COTIRE=on "-DCMAKE_PREFIX_PATH=%QT5%" ..
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release -DRESINSIGHT_ENABLE_UNITY_BUILD=on "-DCMAKE_PREFIX_PATH=%QT5%" ..
|
||||
|
||||
cmake --build . --target ResInsight_unity --config Release
|
||||
cmake --build . --target ResInsight --config Release
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (ApplicationCode)
|
||||
|
||||
if(RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated -Wno-deprecated-declarations")
|
||||
endif()
|
||||
@ -455,40 +461,41 @@ target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
||||
|
||||
|
||||
#############################################################################
|
||||
# cotire
|
||||
# cotire and unity builds
|
||||
#############################################################################
|
||||
|
||||
set( UNITY_EXCLUDE_FILES
|
||||
# forever is used as variable name, and this symbol is defined by Qt and used in precompiled headers
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
|
||||
|
||||
# multiple QRC files are not supported
|
||||
qrc_cafAnimControl.cxx
|
||||
qrc_ResInsight.cxx
|
||||
|
||||
# mix of cvf and Qt namespaces
|
||||
ModelVisualization/GridBox/RivGridBoxGenerator.cpp
|
||||
ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp
|
||||
|
||||
# exclude file using Eigen
|
||||
ReservoirDataModel/RigCellGeometryTools.cpp
|
||||
ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp
|
||||
ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp
|
||||
ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp
|
||||
|
||||
# exclude file using SolveSpace
|
||||
Application/Tools/WellPathTools/RiaSCurveCalculator.cpp
|
||||
|
||||
# QT 5
|
||||
qrc_cafAnimControl.cpp
|
||||
qrc_ResInsight.cpp
|
||||
qrc_cafCommandFeatures.cpp
|
||||
ProjectDataModel/RimContourMapView.cpp
|
||||
Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp
|
||||
)
|
||||
|
||||
if(RESINSIGHT_ENABLE_COTIRE)
|
||||
|
||||
set( COTIRE_EXCLUDE_FILES
|
||||
# forever is used as variable name, and this symbol is defined by Qt and used in precompiled headers
|
||||
${ResInsight_SOURCE_DIR}/ThirdParty/gtest/gtest-all.cc
|
||||
|
||||
# multiple QRC files are not supported
|
||||
qrc_cafAnimControl.cxx
|
||||
qrc_ResInsight.cxx
|
||||
|
||||
# mix of cvf and Qt namespaces
|
||||
ModelVisualization/GridBox/RivGridBoxGenerator.cpp
|
||||
ModelVisualization/Intersections/RivIntersectionGeometryGenerator.cpp
|
||||
|
||||
# exclude file using Eigen
|
||||
ReservoirDataModel/RigCellGeometryTools.cpp
|
||||
ReservoirDataModel/Completions/RigTransmissibilityCondenser.cpp
|
||||
ReservoirDataModel/Completions/RigEclipseToStimPlanCellTransmissibilityCalculator.cpp
|
||||
ReservoirDataModel/Completions/RigEclipseToStimPlanCalculator.cpp
|
||||
|
||||
# exclude file using SolveSpace
|
||||
Application/Tools/WellPathTools/RiaSCurveCalculator.cpp
|
||||
|
||||
# QT 5
|
||||
qrc_cafAnimControl.cpp
|
||||
qrc_ResInsight.cpp
|
||||
qrc_cafCommandFeatures.cpp
|
||||
ProjectDataModel/RimContourMapView.cpp
|
||||
Commands/CompletionExportCommands/RicExportFractureCompletionsImpl.cpp
|
||||
)
|
||||
|
||||
foreach (fileToExclude ${COTIRE_EXCLUDE_FILES})
|
||||
foreach (fileToExclude ${UNITY_EXCLUDE_FILES})
|
||||
set_source_files_properties (${fileToExclude} PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
endforeach(fileToExclude)
|
||||
|
||||
@ -508,7 +515,11 @@ if(RESINSIGHT_ENABLE_COTIRE)
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
if(RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
foreach (fileToExclude ${UNITY_EXCLUDE_FILES})
|
||||
set_source_files_properties (${fileToExclude} PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
endforeach(fileToExclude)
|
||||
endif()
|
||||
|
||||
#############################################################################
|
||||
# Copy Dlls on MSVC
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (RigGeoMechDataModel)
|
||||
|
||||
# Unity Build
|
||||
if (RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
add_library( ${PROJECT_NAME}
|
||||
RigFemPart.h
|
||||
RigFemPart.cpp
|
||||
@ -26,10 +32,10 @@ add_library( ${PROJECT_NAME}
|
||||
RigFemPartGrid.cpp
|
||||
RigFemResultAddress.h
|
||||
RigFemResultPosEnum.h
|
||||
RimFemResultObserver.h
|
||||
RimFemResultObserver.cpp
|
||||
RimGeoMechGeometrySelectionItem.h
|
||||
RimGeoMechGeometrySelectionItem.cpp
|
||||
RimFemResultObserver.h
|
||||
RimFemResultObserver.cpp
|
||||
RimGeoMechGeometrySelectionItem.h
|
||||
RimGeoMechGeometrySelectionItem.cpp
|
||||
)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (RifOdbReader)
|
||||
|
||||
# Unity Build
|
||||
if (RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
add_definitions(-DHKS_NT)
|
||||
add_definitions(-DABQ_WIN86_64)
|
||||
|
@ -59,11 +59,19 @@ include (ResInsightVersion.cmake)
|
||||
find_package(Octave)
|
||||
|
||||
################################################################################
|
||||
# cotire
|
||||
# cotire and CMake Unity Build
|
||||
# Fully automated CMake module for build speedup
|
||||
# https://github.com/sakra/cotire
|
||||
################################################################################
|
||||
|
||||
# CMAKE_UNITY_BUILD was introduced in CMake 3.16.2
|
||||
option(RESINSIGHT_ENABLE_UNITY_BUILD "Experimental speedup of compilation using CMake Unity Build" OFF)
|
||||
mark_as_advanced(FORCE RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
if(RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
set(CAF_ENABLE_UNITY_BUILD true)
|
||||
set(CVF_ENABLE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
option(RESINSIGHT_ENABLE_COTIRE "Experimental speedup of compilation using cotire" OFF)
|
||||
mark_as_advanced(FORCE RESINSIGHT_ENABLE_COTIRE)
|
||||
if(RESINSIGHT_ENABLE_COTIRE)
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (CommonCode)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Open GL
|
||||
find_package( OpenGL )
|
||||
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafAnimControl)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Qt
|
||||
set( MOC_HEADER_FILES
|
||||
cafFrameAnimationControl.h
|
||||
|
@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafCommand)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# These headers need to go through Qt's MOC compiler
|
||||
set (MOC_HEADER_FILES
|
||||
|
@ -2,6 +2,11 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafCommandFeatures)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# These headers need to go through Qt's MOC compiler
|
||||
set (MOC_HEADER_FILES
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafPdmCvf)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Qt
|
||||
if (CEE_USE_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafProjectDataModel)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Qt
|
||||
if (CEE_USE_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Gui Widgets)
|
||||
|
@ -1,6 +1,13 @@
|
||||
cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafPdmCore)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Qt
|
||||
option(CEE_USE_QT5 "Use Qt 5 instead of Qt 4" true)
|
||||
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafPdmUiCore)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# These headers need to go through Qt's MOC compiler
|
||||
set (MOC_HEADER_FILES
|
||||
cafPdmUiEditorHandle.h
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafPdmXml)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Qt
|
||||
if (CEE_USE_QT5)
|
||||
find_package(Qt5 COMPONENTS REQUIRED Core Xml)
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafUserInterface)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# Define this one to tell windows.h to not define min() and max() as macros
|
||||
add_definitions(-DNOMINMAX)
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafViewer)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Qt
|
||||
|
||||
# These headers need to go through Qt's MOC compiler
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required (VERSION 2.8.12)
|
||||
|
||||
project (cafVizExtensions)
|
||||
|
||||
# Unity Build
|
||||
if (CAF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Open GL
|
||||
find_package( OpenGL )
|
||||
|
||||
|
@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(LibCore)
|
||||
|
||||
# CMake Unity Build
|
||||
if (CVF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Use our strict compile flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_STRICT_CXX_FLAGS}")
|
||||
|
@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(LibGeometry)
|
||||
|
||||
# CMake Unity Build
|
||||
if (CVF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Use our strict compile flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_STRICT_CXX_FLAGS}")
|
||||
|
@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project(LibGuiQt)
|
||||
|
||||
# CMake Unity Build
|
||||
if (CVF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# We're getting too much trouble from Qt using strict
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_BASE_CXX_FLAGS}")
|
||||
|
||||
@ -60,8 +66,8 @@ target_link_libraries ( ${PROJECT_NAME}
|
||||
set(PROJECT_FILES ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
#if (COMMAND ri_apply_cotire)
|
||||
# set_source_files_properties (cvfqtOpenGLWidget.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# set_source_files_properties (cvfqtOpenGLContext.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# ri_apply_cotire()
|
||||
#endif()
|
||||
# Unity Build
|
||||
if (CMAKE_UNITY_BUILD)
|
||||
set_source_files_properties (cvfqtOpenGLWidget.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
set_source_files_properties (cvfqtOpenGLContext.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
endif()
|
||||
|
@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(LibRender)
|
||||
|
||||
# Unity Build
|
||||
if (CVF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Use our strict compile flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_STRICT_CXX_FLAGS}")
|
||||
@ -191,11 +196,8 @@ target_link_libraries ( ${PROJECT_NAME}
|
||||
set(PROJECT_FILES ${CEE_HEADER_FILES} ${CEE_SOURCE_FILES})
|
||||
source_group("" FILES ${PROJECT_FILES})
|
||||
|
||||
#if (COMMAND ri_apply_cotire)
|
||||
# set_source_files_properties (cvfOpenGLCapabilities.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# set_source_files_properties (cvfOpenGLContext.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# set_source_files_properties (cvfOpenGLContextGroup.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# set_source_files_properties (cvfOpenGLResourceManager.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# set_source_files_properties (cvfOpenGL.cpp PROPERTIES COTIRE_EXCLUDED TRUE)
|
||||
# ri_apply_cotire()
|
||||
#endif()
|
||||
# Unity Build
|
||||
if (CMAKE_UNITY_BUILD)
|
||||
set_source_files_properties (cvfOpenGL.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
set_source_files_properties (cvfOpenGLContextGroup.cpp PROPERTIES SKIP_UNITY_BUILD_INCLUSION TRUE)
|
||||
endif()
|
||||
|
@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 2.8)
|
||||
|
||||
project(LibViewing)
|
||||
|
||||
# CMake Unity Build
|
||||
if (CVF_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
# Use our strict compile flags
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CEE_STRICT_CXX_FLAGS}")
|
||||
|
6
ThirdParty/Qwt/src/CMakeLists.txt
vendored
6
ThirdParty/Qwt/src/CMakeLists.txt
vendored
@ -2,6 +2,12 @@ cmake_minimum_required(VERSION 2.8.12)
|
||||
|
||||
project(Qwt)
|
||||
|
||||
# Unity Build
|
||||
if (RESINSIGHT_ENABLE_UNITY_BUILD)
|
||||
message("Cmake Unity build is enabled on : ${PROJECT_NAME}")
|
||||
set(CMAKE_UNITY_BUILD true)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
# Disable some annoying warnings (relative to warning level 3)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4267")
|
||||
|
Loading…
Reference in New Issue
Block a user