diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt index ed08c4a7c77d86fabfba94d9bc4f91ba75d38bf3..2df4fb662f54596c0bc7ea23dfbad0b5cb0e5e37 100644 --- a/Applications/ApplicationsLib/CMakeLists.txt +++ b/Applications/ApplicationsLib/CMakeLists.txt @@ -20,4 +20,6 @@ if(TARGET Boost) add_dependencies(ApplicationsLib Boost) endif() -cotire(ApplicationsLib) +if(OGS_USE_PCH) + cotire(ApplicationsLib) +endif() diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt index 63b7982479005ade8a17cd0384cc8eb6c18d7396..442531766f0fd78f41ada3c2df437158d6c3c63c 100644 --- a/Applications/CLI/CMakeLists.txt +++ b/Applications/CLI/CMakeLists.txt @@ -18,7 +18,9 @@ if(OGS_INSITU) target_link_libraries(ogs InSituLib) endif() -cotire(ogs) +if(OGS_USE_PCH) + cotire(ogs) +endif() #################### ### Tests ########## diff --git a/Applications/DataExplorer/Base/CMakeLists.txt b/Applications/DataExplorer/Base/CMakeLists.txt index f2f63bee0608e9d6a476cc2c7a0d924ace0a7e7f..2e251d09b1064d754d8289cc97bf6186f618fded 100644 --- a/Applications/DataExplorer/Base/CMakeLists.txt +++ b/Applications/DataExplorer/Base/CMakeLists.txt @@ -42,4 +42,6 @@ target_link_libraries(QtBase set_property(TARGET QtBase PROPERTY FOLDER "DataExplorer") -cotire(QtBase) +if(OGS_USE_PCH) + cotire(QtBase) +endif() diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake index b5bdbe245afef00d6d441f954896b70b28816e3f..0d12eb31d221a4a0885e6ba35ab0a3e3f3c573fb 100644 --- a/Applications/DataExplorer/DataExplorer.cmake +++ b/Applications/DataExplorer/DataExplorer.cmake @@ -112,7 +112,9 @@ ADD_VTK_DEPENDENCY(DataExplorer) set_property(TARGET DataExplorer PROPERTY FOLDER "DataExplorer") -cotire(DataExplorer) +if(OGS_USE_PCH) + cotire(DataExplorer) +endif() #################### ### Installation ### diff --git a/Applications/DataExplorer/DataView/CMakeLists.txt b/Applications/DataExplorer/DataView/CMakeLists.txt index 8846d291b77b0d49c9dadf998f786f027954004e..66b214180b142637e6765f9f1ab80ea52260d99e 100644 --- a/Applications/DataExplorer/DataView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/CMakeLists.txt @@ -151,4 +151,6 @@ endif () # GEOTIFF_FOUND set_property(TARGET QtDataView PROPERTY FOLDER "DataExplorer") -cotire(QtDataView) +if(OGS_USE_PCH) + cotire(QtDataView) +endif() diff --git a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt index e133e60103b241cabebf913e9204dd8f799f020c..9157b88ec85530b9cdbab12345ef679f425a89a8 100644 --- a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt @@ -48,4 +48,6 @@ target_link_libraries(QtDiagramView set_property(TARGET QtDiagramView PROPERTY FOLDER "DataExplorer") -cotire(QtDiagramView) +if(OGS_USE_PCH) + cotire(QtDiagramView) +endif() diff --git a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt index e5714cc497afb41a3c2ece172b61e507e92b51cb..e93feced53f1d81e356c698132bae998919ec5e8 100644 --- a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt +++ b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt @@ -36,4 +36,6 @@ target_link_libraries(QtStratView Qt5::Gui QtBase) set_property(TARGET QtStratView PROPERTY FOLDER "DataExplorer") -cotire(QtStratView) +if(OGS_USE_PCH) + cotire(QtStratView) +endif() diff --git a/Applications/DataExplorer/VtkAct/CMakeLists.txt b/Applications/DataExplorer/VtkAct/CMakeLists.txt index 06f0186f5fd9bde9f2e34af2d26b5d2789e0fb25..8b7b655e4a2f15ffca4a80318ece312dc610e857 100644 --- a/Applications/DataExplorer/VtkAct/CMakeLists.txt +++ b/Applications/DataExplorer/VtkAct/CMakeLists.txt @@ -32,4 +32,6 @@ target_link_libraries( VtkAct set_property(TARGET VtkAct PROPERTY FOLDER "DataExplorer") -cotire(VtkAct) +if(OGS_USE_PCH) + cotire(VtkAct) +endif() diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt index 218170bc45da9e7769afaaab3c453e5e65ea1d1c..d870cfbb9b67b7b7232712c1be81754526b65f0d 100644 --- a/Applications/DataExplorer/VtkVis/CMakeLists.txt +++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt @@ -135,4 +135,6 @@ endif() # GEOTIFF_FOUND target_link_libraries(VtkVis Qt5::Gui QtDataView VtkAct) set_property(TARGET VtkVis PROPERTY FOLDER "DataExplorer") -cotire(VtkVis) +if(OGS_USE_PCH) + cotire(VtkVis) +endif() diff --git a/Applications/DataHolderLib/CMakeLists.txt b/Applications/DataHolderLib/CMakeLists.txt index 2d42fd4aa7c965e12a864c0efa4ffb23c26e14f3..cfcd824d0985c32ddb86c72f9656614788cf8305 100644 --- a/Applications/DataHolderLib/CMakeLists.txt +++ b/Applications/DataHolderLib/CMakeLists.txt @@ -10,4 +10,6 @@ target_link_libraries(DataHolderLib logog ) -cotire(DataHolderLib) +if(OGS_USE_PCH) + cotire(DataHolderLib) +endif() diff --git a/Applications/FileIO/CMakeLists.txt b/Applications/FileIO/CMakeLists.txt index 826f2e7c80b4c4fb7413f0f3402dcd1abe222ca2..fffd2690063c7edb699368eb8da277e035e4505f 100644 --- a/Applications/FileIO/CMakeLists.txt +++ b/Applications/FileIO/CMakeLists.txt @@ -35,7 +35,9 @@ if(TARGET Boost) add_dependencies(ApplicationsFileIO Boost) endif() -cotire(ApplicationsFileIO) +if(OGS_USE_PCH) + cotire(ApplicationsFileIO) +endif() include(${PROJECT_SOURCE_DIR}/scripts/cmake/packaging/InstallXmlSchemaFiles.cmake) InstallXmlSchemaFiles("XmlIO/*.xsd") diff --git a/Applications/InSituLib/CMakeLists.txt b/Applications/InSituLib/CMakeLists.txt index a25329f9e15e6b8d3e5e23faf92227e8d5fdd0c8..38b9b025b7fb621111530a5a336c0fe040b3e882 100644 --- a/Applications/InSituLib/CMakeLists.txt +++ b/Applications/InSituLib/CMakeLists.txt @@ -3,4 +3,6 @@ GET_SOURCE_FILES(SOURCES) # Library add_library(InSituLib ${SOURCES}) -cotire(InSituLib) +if(OGS_USE_PCH) + cotire(InSituLib) +endif() diff --git a/Applications/Utils/OGSFileConverter/CMakeLists.txt b/Applications/Utils/OGSFileConverter/CMakeLists.txt index 94bc58074520be64a9888fdffb81be30b5ccb7ac..0302190c9f185b605dc507734752482fb4a4baa5 100644 --- a/Applications/Utils/OGSFileConverter/CMakeLists.txt +++ b/Applications/Utils/OGSFileConverter/CMakeLists.txt @@ -58,7 +58,9 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}/lib) set_property(TARGET OGSFileConverter PROPERTY FOLDER "Utilities") -cotire(OGSFileConverter) +if(OGS_USE_PCH) + cotire(OGSFileConverter) +endif() #################### ### Installation ### diff --git a/BaseLib/CMakeLists.txt b/BaseLib/CMakeLists.txt index a5598bbd064857e800a1b3d36a08490e99855be4..69e46a1af3cefff47138dd741117513a05774a90 100644 --- a/BaseLib/CMakeLists.txt +++ b/BaseLib/CMakeLists.txt @@ -36,4 +36,6 @@ if(TARGET Boost) add_dependencies(BaseLib Boost) endif() -cotire(BaseLib) +if(OGS_USE_PCH) + cotire(BaseLib) +endif() diff --git a/CMakeLists.txt b/CMakeLists.txt index 5faa2f647aee989f54f2b6e59c7d911e93799237..637877a60e888b442e3e6f11405b16792cac2a6f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,6 +26,7 @@ set(CMAKE_LIBRARY_SEARCH_PATH "" CACHE PATH set(OGS_CPU_ARCHITECTURE "native" CACHE STRING "Processor architecture, defaults to native (*nix) / blend (MSVC).") option(OGS_ENABLE_AVX2 "Enable the use of AVX2 instructions" OFF) option(OGS_BUILD_TESTS "Should the test executables be built?" ON) +option(OGS_USE_PCH "Should pre-compiled headers be used?" ON) ### CMake includes ### include(scripts/cmake/ConanSetup.cmake) diff --git a/GeoLib/CMakeLists.txt b/GeoLib/CMakeLists.txt index e6b162512d059231e8a68c395a85002758f5e995..747e074dca54d9508d9817748fa7ddda16d31840 100644 --- a/GeoLib/CMakeLists.txt +++ b/GeoLib/CMakeLists.txt @@ -31,7 +31,9 @@ if(TARGET Boost) add_dependencies(GeoLib Boost) endif() -cotire(GeoLib) +if(OGS_USE_PCH) + cotire(GeoLib) +endif() include(${PROJECT_SOURCE_DIR}/scripts/cmake/packaging/InstallXmlSchemaFiles.cmake) InstallXmlSchemaFiles("IO/XmlIO/*.xsd") diff --git a/MaterialLib/CMakeLists.txt b/MaterialLib/CMakeLists.txt index 6b4e192511503fd1f6bd227f4513f4d641c2dbe5..d2488350c069566ef85f19ecf27ef6e169736ecd 100644 --- a/MaterialLib/CMakeLists.txt +++ b/MaterialLib/CMakeLists.txt @@ -24,4 +24,6 @@ target_link_libraries(MaterialLib BaseLib ) -cotire(MaterialLib) +if(OGS_USE_PCH) + cotire(MaterialLib) +endif() diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt index a90685fadf5a016bd8c05bd80f96dcae9fc650ff..aeccec33ff759731e7b936910fee3538ee988243 100644 --- a/MathLib/CMakeLists.txt +++ b/MathLib/CMakeLists.txt @@ -59,4 +59,6 @@ if(TARGET Eigen) add_dependencies(MathLib Eigen) endif() -cotire(MathLib) +if(OGS_USE_PCH) + cotire(MathLib) +endif() diff --git a/MeshGeoToolsLib/CMakeLists.txt b/MeshGeoToolsLib/CMakeLists.txt index ef43f083398951176aaebde8fb943fe042248869..662f25ece847db597cbb27a1e6527c41ddd50e04 100644 --- a/MeshGeoToolsLib/CMakeLists.txt +++ b/MeshGeoToolsLib/CMakeLists.txt @@ -15,4 +15,6 @@ if(TARGET Boost) add_dependencies(MeshGeoToolsLib Boost) endif() -cotire(MeshGeoToolsLib) +if(OGS_USE_PCH) + cotire(MeshGeoToolsLib) +endif() diff --git a/MeshLib/CMakeLists.txt b/MeshLib/CMakeLists.txt index 2adfe7e65925be24c6ba3b558c53ac90274b635a..0746183e0148b83519060ab01438512fb10a02ea 100644 --- a/MeshLib/CMakeLists.txt +++ b/MeshLib/CMakeLists.txt @@ -22,7 +22,9 @@ endif() # Create the library add_library(MeshLib ${SOURCES}) -cotire(MeshLib) +if(OGS_USE_PCH) + cotire(MeshLib) +endif() target_link_libraries(MeshLib BaseLib diff --git a/NumLib/CMakeLists.txt b/NumLib/CMakeLists.txt index 33e464a88668b9de3bc89ae5f0336a6440a4db5c..ac83fc180736734f2ba25aec4920e6d95e387b4c 100644 --- a/NumLib/CMakeLists.txt +++ b/NumLib/CMakeLists.txt @@ -35,4 +35,6 @@ if(TARGET Boost) add_dependencies(NumLib Boost) endif() -cotire(NumLib) +if(OGS_USE_PCH) + cotire(NumLib) +endif() diff --git a/ProcessLib/CMakeLists.txt b/ProcessLib/CMakeLists.txt index 6c17691189755bfef81b1dcb567ff6fecf1dee7e..79cc2714663d4f4395e3ef73d41c4d68054c6c31 100644 --- a/ProcessLib/CMakeLists.txt +++ b/ProcessLib/CMakeLists.txt @@ -74,4 +74,6 @@ if(OGS_INSITU) target_link_libraries(ProcessLib InSituLib) endif() -cotire(ProcessLib) +if(OGS_USE_PCH) + cotire(ProcessLib) +endif() diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 69406a5520f5b1dbfd23e9434c7c468de30a7c6a..6485fd22a9cd95bd016a671ac6107c3f323ce30d 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -76,7 +76,9 @@ endif() ADD_VTK_DEPENDENCY(testrunner) -cotire(testrunner) +if(OGS_USE_PCH) + cotire(testrunner) +endif() # Add make-target tests which runs the testrunner if(DEFINED ENV{CI}) diff --git a/scripts/cmake/CompilerSetup.cmake b/scripts/cmake/CompilerSetup.cmake index 9576399f1be21e596b0e271ba3a997a12bfe90f6..445216304f2d16a4c7508cbe009fec1eab1c4086 100644 --- a/scripts/cmake/CompilerSetup.cmake +++ b/scripts/cmake/CompilerSetup.cmake @@ -10,7 +10,12 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -include(cotire) # compile time reducer +if(MSVC_VERSION LESS 1910) # < VS 15.0 + set(OGS_USE_PCH OFF CACHE INTERNAL "") +endif() +if(OGS_USE_PCH) + include(cotire) # compile time reducer +endif() # Set compiler helper variables