Use target_precompile_headers for the most expensive headers

post_malone
elsid 2 years ago committed by jvoisin
parent 8a13cde778
commit 7e6c13630a

@ -346,7 +346,12 @@ if (WIN32)
add_definitions(-DSDL_MAIN_HANDLED)
# Get rid of useless crud from windows.h
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
add_definitions(
-DNOMINMAX # name conflict with std::min, std::max
-DWIN32_LEAN_AND_MEAN
-DNOMB # name conflict with MWGui::MessageBox
-DNOGDI # name conflict with osgAnimation::MorphGeometry::RELATIVE
)
endif()
if(OPENMW_USE_SYSTEM_BULLET)

@ -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)

@ -13,8 +13,6 @@
#include "../mwbase/inputmanager.hpp"
#include "../mwbase/windowmanager.hpp"
#undef MessageBox
namespace MWGui
{

@ -3,8 +3,6 @@
#include "windowbase.hpp"
#undef MessageBox
namespace MyGUI
{
class Widget;

@ -23,6 +23,8 @@
#include <cmath>
namespace MWWorld
{
namespace
{
static const int invalidWeatherID = -1;
@ -53,8 +55,6 @@ namespace
}
}
namespace MWWorld
{
template <typename T>
T TimeOfDayInterpolator<T>::getValue(const float gameHour, const TimeOfDaySettings& timeSettings, const std::string& prefix) const
{

@ -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,10 +4,16 @@
#include <cstring>
#define FAR
#define NEAR
#include <shlobj.h>
#include <shlwapi.h>
#include <winreg.h>
#undef NEAR
#undef FAR
#include <boost/locale.hpp>
namespace bconv = boost::locale::conv;

@ -1,2 +1,6 @@
add_library(Base64 INTERFACE)
target_include_directories(Base64 INTERFACE .)
target_include_directories(Base64 INTERFACE .)
if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16 AND MSVC)
target_precompile_headers(Base64 INTERFACE <string>)
endif()

@ -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)

@ -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()

@ -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…
Cancel
Save