mirror of
https://github.com/OpenMW/openmw.git
synced 2025-02-07 03:45:33 +00:00
Use target_precompile_headers for the most expensive 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.
This commit is contained in:
parent
5ad2ae04ce
commit
921a22fb73
17 changed files with 179 additions and 7 deletions
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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()
|
||||
|
|
|
@ -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()
|
||||
|
|
4
extern/Base64/CMakeLists.txt
vendored
4
extern/Base64/CMakeLists.txt
vendored
|
@ -1,2 +1,6 @@
|
|||
add_library(Base64 INTERFACE)
|
||||
target_include_directories(Base64 INTERFACE .)
|
||||
|
||||
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
|
||||
target_precompile_headers(Base64 INTERFACE <string>)
|
||||
endif()
|
||||
|
|
4
extern/CMakeLists.txt
vendored
4
extern/CMakeLists.txt
vendored
|
@ -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)
|
||||
|
|
4
extern/oics/CMakeLists.txt
vendored
4
extern/oics/CMakeLists.txt
vendored
|
@ -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()
|
||||
|
|
10
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
10
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
|
@ -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()
|
||||
|
|
Loading…
Reference in a new issue