From 46fca6f5bbafcdb2942114ccccdadc1e769955e4 Mon Sep 17 00:00:00 2001 From: Mnikolenko Productengine Date: Thu, 3 Apr 2025 12:34:51 +0300 Subject: #3857 second batch of new or updated LEAP functions --- indra/llcommon/llsdutil.h | 55 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdutil.h b/indra/llcommon/llsdutil.h index 38bbe19ddd..c31030c5ea 100644 --- a/indra/llcommon/llsdutil.h +++ b/indra/llcommon/llsdutil.h @@ -553,6 +553,61 @@ LLSD shallow(LLSD value, LLSD filter=LLSD()) { return llsd_shallow(value, filter } // namespace llsd +/***************************************************************************** + * toArray(), toMap() + *****************************************************************************/ +namespace llsd +{ + +// For some T convertible to LLSD, given std::vector myVec, +// toArray(myVec) returns an LLSD array whose entries correspond to the +// items in myVec. +// For some U convertible to LLSD, given function U xform(const T&), +// toArray(myVec, xform) returns an LLSD array whose every entry is +// xform(item) of the corresponding item in myVec. +// toArray() actually works with any container usable with range +// 'for', not just std::vector. +// (Once we get C++20 we can use std::identity instead of this default lambda.) +template +LLSD toArray(const C& container, FUNC&& func = [](const auto& arg) { return arg; }) +{ + LLSD array; + for (const auto& item : container) + { + array.append(std::forward(func)(item)); + } + return array; +} + +// For some T convertible to LLSD, given std::map myMap, +// toMap(myMap) returns an LLSD map whose entries correspond to the +// (key, value) pairs in myMap. +// For some U convertible to LLSD, given function +// std::pair xform(const std::pair&), +// toMap(myMap, xform) returns an LLSD map whose every entry is +// xform(pair) of the corresponding (key, value) pair in myMap. +// toMap() actually works with any container usable with range 'for', not +// just std::map. It need not even be an associative container, as long as +// you pass an xform function that returns std::pair. +// (Once we get C++20 we can use std::identity instead of this default lambda.) +template +LLSD toMap(const C& container, FUNC&& func = [](const auto& arg) { return arg; }) +{ + LLSD map; + for (const auto& pair : container) + { + const auto& [key, value] = std::forward(func)(pair); + map[key] = value; + } + return map; +} + +} // namespace llsd + +/***************************************************************************** + * boost::hash + *****************************************************************************/ + // Specialization for generating a hash value from an LLSD block. namespace boost { -- cgit v1.2.3 From 1c90421b8873a2228a845ea2f7f4a80758500aa6 Mon Sep 17 00:00:00 2001 From: Andrey Kleshchev Date: Wed, 9 Apr 2025 19:54:50 +0300 Subject: #3596 Faster mesh thread shutdown --- indra/llcommon/lluuid.cpp | 15 --------------- indra/llcommon/lluuid.h | 2 -- 2 files changed, 17 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/lluuid.cpp b/indra/llcommon/lluuid.cpp index b9bd27aa17..4aae90626e 100644 --- a/indra/llcommon/lluuid.cpp +++ b/indra/llcommon/lluuid.cpp @@ -174,14 +174,6 @@ void LLUUID::toString(std::string& out) const (U8)(mData[15])); } -// *TODO: deprecate -void LLUUID::toString(char* out) const -{ - std::string buffer; - toString(buffer); - strcpy(out, buffer.c_str()); /* Flawfinder: ignore */ -} - void LLUUID::toCompressedString(std::string& out) const { char bytes[UUID_BYTES + 1]; @@ -190,13 +182,6 @@ void LLUUID::toCompressedString(std::string& out) const out.assign(bytes, UUID_BYTES); } -// *TODO: deprecate -void LLUUID::toCompressedString(char* out) const -{ - memcpy(out, mData, UUID_BYTES); /* Flawfinder: ignore */ - out[UUID_BYTES] = '\0'; -} - std::string LLUUID::getString() const { return asString(); diff --git a/indra/llcommon/lluuid.h b/indra/llcommon/lluuid.h index bd4edc7993..ca1cf03c4d 100644 --- a/indra/llcommon/lluuid.h +++ b/indra/llcommon/lluuid.h @@ -103,9 +103,7 @@ public: friend LL_COMMON_API std::ostream& operator<<(std::ostream& s, const LLUUID &uuid); friend LL_COMMON_API std::istream& operator>>(std::istream& s, LLUUID &uuid); - void toString(char *out) const; // Does not allocate memory, needs 36 characters (including \0) void toString(std::string& out) const; - void toCompressedString(char *out) const; // Does not allocate memory, needs 17 characters (including \0) void toCompressedString(std::string& out) const; std::string asString() const; -- cgit v1.2.3 From 0500c78b1bccda71a8623785c9765a7adaec0071 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 12 May 2025 20:14:23 +0800 Subject: Have unencapsulated Expat headers in any condition The only condition where Expat headers would be encapsulated is when using LL's Autobuild-based prebuilt libraries, and we're never using any of LL's prebuilt binary for Expat on desktop, since Expat is practically available on any supported desktop platform. The system Expat headers are never encapsulated in any of those platforms. This is the beginning of not relying on the LL_USESYSTEMLIBS macro any more (eventually not relying on the custom USESYSTEMLIBS CMake setting either). Keeping the build system still flexible to have the option to use LL's prebuilt libraries *fully* (we still use some of them in cases where the platform may not have the related system library or for convenience, so the term USESYSTEMLIBS may not always be consistent), is getting harder to maintain. The way it's done is using #if 1, in order to minimise difference from upstream. --- indra/llcommon/llsdserialize_xml.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdserialize_xml.cpp b/indra/llcommon/llsdserialize_xml.cpp index 6396caf8d5..ce416baa04 100644 --- a/indra/llcommon/llsdserialize_xml.cpp +++ b/indra/llcommon/llsdserialize_xml.cpp @@ -35,7 +35,7 @@ extern "C" { -#ifdef LL_USESYSTEMLIBS +#if 1 # include #else # include "expat/expat.h" -- cgit v1.2.3 From a5dcf2912463f14818370d649a8c418e16fb6ff0 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 12 May 2025 20:43:55 +0800 Subject: Not rely on LL_USESYSTEMLIBS for choosing zlib impl with the effect of choosing zlib over zlib-ng in any condition, which has been the case so far. But this opens the way to relying on some other condition, such as which platform, for deciding whether we can use zlib-ng or not, instead of zlib. So we can freely use, for example LL's prebuilt, zlib-ng while still using system libraries for others. --- indra/llcommon/llsdserialize.cpp | 2 +- indra/llcommon/llsys.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llsdserialize.cpp b/indra/llcommon/llsdserialize.cpp index 37af366a20..68a7bf0adf 100644 --- a/indra/llcommon/llsdserialize.cpp +++ b/indra/llcommon/llsdserialize.cpp @@ -37,7 +37,7 @@ #include #include -#ifdef LL_USESYSTEMLIBS +#if 1 # include #else # include "zlib-ng/zlib.h" // for davep's dirty little zip functions diff --git a/indra/llcommon/llsys.cpp b/indra/llcommon/llsys.cpp index 94d59adf29..5c35aeb476 100644 --- a/indra/llcommon/llsys.cpp +++ b/indra/llcommon/llsys.cpp @@ -33,7 +33,7 @@ #include "llsys.h" #include -#ifdef LL_USESYSTEMLIBS +#if 1 # include #else # include "zlib-ng/zlib.h" -- cgit v1.2.3 From d43c417a737d9f48fece51d084a85e3fad86382b Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Mon, 12 May 2025 21:07:02 +0800 Subject: Similar to commit 2a57b9 but for xxHash --- indra/llcommon/hbxxh.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/hbxxh.cpp b/indra/llcommon/hbxxh.cpp index 8ccf8dfcbe..decf908bb6 100644 --- a/indra/llcommon/hbxxh.cpp +++ b/indra/llcommon/hbxxh.cpp @@ -34,11 +34,7 @@ // in your build, in which case the latter would be used instead. For ARM64 // builds, this would also automatically enable NEON vectorization. #define XXH_INLINE_ALL -#if LL_USESYSTEMLIBS #include -#else -#include "xxhash/xxhash.h" -#endif #include "hbxxh.h" -- cgit v1.2.3 From f5ab6e11f13699c03a696611f67f8384434130a1 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 13 May 2025 10:22:54 +0800 Subject: Not rely on (LL_)USESYSTEMLIBS macro & CMake setting but the fact that we keep on using as many system libraries as we can (and only resort to other sources in certain cases), hasn't changed, of course. Also stop having to set USE_AUTOBUILD_3P to OFF. Lines are reindented, and when a system library can be found for a dependency, then that should be the way. If later we find out that using some other way is better, than stick to that. So, one option at a time, whichever is best for the situation. GLEXT hasn't been used, and in order to be not having to hack its .cmake file, we bypass it and refer to GLH (which is still used) right away in LLWindow. CMake commands that need to be bypassed, if it's a one-liner then it's just commented out, but if it's multiple lines, then scope them with if (FALSE) to minimise difference. --- indra/llcommon/CMakeLists.txt | 33 +++++++++++++-------------------- 1 file changed, 13 insertions(+), 20 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 6aec3aada7..07f6eb95e0 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -8,9 +8,6 @@ include(bugsplat) include(Linking) include(Boost) include(LLSharedLibs) -if (NOT USESYSTEMLIBS) -include(Copy3rdPartyLibs) -endif () include(ZLIBNG) include(Tracy) @@ -306,23 +303,19 @@ if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR (${LIN target_include_directories(llcommon PUBLIC ${LIBS_PREBUILT_DIR}/include) endif () -if (NOT USESYSTEMLIBS) -add_dependencies(llcommon stage_third_party_libs) -else () - target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations) - if (CMAKE_CXX_COMPILER_ID MATCHES "GNU") - set_source_files_properties( - llapp.cpp - llsdutil.cpp - PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation) - set_source_files_properties( - llevent.cpp - llfasttimer.cpp - PROPERTIES COMPILE_FLAGS -Wno-nonnull) - elseif (LINUX AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") - set_source_files_properties(llsys.cpp PROPERTIES - COMPILE_FLAGS -Wno-unused-but-set-variable) - endif() +target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations) +if (CMAKE_CXX_COMPILER_ID MATCHES GNU) + set_source_files_properties( + llapp.cpp + llsdutil.cpp + PROPERTIES COMPILE_FLAGS -Wno-stringop-truncation) + set_source_files_properties( + llevent.cpp + llfasttimer.cpp + PROPERTIES COMPILE_FLAGS -Wno-nonnull) +elseif (LINUX AND CMAKE_CXX_COMPILER_ID MATCHES Clang) + set_source_files_properties(llsys.cpp PROPERTIES + COMPILE_FLAGS -Wno-unused-but-set-variable) endif () include(LibraryInstall) -- cgit v1.2.3 From 793bdbf972eca4c032813d6e2c4ef4e79d1628eb Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 13 May 2025 10:48:20 +0800 Subject: Empty CMake elses & endifs parentheses to make it more flexible the next time a value in the if's parentheses gets changed again, and also to reduce duplicate pattern matches when grepping those CMake files with certain keywords. --- indra/llcommon/CMakeLists.txt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index 07f6eb95e0..ac35bec368 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -293,11 +293,11 @@ if (CMAKE_OSX_ARCHITECTURES MATCHES arm64 OR CMAKE_SYSTEM_PROCESSOR MATCHES aarc https://raw.githubusercontent.com/DLTcollab/sse2neon/master/sse2neon.h ${LIBS_PREBUILT_DIR}/include/sse2neon/sse2neon.h ) - endif (NOT EXISTS ${LIBS_PREBUILT_DIR}/include/sse2neon/sse2neon.h) + endif () file(WRITE ${PREBUILD_TRACKING_DIR}/sse2neon_installed "0") - endif (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/sse2neon_installed OR NOT ${sse2neon_installed} EQUAL 0) + endif () target_include_directories(llcommon PUBLIC ${LIBS_PREBUILT_DIR}/include/sse2neon) -endif (CMAKE_OSX_ARCHITECTURES MATCHES arm64 OR CMAKE_SYSTEM_PROCESSOR MATCHES aarch64) +endif () if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR (${LINUX_DISTRO} MATCHES opensuse-tumbleweed)) target_include_directories(llcommon PUBLIC ${LIBS_PREBUILT_DIR}/include) -- cgit v1.2.3 From 7ecde89008f9ed39c357b606d3bc231ba4360ee2 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 27 May 2025 10:01:21 +0800 Subject: Pass configuration phase with vcpkg replacing MSYS2 I happen to be using just Git Bash for convenience for running the commands on the Windows build instructions, hence the build folder pattern to be ignored from the result of running `uname -s` there. The instructions omit the part where you install vcpkg and set the VCPKG_ROOT environment variable, cause it depends on where you install vcpkg to your liking, but the next commands will rely on that variable being set correctly. The CMake used here is MS VS 2022 Community Edition's one, since it will know where the C++ compiler is. $VCPKG_ROOT/downloads/tools/msys2/21caed2f81ec917b/mingw64/bin is where pkg-config.exe can be found. $VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/libxml2 is where xmllint.exe can be found (from libxml2[tools]). PKG_CONFIG_LIBDIR and PYTHON environment settings are pretty self-explanatory. The flags set on LL_BUILD are now for Visual C++ and not MinGW(64)'s GCC or Clang any more, and copied from most of the flags in the variables file from LL's build-variables repo. vcpkg's apr & apr-util packages don't seem to install their .pc files, hence the manual target_include/link_directories/libraries settings, relying on some automatically generated INTERNAL CMake variable called prefix_result. vcpkg's Boost needs the same treatment, plus some suffix. We still use LL's prebuilt libs for OpenSSL, libcurl and WebRTC. Actually too for ColladaDOM for now, but we prepare Windows ColladaDOM self-building for later. For GLM and Meshoptimizer too, it's just the checking that's skipped otherwise it would fail (but the vcpkg packages can be used). Visual C++ doesn't recognise the no-deprecated-declarations compile option. On Visual C++, the macro to denote x86-64 seems to be _M_X64 (if not added there, it would try to find sse2neon :)) We still aren't using Autobuild here for Windows either, hence the FALSE-d viewer_manifest.py based file bundling. --- indra/llcommon/CMakeLists.txt | 5 ++++- indra/llcommon/llmemory.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/CMakeLists.txt b/indra/llcommon/CMakeLists.txt index ac35bec368..6c1e1ef64a 100644 --- a/indra/llcommon/CMakeLists.txt +++ b/indra/llcommon/CMakeLists.txt @@ -303,7 +303,10 @@ if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu) OR (${LIN target_include_directories(llcommon PUBLIC ${LIBS_PREBUILT_DIR}/include) endif () -target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations) +if (NOT WINDOWS) + target_compile_options(${PROJECT_NAME} PUBLIC -Wno-deprecated-declarations) +endif () + if (CMAKE_CXX_COMPILER_ID MATCHES GNU) set_source_files_properties( llapp.cpp diff --git a/indra/llcommon/llmemory.h b/indra/llcommon/llmemory.h index 4a9359f8e2..d5802b9d95 100644 --- a/indra/llcommon/llmemory.h +++ b/indra/llcommon/llmemory.h @@ -71,7 +71,7 @@ LL_COMMON_API void ll_assert_aligned_func(uintptr_t ptr,U32 alignment); #define ll_assert_aligned(ptr,alignment) #endif -#if defined(__i386__) || defined(__x86_64__) +#if defined(__i386__) || defined(__x86_64__) || _M_X64 #include #else #include -- cgit v1.2.3 From 8be1586159f511882f477ac7f50a8d15b6aacc63 Mon Sep 17 00:00:00 2001 From: Erik Kundiman Date: Tue, 27 May 2025 14:43:16 +0800 Subject: Exempt logging that prints build-time path on FBSD --- indra/llcommon/llapr.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/llcommon') diff --git a/indra/llcommon/llapr.cpp b/indra/llcommon/llapr.cpp index 01763c49aa..04aba817f8 100644 --- a/indra/llcommon/llapr.cpp +++ b/indra/llcommon/llapr.cpp @@ -230,7 +230,7 @@ bool LLVolatileAPRPool::isFull() bool _ll_apr_warn_status(apr_status_t status, const char* file, int line) { if(APR_SUCCESS == status) return false; -#if !LL_LINUX +#if !LL_LINUX && !__FreeBSD__ char buf[MAX_STRING]; /* Flawfinder: ignore */ apr_strerror(status, buf, sizeof(buf)); LL_WARNS("APR") << "APR: " << file << ":" << line << " " << buf << LL_ENDL; -- cgit v1.2.3