From a723be6a64bc68c96bd691caefd409ff68c289ba Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sat, 14 Sep 2019 02:59:19 +0200 Subject: [PATCH] Core/Dep: fixed build with boost 1.71 --- cmake/macros/FindBoost.cmake | 8 ++--- dep/boost/CMakeLists.txt | 46 ++++++++++++++---------- src/server/game/DataStores/DBCStores.cpp | 8 ++--- 3 files changed, 36 insertions(+), 26 deletions(-) diff --git a/cmake/macros/FindBoost.cmake b/cmake/macros/FindBoost.cmake index d893987fed1..c2e63fd5770 100644 --- a/cmake/macros/FindBoost.cmake +++ b/cmake/macros/FindBoost.cmake @@ -385,7 +385,7 @@ function(_Boost_GUESS_COMPILER_PREFIX _ret) endif() elseif("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC") if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20) - set(_boost_COMPILER "-vc142;-vc141") + set(_boost_COMPILER "-vc142") elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) set(_boost_COMPILER "-vc141;-vc140") elseif (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19) @@ -484,7 +484,7 @@ else() # The user has not requested an exact version. Among known # versions, find those that are acceptable to the user request. set(_Boost_KNOWN_VERSIONS ${Boost_ADDITIONAL_VERSIONS} - "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" + "1.68.0" "1.68" "1.67.0" "1.67" "1.66.0" "1.66" "1.65.1" "1.65.0" "1.65" "1.64.0" "1.64" "1.63.0" "1.63" "1.62.0" "1.62" "1.61.0" "1.61" "1.60.0" "1.60" "1.59.0" "1.59" "1.58.0" "1.58" "1.57.0" "1.57" "1.56.0" "1.56" "1.55.0" "1.55" "1.54.0" "1.54" "1.53.0" "1.53" "1.52.0" "1.52" "1.51.0" "1.51" @@ -1159,10 +1159,10 @@ if(Boost_FOUND) list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. If you still have problems search on forum for TCE00020.") else () set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost. If you still have problems search on forum for TCE00021.") endif () endif () diff --git a/dep/boost/CMakeLists.txt b/dep/boost/CMakeLists.txt index cbc5d016a5a..157f9d1f36d 100644 --- a/dep/boost/CMakeLists.txt +++ b/dep/boost/CMakeLists.txt @@ -1,4 +1,4 @@ -# Copyright (C) 2008-2016 TrinityCore +# Copyright (C) 2008-2019 TrinityCore # # This file is free software; as a special exception the author gives # unlimited permission to copy and/or distribute it, with or without @@ -18,15 +18,15 @@ if(WIN32) if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10) set(BOOST_LIBRARYDIR ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.0) else() - if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20) - list(APPEND BOOST_LIBRARYDIR - ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.1 - ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.0 ) - else() - list(APPEND BOOST_LIBRARYDIR - ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.2 - ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.1 ) - endif() + if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.20) + list(APPEND BOOST_LIBRARYDIR + ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.1 + ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.0 ) + else() + list(APPEND BOOST_LIBRARYDIR + ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.2 + ${BOOST_ROOT}/lib${PLATFORM}-msvc-14.1 ) + endif() endif() endif() else() @@ -40,14 +40,23 @@ endif() include (CheckCXXSourceCompiles) +check_cxx_source_compiles(" + #include + int main() { std::wregex r(L\".*\"); }" + STD_HAS_WORKING_WREGEX) + if (WIN32) # On windows the requirements are higher according to the wiki. - set(BOOST_REQUIRED_VERSION 1.59) + set(BOOST_REQUIRED_VERSION 1.66) else() - set(BOOST_REQUIRED_VERSION 1.56) + set(BOOST_REQUIRED_VERSION 1.58) endif() -find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED system filesystem thread program_options iostreams regex) +if (STD_HAS_WORKING_WREGEX) + find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED system filesystem thread program_options iostreams serialization) +else() + find_package(Boost ${BOOST_REQUIRED_VERSION} REQUIRED system filesystem thread program_options iostreams serialization regex) +endif() # Find if Boost was compiled in C++03 mode because it requires -DBOOST_NO_CXX11_SCOPED_ENUMS @@ -78,10 +87,9 @@ target_compile_definitions(boost -DBOOST_DATE_TIME_NO_LIB -DBOOST_REGEX_NO_LIB -DBOOST_CHRONO_NO_LIB - # Due to MSVC linking error boost::none" already defined in scripts_... + # Due to MSVC linking error boost::none" already defined in scripts_... # May be removed when the requirement is raised to boost 1.61 on windows. -DBOOST_OPTIONAL_USE_OLD_DEFINITION_OF_NONE - -DBOOST_CHRONO_NO_LIB -DBOOST_CONFIG_SUPPRESS_OUTDATED_MESSAGE -DBOOST_ASIO_NO_DEPRECATED) @@ -91,6 +99,8 @@ if (NOT boost_filesystem_copy_links_without_NO_SCOPED_ENUM) -DBOOST_NO_CXX11_SCOPED_ENUMS) endif() -target_compile_definitions(boost - INTERFACE - -DTC_HAS_BROKEN_WSTRING_REGEX) +if (NOT STD_HAS_WORKING_WREGEX) + target_compile_definitions(boost + INTERFACE + -DTC_HAS_BROKEN_WSTRING_REGEX) +endif() diff --git a/src/server/game/DataStores/DBCStores.cpp b/src/server/game/DataStores/DBCStores.cpp index fe01ecd043a..c8cf4136353 100644 --- a/src/server/game/DataStores/DBCStores.cpp +++ b/src/server/game/DataStores/DBCStores.cpp @@ -578,10 +578,10 @@ void LoadDBCStores(const std::string& dataPath) ASSERT(conversionResult); if (namesProfanity->Language != -1) - NamesProfaneValidators[namesProfanity->Language].emplace_back(wname, Trinity::regex::perl | Trinity::regex::icase | Trinity::regex::optimize); + NamesProfaneValidators[namesProfanity->Language].emplace_back(wname, Trinity::regex::icase | Trinity::regex::optimize); else for (uint32 i = 0; i < TOTAL_LOCALES; ++i) - NamesProfaneValidators[i].emplace_back(wname, Trinity::regex::perl | Trinity::regex::icase | Trinity::regex::optimize); + NamesProfaneValidators[i].emplace_back(wname, Trinity::regex::icase | Trinity::regex::optimize); } for (NamesReservedEntry const* namesReserved : sNamesReservedStore) @@ -592,10 +592,10 @@ void LoadDBCStores(const std::string& dataPath) ASSERT(conversionResult); if (namesReserved->Language != -1) - NamesReservedValidators[namesReserved->Language].emplace_back(wname, Trinity::regex::perl | Trinity::regex::icase | Trinity::regex::optimize); + NamesReservedValidators[namesReserved->Language].emplace_back(wname, Trinity::regex::icase | Trinity::regex::optimize); else for (uint32 i = 0; i < TOTAL_LOCALES; ++i) - NamesReservedValidators[i].emplace_back(wname, Trinity::regex::perl | Trinity::regex::icase | Trinity::regex::optimize); + NamesReservedValidators[i].emplace_back(wname, Trinity::regex::icase | Trinity::regex::optimize); } for (PhaseGroupEntry const* group : sPhaseGroupStore)