mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-29 21:45:33 +00:00
Add option to disable precompiled headers
To be able to use ccache. Also fix compilation errors appeared due to absence of precompiled headers.
This commit is contained in:
parent
65d51665e5
commit
5859fd464c
26 changed files with 29 additions and 23 deletions
|
@ -44,6 +44,7 @@ option(BUILD_BENCHMARKS "Build benchmarks with Google Benchmark" OFF)
|
|||
option(BUILD_NAVMESHTOOL "Build navmesh tool" ON)
|
||||
option(BUILD_BULLETOBJECTTOOL "Build Bullet object tool" ON)
|
||||
option(BUILD_OPENCS_TESTS "Build OpenMW Construction Set tests" OFF)
|
||||
option(PRECOMPILE_HEADERS_WITH_MSVC "Precompile most common used headers with MSVC (alternative to ccache)" ON)
|
||||
|
||||
set(OpenGL_GL_PREFERENCE LEGACY) # Use LEGACY as we use GL2; GLNVD is for GL3 and up.
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ if (UNIX AND NOT APPLE)
|
|||
target_link_libraries(openmw_detournavigator_navmeshtilescache_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw_detournavigator_navmeshtilescache_benchmark PRIVATE <algorithm>)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ if (UNIX AND NOT APPLE)
|
|||
target_link_libraries(openmw_esm_refid_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw_esm_refid_benchmark PRIVATE <algorithm>)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ if (UNIX AND NOT APPLE)
|
|||
target_link_libraries(openmw_settings_access_benchmark ${CMAKE_THREAD_LIBS_INIT})
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw_settings_access_benchmark PRIVATE <algorithm>)
|
||||
endif()
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ if (BUILD_WITH_CODE_COVERAGE)
|
|||
target_link_libraries(bsatool gcov)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(bsatool PRIVATE
|
||||
<filesystem>
|
||||
<fstream>
|
||||
|
|
|
@ -19,7 +19,7 @@ if (WIN32)
|
|||
install(TARGETS openmw-bulletobjecttool RUNTIME DESTINATION ".")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-bulletobjecttool PRIVATE
|
||||
<string>
|
||||
<vector>
|
||||
|
|
|
@ -25,7 +25,7 @@ if (BUILD_WITH_CODE_COVERAGE)
|
|||
target_link_libraries(esmtool gcov)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(esmtool PRIVATE
|
||||
<fstream>
|
||||
<string>
|
||||
|
|
|
@ -47,7 +47,7 @@ if (WIN32)
|
|||
INSTALL(TARGETS openmw-essimporter RUNTIME DESTINATION ".")
|
||||
endif(WIN32)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-essimporter PRIVATE
|
||||
<algorithm>
|
||||
<filesystem>
|
||||
|
|
|
@ -94,7 +94,7 @@ if(USE_QT)
|
|||
set_property(TARGET openmw-launcher PROPERTY AUTOMOC ON)
|
||||
endif(USE_QT)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-launcher PRIVATE
|
||||
<boost/program_options/options_description.hpp>
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ if (BUILD_WITH_CODE_COVERAGE)
|
|||
target_link_libraries(openmw-iniimporter gcov)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-iniimporter PRIVATE
|
||||
<string>
|
||||
<vector>
|
||||
|
|
|
@ -21,7 +21,7 @@ if (WIN32)
|
|||
install(TARGETS openmw-navmeshtool RUNTIME DESTINATION ".")
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-navmeshtool PRIVATE
|
||||
<algorithm>
|
||||
<memory>
|
||||
|
|
|
@ -17,6 +17,6 @@ if (BUILD_WITH_CODE_COVERAGE)
|
|||
target_link_libraries(niftest gcov)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(niftest PRIVATE <filesystem>)
|
||||
endif()
|
||||
|
|
|
@ -292,7 +292,7 @@ if (BUILD_WITH_CODE_COVERAGE)
|
|||
target_link_libraries(openmw-cs-lib gcov)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-cs-lib PRIVATE
|
||||
<boost/program_options/options_description.hpp>
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ if (BUILD_WITH_CODE_COVERAGE)
|
|||
target_link_libraries(openmw-cs-tests PRIVATE gcov)
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw-cs-tests PRIVATE
|
||||
<gtest/gtest.h>
|
||||
)
|
||||
|
|
|
@ -161,7 +161,7 @@ target_link_libraries(openmw
|
|||
components
|
||||
)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw PRIVATE
|
||||
<boost/program_options/options_description.hpp>
|
||||
|
||||
|
|
|
@ -126,7 +126,7 @@ target_compile_definitions(openmw_test_suite
|
|||
PRIVATE OPENMW_DATA_DIR=u8"${CMAKE_CURRENT_BINARY_DIR}/data"
|
||||
OPENMW_PROJECT_SOURCE_DIR=u8"${PROJECT_SOURCE_DIR}")
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(openmw_test_suite PRIVATE
|
||||
<boost/program_options/options_description.hpp>
|
||||
|
||||
|
|
|
@ -691,7 +691,7 @@ if(USE_QT)
|
|||
set_property(TARGET components_qt PROPERTY AUTOMOC ON)
|
||||
endif(USE_QT)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(components PUBLIC
|
||||
<sol/sol.hpp>
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <BulletCollision/Gimpact/btBoxCollision.h>
|
||||
|
||||
#include <cstdint>
|
||||
#include <cstddef>
|
||||
|
||||
namespace DetourNavigator
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
||||
#include <components/misc/hash.hpp>
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
#include <cstring>
|
||||
#include <istream>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <iosfwd>
|
||||
#include <string>
|
||||
|
||||
namespace ESM
|
||||
{
|
||||
|
|
|
@ -1,12 +1,15 @@
|
|||
#include "platform.hpp"
|
||||
|
||||
#ifdef WIN32
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
|
||||
namespace Platform
|
||||
{
|
||||
|
||||
static void increaseFileHandleLimit()
|
||||
{
|
||||
#ifdef WIN32
|
||||
#include <stdio.h>
|
||||
// Increase limit for open files at the stream I/O level, see
|
||||
// https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/setmaxstdio?view=msvc-170#remarks
|
||||
_setmaxstdio(8192);
|
||||
|
|
2
extern/Base64/CMakeLists.txt
vendored
2
extern/Base64/CMakeLists.txt
vendored
|
@ -1,6 +1,6 @@
|
|||
add_library(Base64 INTERFACE)
|
||||
target_include_directories(Base64 INTERFACE .)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(Base64 INTERFACE <string>)
|
||||
endif()
|
||||
|
|
2
extern/CMakeLists.txt
vendored
2
extern/CMakeLists.txt
vendored
|
@ -234,7 +234,7 @@ if (NOT OPENMW_USE_SYSTEM_YAML_CPP)
|
|||
)
|
||||
FetchContent_MakeAvailableExcludeFromAll(yaml-cpp)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(yaml-cpp PRIVATE <algorithm>)
|
||||
endif()
|
||||
endif()
|
||||
|
|
2
extern/oics/CMakeLists.txt
vendored
2
extern/oics/CMakeLists.txt
vendored
|
@ -22,6 +22,6 @@ endif()
|
|||
|
||||
target_link_libraries(oics SDL2::SDL2)
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(oics PUBLIC <algorithm> <string>)
|
||||
endif()
|
||||
|
|
2
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
2
extern/osg-ffmpeg-videoplayer/CMakeLists.txt
vendored
|
@ -18,7 +18,7 @@ target_link_libraries(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} SDL2::SDL2)
|
|||
|
||||
link_directories(${CMAKE_CURRENT_BINARY_DIR})
|
||||
|
||||
if (MSVC)
|
||||
if (MSVC AND PRECOMPILE_HEADERS_WITH_MSVC)
|
||||
target_precompile_headers(${OSG_FFMPEG_VIDEOPLAYER_LIBRARY} PUBLIC
|
||||
<memory>
|
||||
<string>
|
||||
|
|
Loading…
Reference in a new issue