diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 455e7980e2e..6504002dd98 100644 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -11,8 +11,12 @@ ## We're not there yet, but once done, there is a kludge in Linking.cmake # "if(${CMAKE_VERSION} VERSION_LESS "3.20.0")" that can also be removed cmake_minimum_required(VERSION 3.16.0...4.0 FATAL_ERROR) -cmake_policy(SET CMP0156 NEW) -cmake_policy(SET CMP0179 NEW) +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.29.0") + cmake_policy(SET CMP0156 NEW) +endif() +if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.31.0") + cmake_policy(SET CMP0179 NEW) +endif() set(ROOT_PROJECT_NAME "SecondLife" CACHE STRING "The root project/makefile/solution name. Defaults to SecondLife.") diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake index 7b3882c936e..b57c33c3e00 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -16,53 +16,107 @@ use_prebuilt_binary(boost) # with the address size. set(addrsfx "-x${ADDRESS_SIZE}") -find_library(BOOST_CONTEXT_LIBRARY - NAMES - boost_context-mt - boost_context-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_FIBER_LIBRARY - NAMES - boost_fiber-mt - boost_fiber-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_FILESYSTEM_LIBRARY - NAMES - boost_filesystem-mt - boost_filesystem-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_PROGRAMOPTIONS_LIBRARY - NAMES - boost_program_options-mt - boost_program_options-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_REGEX_LIBRARY - NAMES - boost_regex-mt - boost_regex-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_SYSTEM_LIBRARY - NAMES - boost_system-mt - boost_system-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_THREAD_LIBRARY - NAMES - boost_thread-mt - boost_thread-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) - -find_library(BOOST_URL_LIBRARY - NAMES - boost_url-mt - boost_url-mt${addrsfx} - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) +if (WINDOWS) + + find_library(BOOST_CONTEXT_LIBRARY + NAMES + libboost_context-mt + libboost_context-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_FIBER_LIBRARY + NAMES + libboost_fiber-mt + libboost_fiber-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_FILESYSTEM_LIBRARY + NAMES + libboost_filesystem-mt + libboost_filesystem-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_PROGRAMOPTIONS_LIBRARY + NAMES + libboost_program_options-mt + libboost_program_options-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_REGEX_LIBRARY + NAMES + libboost_regex-mt + libboost_regex-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_SYSTEM_LIBRARY + NAMES + libboost_system-mt + libboost_system-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_THREAD_LIBRARY + NAMES + libboost_thread-mt + libboost_thread-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_URL_LIBRARY + NAMES + libboost_url-mt + libboost_url-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + +else (WINDOWS) + + find_library(BOOST_CONTEXT_LIBRARY + NAMES + boost_context-mt + boost_context-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_FIBER_LIBRARY + NAMES + boost_fiber-mt + boost_fiber-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_FILESYSTEM_LIBRARY + NAMES + boost_filesystem-mt + boost_filesystem-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_PROGRAMOPTIONS_LIBRARY + NAMES + boost_program_options-mt + boost_program_options-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_REGEX_LIBRARY + NAMES + boost_regex-mt + boost_regex-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_SYSTEM_LIBRARY + NAMES + boost_system-mt + boost_system-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_THREAD_LIBRARY + NAMES + boost_thread-mt + boost_thread-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + find_library(BOOST_URL_LIBRARY + NAMES + boost_url-mt + boost_url-mt${addrsfx} + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + +endif (WINDOWS) target_link_libraries(ll::boost INTERFACE ${BOOST_FIBER_LIBRARY} diff --git a/indra/cmake/LLKDU.cmake b/indra/cmake/LLKDU.cmake index dc98335a28e..7680ab7b542 100644 --- a/indra/cmake/LLKDU.cmake +++ b/indra/cmake/LLKDU.cmake @@ -14,10 +14,19 @@ if (USE_KDU) include(Prebuilt) use_prebuilt_binary(kdu) - find_library(KDU_LIBRARY - NAMES - kdu - PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + if (WINDOWS) + find_library(KDU_LIBRARY + NAMES + kdu + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + else (WINDOWS) + find_library(KDU_LIBRARY + NAMES + libkdu.a + PATHS "${ARCH_PREBUILT_DIRS_RELEASE}" REQUIRED NO_DEFAULT_PATH) + + endif (WINDOWS) target_link_libraries(ll::kdu INTERFACE ${KDU_LIBRARY}) diff --git a/indra/llfilesystem/lldir.cpp b/indra/llfilesystem/lldir.cpp index ea33a3bb906..06f5dd2f771 100644 --- a/indra/llfilesystem/lldir.cpp +++ b/indra/llfilesystem/lldir.cpp @@ -43,7 +43,7 @@ #include "lldiriterator.h" #include "stringize.h" #include "llstring.h" -#include +#include #include #include #include @@ -103,24 +103,24 @@ std::vector LLDir::getFilesInDir(const std::string &dirname) //Returns a vector of fullpath filenames. #ifdef LL_WINDOWS // or BOOST_WINDOWS_API - boost::filesystem::path p(ll_convert(dirname)); + std::filesystem::path p(ll_convert(dirname)); #else - boost::filesystem::path p(dirname); + std::filesystem::path p(dirname); #endif std::vector v; - boost::system::error_code ec; - if (exists(p, ec) && !ec.failed()) + std::error_code ec; + if (std::filesystem::exists(p, ec) && ec.value() == 0) { - if (is_directory(p, ec) && !ec.failed()) + if (is_directory(p, ec) && ec.value() == 0) { - boost::filesystem::directory_iterator end_iter; - for (boost::filesystem::directory_iterator dir_itr(p); + std::filesystem::directory_iterator end_iter; + for (std::filesystem::directory_iterator dir_itr(p); dir_itr != end_iter; ++dir_itr) { - if (boost::filesystem::is_regular_file(dir_itr->status())) + if (std::filesystem::is_regular_file(dir_itr->status())) { v.push_back(dir_itr->path().filename().string()); } @@ -197,24 +197,24 @@ U32 LLDir::deleteDirAndContents(const std::string& dir_name) try { #ifdef LL_WINDOWS // or BOOST_WINDOWS_API - boost::filesystem::path dir_path(ll_convert(dir_name)); + std::filesystem::path dir_path(ll_convert(dir_name)); #else - boost::filesystem::path dir_path(dir_name); + std::filesystem::path dir_path(dir_name); #endif - if (boost::filesystem::exists(dir_path)) + if (std::filesystem::exists(dir_path)) { - if (!boost::filesystem::is_empty(dir_path)) + if (!std::filesystem::is_empty(dir_path)) { // Directory has content - num_deleted = (U32)boost::filesystem::remove_all(dir_path); + num_deleted = (U32)std::filesystem::remove_all(dir_path); } else { // Directory is empty - boost::filesystem::remove(dir_path); + std::filesystem::remove(dir_path); } } } - catch (boost::filesystem::filesystem_error &er) + catch (std::filesystem::filesystem_error &er) { LL_WARNS() << "Failed to delete " << dir_name << " with error " << er.code().message() << LL_ENDL; } diff --git a/indra/llfilesystem/lldiriterator.cpp b/indra/llfilesystem/lldiriterator.cpp index e8c37389d2a..28a93f1446d 100644 --- a/indra/llfilesystem/lldiriterator.cpp +++ b/indra/llfilesystem/lldiriterator.cpp @@ -28,9 +28,9 @@ #include "fix_macros.h" #include "llregex.h" -#include +#include -namespace fs = boost::filesystem; +namespace fs = std::filesystem; static std::string glob_to_regex(const std::string& glob); diff --git a/indra/llfilesystem/lldiskcache.cpp b/indra/llfilesystem/lldiskcache.cpp index e971e1885a2..417577369fb 100644 --- a/indra/llfilesystem/lldiskcache.cpp +++ b/indra/llfilesystem/lldiskcache.cpp @@ -34,7 +34,7 @@ #include "llapp.h" #include "llassettype.h" #include "lldir.h" -#include +#include #include #include "lldiskcache.h" @@ -83,7 +83,7 @@ LLDiskCache::LLDiskCache(const std::string& cache_dir, // garbage.) // Other situation: B is trimming the cache and A wants to read a file that is -// about to get deleted. boost::filesystem::remove does whatever it is doing +// about to get deleted. std::filesystem::remove does whatever it is doing // before actually deleting the file. If A opens the file before the file is // actually gone, the OS call from B to delete the file will fail since the OS // will prevent this. B continues with the next file. If the file is already @@ -96,10 +96,10 @@ void LLDiskCache::purge() LL_INFOS() << "Total dir size before purge is " << dirFileSize(sCacheDir) << LL_ENDL; } - boost::system::error_code ec; + std::error_code ec; auto start_time = std::chrono::high_resolution_clock::now(); - typedef std::pair> file_info_t; + typedef std::pair> file_info_t; std::vector file_info; #if LL_WINDOWS @@ -107,23 +107,23 @@ void LLDiskCache::purge() #else std::string cache_path(sCacheDir); #endif - if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + if (std::filesystem::is_directory(cache_path, ec) && ec.value() == 0) { - boost::filesystem::directory_iterator iter(cache_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(cache_path, ec); + while (iter != std::filesystem::directory_iterator() && ec.value() == 0) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0) { if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { - uintmax_t file_size = boost::filesystem::file_size(*iter, ec); - if (ec.failed()) + uintmax_t file_size = std::filesystem::file_size(*iter, ec); + if (ec.value() != 0) { continue; } const std::string file_path = (*iter).path().string(); - const std::time_t file_time = boost::filesystem::last_write_time(*iter, ec); - if (ec.failed()) + const std::filesystem::file_time_type file_time = std::filesystem::last_write_time(*iter, ec); + if (ec.value() != 0) { continue; } @@ -159,8 +159,8 @@ void LLDiskCache::purge() } if (should_remove) { - boost::filesystem::remove(entry.second.second, ec); - if (ec.failed()) + std::filesystem::remove(entry.second.second, ec); + if (ec.value() != 0) { LL_WARNS() << "Failed to delete cache file " << entry.second.second << ": " << ec.message() << LL_ENDL; } @@ -224,23 +224,23 @@ void LLDiskCache::clearCache() * the component files but it's called infrequently so it's * likely just fine */ - boost::system::error_code ec; + std::error_code ec; #if LL_WINDOWS std::wstring cache_path(ll_convert(sCacheDir)); #else std::string cache_path(sCacheDir); #endif - if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + if (std::filesystem::is_directory(cache_path, ec) && ec.value() == 0) { - boost::filesystem::directory_iterator iter(cache_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(cache_path, ec); + while (iter != std::filesystem::directory_iterator() && ec.value() == 0) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0) { if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { - boost::filesystem::remove(*iter, ec); - if (ec.failed()) + std::filesystem::remove(*iter, ec); + if (ec.value() != 0) { LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL; } @@ -257,24 +257,24 @@ void LLDiskCache::removeOldVFSFiles() static const char CACHE_FORMAT[] = "inv.llsd"; static const char DB_FORMAT[] = "db2.x"; - boost::system::error_code ec; + std::error_code ec; #if LL_WINDOWS std::wstring cache_path(ll_convert(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, ""))); #else std::string cache_path(gDirUtilp->getExpandedFilename(LL_PATH_CACHE, "")); #endif - if (boost::filesystem::is_directory(cache_path, ec) && !ec.failed()) + if (std::filesystem::is_directory(cache_path, ec) && ec.value() == 0) { - boost::filesystem::directory_iterator iter(cache_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(cache_path, ec); + while (iter != std::filesystem::directory_iterator() && ec.value() == 0) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0) { if (((*iter).path().string().find(CACHE_FORMAT) != std::string::npos) || ((*iter).path().string().find(DB_FORMAT) != std::string::npos)) { - boost::filesystem::remove(*iter, ec); - if (ec.failed()) + std::filesystem::remove(*iter, ec); + if (ec.value() != 0) { LL_WARNS() << "Failed to delete cache file " << *iter << ": " << ec.message() << LL_ENDL; } @@ -298,23 +298,23 @@ uintmax_t LLDiskCache::dirFileSize(const std::string& dir) * so if performance is ever an issue, optimizing this or removing it altogether, * is an easy win. */ - boost::system::error_code ec; + std::error_code ec; #if LL_WINDOWS std::wstring dir_path(ll_convert(dir)); #else std::string dir_path(dir); #endif - if (boost::filesystem::is_directory(dir_path, ec) && !ec.failed()) + if (std::filesystem::is_directory(dir_path, ec) && ec.value() == 0) { - boost::filesystem::directory_iterator iter(dir_path, ec); - while (iter != boost::filesystem::directory_iterator() && !ec.failed()) + std::filesystem::directory_iterator iter(dir_path, ec); + while (iter != std::filesystem::directory_iterator() && ec.value() == 0) { - if (boost::filesystem::is_regular_file(*iter, ec) && !ec.failed()) + if (std::filesystem::is_regular_file(*iter, ec) && ec.value() == 0) { if ((*iter).path().string().find(CACHE_FILENAME_PREFIX) != std::string::npos) { - uintmax_t file_size = boost::filesystem::file_size(*iter, ec); - if (!ec.failed()) + uintmax_t file_size = std::filesystem::file_size(*iter, ec); + if (ec.value() == 0) { total_file_size += file_size; } diff --git a/indra/llkdu/tests/llimagej2ckdu_test.cpp b/indra/llkdu/tests/llimagej2ckdu_test.cpp index 36b79047b68..bc52a15c4af 100644 --- a/indra/llkdu/tests/llimagej2ckdu_test.cpp +++ b/indra/llkdu/tests/llimagej2ckdu_test.cpp @@ -80,6 +80,7 @@ U8* LLImageBase::getData() { return NULL; } U8* LLImageBase::reallocateData(S32 ) { return NULL; } void LLImageBase::sanityCheck() { } void LLImageBase::setSize(S32 , S32 , S32 ) { } +bool LLImageBase::isBufferInvalid() const { return false; } LLImageJ2CImpl::~LLImageJ2CImpl() { }