diff --git a/CMakeLists.txt b/CMakeLists.txt index 67a8f7c679..ae840fb8b3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -167,6 +167,16 @@ option(OPENMW_OSX_DEPLOYMENT OFF) if (MSVC) option(OPENMW_MP_BUILD "Build OpenMW with /MP flag" OFF) + if (OPENMW_MP_BUILD) + add_compile_options(/MP) + endif() + + # \bigobj is required: + # 1) for OPENMW_UNITY_BUILD; + # 2) to compile lua bindings in components, openmw and tests, because sol3 is heavily templated. + # there should be no relevant downsides to having it on: + # https://docs.microsoft.com/en-us/cpp/build/reference/bigobj-increase-number-of-sections-in-dot-obj-file + add_compile_options(/bigobj) endif() # Set up common paths @@ -610,10 +620,6 @@ endif() if (WIN32) if (MSVC) - if (OPENMW_MP_BUILD) - set( MT_BUILD "/MP") - endif() - foreach( OUTPUTCONFIG ${CMAKE_CONFIGURATION_TYPES} ) string( TOUPPER ${OUTPUTCONFIG} OUTPUTCONFIG ) set( CMAKE_RUNTIME_OUTPUT_DIRECTORY_${OUTPUTCONFIG} "$(SolutionDir)$(Configuration)" ) @@ -662,54 +668,55 @@ if (WIN32) set(WARNINGS "${WARNINGS} /wd${d}") endforeach(d) - set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") - set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(components PROPERTIES COMPILE_FLAGS "${WARNINGS}") + set_target_properties(osg-ffmpeg-videoplayer PROPERTIES COMPILE_FLAGS "${WARNINGS}") if (MSVC_VERSION GREATER_EQUAL 1915 AND MSVC_VERSION LESS 1920) target_compile_definitions(components INTERFACE _ENABLE_EXTENDED_ALIGNED_STORAGE) endif() if (BUILD_BSATOOL) - set_target_properties(bsatool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(bsatool PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_ESMTOOL) - set_target_properties(esmtool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(esmtool PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_ESSIMPORTER) - set_target_properties(openmw-essimporter PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw-essimporter PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_LAUNCHER) - set_target_properties(openmw-launcher PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw-launcher PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_MWINIIMPORTER) - set_target_properties(openmw-iniimporter PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw-iniimporter PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_OPENCS) - set_target_properties(openmw-cs PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw-cs PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_OPENMW) - # \bigobj is required: - # 1) for OPENMW_UNITY_BUILD; - # 2) to compile lua bindings, because sol3 is heavily templated. - set_target_properties(openmw PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD} /bigobj") + set_target_properties(openmw PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_WIZARD) - set_target_properties(openmw-wizard PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw-wizard PROPERTIES COMPILE_FLAGS "${WARNINGS}") + endif() + + if (BUILD_UNITTESTS) + set_target_properties(openmw_test_suite PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_BENCHMARKS) - set_target_properties(openmw_detournavigator_navmeshtilescache_benchmark PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw_detournavigator_navmeshtilescache_benchmark PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() if (BUILD_NAVMESHTOOL) - set_target_properties(openmw-navmeshtool PROPERTIES COMPILE_FLAGS "${WARNINGS} ${MT_BUILD}") + set_target_properties(openmw-navmeshtool PROPERTIES COMPILE_FLAGS "${WARNINGS}") endif() endif(MSVC) diff --git a/apps/openmw/CMakeLists.txt b/apps/openmw/CMakeLists.txt index b54ecb416c..ea1d48885c 100644 --- a/apps/openmw/CMakeLists.txt +++ b/apps/openmw/CMakeLists.txt @@ -207,13 +207,6 @@ if (BUILD_WITH_CODE_COVERAGE) target_link_libraries(openmw gcov) endif() -if (MSVC) - # Debug version needs increased number of sections beyond 2^16 - if (CMAKE_CL_64) - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj") - endif (CMAKE_CL_64) -endif (MSVC) - if (WIN32) INSTALL(TARGETS openmw RUNTIME DESTINATION ".") endif (WIN32) diff --git a/apps/openmw_test_suite/CMakeLists.txt b/apps/openmw_test_suite/CMakeLists.txt index da68a21998..2ee34186d8 100644 --- a/apps/openmw_test_suite/CMakeLists.txt +++ b/apps/openmw_test_suite/CMakeLists.txt @@ -87,14 +87,6 @@ if (GTEST_FOUND AND GMOCK_FOUND) target_link_libraries(openmw_test_suite gcov) endif() - if (MSVC) - if (CMAKE_CL_64) - # Debug version of openmw_unit_tests needs increased number of sections beyond 2^16 - # just like openmw and openmw-cs - set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /bigobj") - endif (CMAKE_CL_64) - endif (MSVC) - file(DOWNLOAD https://gitlab.com/OpenMW/example-suite/-/raw/8966dab24692555eec720c854fb0f73d108070cd/data/template.omwgame ${CMAKE_CURRENT_BINARY_DIR}/data/template.omwgame