summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelsid <elsid.mail@gmail.com>2022-06-28 08:38:27 +0200
committerelsid <elsid.mail@gmail.com>2022-07-01 13:02:13 +0200
commit921a22fb7387bb6a1ec7a382deabe2ca9528507d (patch)
tree576eb9d018f352c5a5513b2761195e50f8207f7e
parent5ad2ae04ce138cd312f4168dc6a9142ea9028d06 (diff)
Use target_precompile_headers for the most expensive headersprecompile_headers
Only for MSVC. Ccache doesn't work out of the box with precompiled headers but usually gives less build time for Clang and GCC. Also GCC builds code slower with precompiled headers for unknown reason.
-rw-r--r--apps/benchmarks/CMakeLists.txt4
-rw-r--r--apps/bsatool/CMakeLists.txt8
-rw-r--r--apps/bulletobjecttool/CMakeLists.txt7
-rw-r--r--apps/esmtool/CMakeLists.txt8
-rw-r--r--apps/essimporter/CMakeLists.txt10
-rw-r--r--apps/launcher/CMakeLists.txt9
-rw-r--r--apps/mwiniimporter/CMakeLists.txt9
-rw-r--r--apps/navmeshtool/CMakeLists.txt9
-rw-r--r--apps/niftest/CMakeLists.txt4
-rw-r--r--apps/opencs/CMakeLists.txt15
-rw-r--r--apps/openmw/CMakeLists.txt29
-rw-r--r--apps/openmw_test_suite/CMakeLists.txt17
-rw-r--r--components/CMakeLists.txt33
-rw-r--r--extern/Base64/CMakeLists.txt6
-rw-r--r--extern/CMakeLists.txt4
-rw-r--r--extern/oics/CMakeLists.txt4
-rw-r--r--extern/osg-ffmpeg-videoplayer/CMakeLists.txt10
17 files changed, 179 insertions, 7 deletions
diff --git a/apps/benchmarks/CMakeLists.txt b/apps/benchmarks/CMakeLists.txt
index c96531a666..095a841742 100644
--- a/apps/benchmarks/CMakeLists.txt
+++ b/apps/benchmarks/CMakeLists.txt
@@ -9,3 +9,7 @@ target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark benchma
if (UNIX AND NOT APPLE)
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark ${CMAKE_THREAD_LIBS_INIT})
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE <algorithm>)
+endif()
diff --git a/apps/bsatool/CMakeLists.txt b/apps/bsatool/CMakeLists.txt
index 85188dbe9f..6312c33aaf 100644
--- a/apps/bsatool/CMakeLists.txt
+++ b/apps/bsatool/CMakeLists.txt
@@ -17,3 +17,11 @@ if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(bsatool gcov)
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(bsatool PRIVATE
+ <filesystem>
+ <fstream>
+ <vector>
+ )
+endif()
diff --git a/apps/bulletobjecttool/CMakeLists.txt b/apps/bulletobjecttool/CMakeLists.txt
index 6beb411e20..bc19a29e21 100644
--- a/apps/bulletobjecttool/CMakeLists.txt
+++ b/apps/bulletobjecttool/CMakeLists.txt
@@ -18,3 +18,10 @@ endif()
if (WIN32)
install(TARGETS openmw-bulletobjecttool RUNTIME DESTINATION ".")
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw-bulletobjecttool PRIVATE
+ <string>
+ <vector>
+ )
+endif()
diff --git a/apps/esmtool/CMakeLists.txt b/apps/esmtool/CMakeLists.txt
index 914a40699e..841fb4b219 100644
--- a/apps/esmtool/CMakeLists.txt
+++ b/apps/esmtool/CMakeLists.txt
@@ -24,3 +24,11 @@ if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(esmtool gcov)
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(esmtool PRIVATE
+ <fstream>
+ <string>
+ <vector>
+ )
+endif()
diff --git a/apps/essimporter/CMakeLists.txt b/apps/essimporter/CMakeLists.txt
index 3dafba09ba..add5ad6d05 100644
--- a/apps/essimporter/CMakeLists.txt
+++ b/apps/essimporter/CMakeLists.txt
@@ -47,3 +47,13 @@ endif()
if (WIN32)
INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".")
endif(WIN32)
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw-essimporter PRIVATE
+ <algorithm>
+ <filesystem>
+ <fstream>
+ <string>
+ <vector>
+ )
+endif()
diff --git a/apps/launcher/CMakeLists.txt b/apps/launcher/CMakeLists.txt
index e3256519c3..79a27094f2 100644
--- a/apps/launcher/CMakeLists.txt
+++ b/apps/launcher/CMakeLists.txt
@@ -96,3 +96,12 @@ if(USE_QT)
set_property(TARGET openmw-launcher PROPERTY AUTOMOC ON)
endif(USE_QT)
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw-launcher PRIVATE
+ <boost/program_options/options_description.hpp>
+
+ <algorithm>
+ <string>
+ <vector>
+ )
+endif()
diff --git a/apps/mwiniimporter/CMakeLists.txt b/apps/mwiniimporter/CMakeLists.txt
index e83656708b..d35f4f4d33 100644
--- a/apps/mwiniimporter/CMakeLists.txt
+++ b/apps/mwiniimporter/CMakeLists.txt
@@ -33,3 +33,12 @@ if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(openmw-iniimporter gcov)
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw-iniimporter PRIVATE
+ <boost/filesystem.hpp>
+
+ <string>
+ <vector>
+ )
+endif()
diff --git a/apps/navmeshtool/CMakeLists.txt b/apps/navmeshtool/CMakeLists.txt
index 7df049af97..9f57d52a7e 100644
--- a/apps/navmeshtool/CMakeLists.txt
+++ b/apps/navmeshtool/CMakeLists.txt
@@ -20,3 +20,12 @@ endif()
if (WIN32)
install(TARGETS openmw-navmeshtool RUNTIME DESTINATION ".")
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw-navmeshtool PRIVATE
+ <algorithm>
+ <memory>
+ <string>
+ <vector>
+ )
+endif()
diff --git a/apps/niftest/CMakeLists.txt b/apps/niftest/CMakeLists.txt
index 856404c1ce..2f0dcb59e3 100644
--- a/apps/niftest/CMakeLists.txt
+++ b/apps/niftest/CMakeLists.txt
@@ -16,3 +16,7 @@ if (BUILD_WITH_CODE_COVERAGE)
add_definitions (--coverage)
target_link_libraries(niftest gcov)
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(niftest PRIVATE <filesystem>)
+endif()
diff --git a/apps/opencs/CMakeLists.txt b/apps/opencs/CMakeLists.txt
index b3d405d1a3..8a3a41c824 100644
--- a/apps/opencs/CMakeLists.txt
+++ b/apps/opencs/CMakeLists.txt
@@ -261,3 +261,18 @@ endif()
if(USE_QT)
set_property(TARGET openmw-cs PROPERTY AUTOMOC ON)
endif(USE_QT)
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw-cs PRIVATE
+ <boost/filesystem.hpp>
+ <boost/program_options/options_description.hpp>
+
+ <algorithm>
+ <fstream>
+ <functional>
+ <ostream>
+ <string>
+ <string_view>
+ <vector>
+ )
+endif()
diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt
index 24152d59ab..75d051c63b 100644
--- a/apps/openmw/CMakeLists.txt
+++ b/apps/openmw/CMakeLists.txt
@@ -157,9 +157,32 @@ target_link_libraries(openmw
components
)
-if (MSVC AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
- target_precompile_headers(openmw PRIVATE ${SOL_INCLUDE_DIR}/sol/sol.hpp)
-endif ()
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw PRIVATE
+ <boost/filesystem.hpp>
+ <boost/program_options/options_description.hpp>
+
+ <sol/sol.hpp>
+
+ <osg/StateSet>
+ <osg/Node>
+ <osg/Drawable>
+ <osg/Camera>
+
+ <osgViewer/Viewer>
+
+ <MyGUI_Widget.h>
+
+ <algorithm>
+ <filesystem>
+ <fstream>
+ <functional>
+ <memory>
+ <string>
+ <string_view>
+ <vector>
+ )
+endif()
if (ANDROID)
target_link_libraries(openmw EGL android log z)
diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt
index 739d3394b4..072514d0cc 100644
--- a/apps/openmw_test_suite/CMakeLists.txt
+++ b/apps/openmw_test_suite/CMakeLists.txt
@@ -110,4 +110,21 @@ if (GTEST_FOUND AND GMOCK_FOUND)
PRIVATE OPENMW_DATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data"
OPENMW_TEST_SUITE_SOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}")
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(openmw_test_suite PRIVATE
+ <boost/program_options/options_description.hpp>
+
+ <gtest/gtest.h>
+
+ <sol/sol.hpp>
+
+ <algorithm>
+ <filesystem>
+ <fstream>
+ <functional>
+ <memory>
+ <string>
+ <vector>
+ )
+ endif()
endif()
diff --git a/components/CMakeLists.txt b/components/CMakeLists.txt
index a4e1d32e99..9a2295671e 100644
--- a/components/CMakeLists.txt
+++ b/components/CMakeLists.txt
@@ -498,6 +498,33 @@ if(USE_QT)
set_property(TARGET components_qt PROPERTY AUTOMOC ON)
endif(USE_QT)
-if (MSVC AND CMAKE_VERSION VERSION_GREATER_EQUAL 3.16)
- target_precompile_headers(components PRIVATE ${SOL_INCLUDE_DIR}/sol/sol.hpp)
-endif ()
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(components PUBLIC
+ <sol/sol.hpp>
+
+ <osg/State>
+ <osg/StateSet>
+ <osg/Node>
+ <osg/Drawable>
+ <osg/Camera>
+
+ <MyGUI_Widget.h>
+
+ <boost/filesystem.hpp>
+
+ <algorithm>
+ <filesystem>
+ <fstream>
+ <functional>
+ <memory>
+ <ostream>
+ <string>
+ <vector>
+ )
+
+ target_precompile_headers(components PRIVATE
+ <osgViewer/Viewer>
+
+ <boost/program_options/options_description.hpp>
+ )
+endif()
diff --git a/extern/Base64/CMakeLists.txt b/extern/Base64/CMakeLists.txt
index d1adf91bcb..4430d7648e 100644
--- a/extern/Base64/CMakeLists.txt
+++ b/extern/Base64/CMakeLists.txt
@@ -1,2 +1,6 @@
add_library(Base64 INTERFACE)
-target_include_directories(Base64 INTERFACE .) \ No newline at end of file
+target_include_directories(Base64 INTERFACE .)
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(Base64 INTERFACE <string>)
+endif()
diff --git a/extern/CMakeLists.txt b/extern/CMakeLists.txt
index 898dfeffad..c183fe455b 100644
--- a/extern/CMakeLists.txt
+++ b/extern/CMakeLists.txt
@@ -241,6 +241,10 @@ if (NOT OPENMW_USE_SYSTEM_YAML_CPP)
SOURCE_DIR fetched/yaml-cpp
)
FetchContent_MakeAvailableExcludeFromAll(yaml-cpp)
+
+ if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(yaml-cpp PRIVATE <algorithm>)
+ endif()
endif()
if (NOT OPENMW_USE_SYSTEM_ICU)
diff --git a/extern/oics/CMakeLists.txt b/extern/oics/CMakeLists.txt
index 00d77f52c6..585df5dd41 100644
--- a/extern/oics/CMakeLists.txt
+++ b/extern/oics/CMakeLists.txt
@@ -19,3 +19,7 @@ else()
)
target_link_libraries(oics local_tinyxml)
endif()
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(oics PUBLIC <algorithm> <string>)
+endif()
diff --git a/extern/osg-ffmpeg-videoplayer/CMakeLists.txt b/extern/osg-ffmpeg-videoplayer/CMakeLists.txt
index ae19be8659..1bbe672d78 100644
--- a/extern/osg-ffmpeg-videoplayer/CMakeLists.txt
+++ b/extern/osg-ffmpeg-videoplayer/CMakeLists.txt
@@ -16,3 +16,13 @@ target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${FFmpeg_LIBRARIES})
target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} ${OSG_LIBRARIES})
link_directories(${CMAKE_CURRENT_BINARY_DIR})
+
+if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
+ target_precompile_headers(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} PUBLIC
+ <memory>
+ <string>
+ <vector>
+ )
+
+ target_precompile_headers(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} PRIVATE <algorithm>)
+endif()