summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--indra/cmake/APR.cmake2
-rw-r--r--indra/cmake/Boost.cmake6
-rw-r--r--indra/cmake/CMakeLists.txt1
-rw-r--r--indra/cmake/GLEXT.cmake4
-rw-r--r--indra/cmake/LLPrimitive.cmake67
-rw-r--r--indra/cmake/LLWindow.cmake2
-rw-r--r--indra/llcommon/always_return.h16
-rw-r--r--indra/llcommon/llexception.cpp44
-rw-r--r--indra/llcommon/llexception.h114
-rw-r--r--indra/llcommon/llsdjson.cpp4
-rw-r--r--indra/llcommon/llwin32headers.h1
-rw-r--r--indra/llrender/llfontfreetype.cpp2
-rw-r--r--indra/llrender/llgl.cpp5
-rw-r--r--indra/llwindow/CMakeLists.txt3
-rw-r--r--indra/llwindow/llwindowwin32.cpp13
-rw-r--r--indra/newview/CMakeLists.txt7
-rw-r--r--indra/newview/ViewerInstall.cmake10
-rwxr-xr-xindra/newview/linux_tools/launch_url.sh1
-rw-r--r--indra/newview/llappviewer.cpp16
-rw-r--r--indra/newview/llappviewerwin32.cpp36
-rw-r--r--indra/newview/skins/default/xui/en/floater_about.xml90
-rw-r--r--indra/test/test.cpp70
23 files changed, 249 insertions, 270 deletions
diff --git a/README.md b/README.md
index b6dfa754c1..c1eea48788 100644
--- a/README.md
+++ b/README.md
@@ -123,10 +123,11 @@ $ megapahit
```
$ vcpkg install pkgconf python3 freealut apr-util boost freetype glm hunspell libjpeg-turbo meshoptimizer minizip nghttp2 openjpeg libvorbis libxml2[tools] xxhash
$ export LL_BUILD="/MD /O2 /Ob2 /std:c++20 /Zc:wchar_t- /Zi /GR /DLL_RELEASE=1 /DLL_RELEASE_FOR_DOWNLOAD=1 /DNDEBUG /D_SECURE_STL=0 /D_HAS_ITERATOR_DEBUGGING=0 /DWIN32 /D_WINDOWS /DLL_WINDOWS=1 /DUNICODE /D_UNICODE /DWINVER=0x0602 /D_WIN32_WINNT=0x0602"
-$ export PATH="/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin:$VCPKG_ROOT/downloads/tools/msys2/21caed2f81ec917b/mingw64/bin:$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/libxml2:$PATH"
+$ export PATH="/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin:/c/Program Files/Microsoft Visual Studio/2022/Community/MSBuild/Current/Bin:$VCPKG_ROOT/downloads/tools/msys2/21caed2f81ec917b/mingw64/bin:$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/libxml2:$PATH"
$ export PKG_CONFIG_LIBDIR="$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/lib/pkgconfig"
$ export PYTHON="$VCPKG_ROOT/installed/`uname -m|sed 's/86_//'`-windows/tools/python3/python.exe"
-$ cmake -DCMAKE_BUILD_TYPE:STRING=Release -DADDRESS_SIZE:STRING=64 -DUSE_OPENAL:BOOL=ON -DUSE_FMODSTUDIO:BOOL=OFF -DENABLE_MEDIA_PLUGINS:BOOL=OFF -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=OFF -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=OFF -DPACKAGE:BOOL=OFF ../indra
+$ cmake -DADDRESS_SIZE:STRING=64 -DUSE_OPENAL:BOOL=ON -DUSE_FMODSTUDIO:BOOL=OFF -DENABLE_MEDIA_PLUGINS:BOOL=OFF -DLL_TESTS:BOOL=OFF -DNDOF:BOOL=OFF -DROOT_PROJECT_NAME:STRING=Megapahit -DVIEWER_CHANNEL:STRING=Megapahit -DVIEWER_BINARY_NAME:STRING=megapahit -DBUILD_SHARED_LIBS:BOOL=OFF -DINSTALL:BOOL=OFF -DPACKAGE:BOOL=OFF -DVS_DISABLE_FATAL_WARNINGS:BOOL=ON ../indra
+$ MSBuild.exe Megapahit.sln -p:Configuration=Release
```
## Contribute
diff --git a/indra/cmake/APR.cmake b/indra/cmake/APR.cmake
index fa3b8a4ffb..58a00c74da 100644
--- a/indra/cmake/APR.cmake
+++ b/indra/cmake/APR.cmake
@@ -8,7 +8,7 @@ add_library( ll::apr INTERFACE IMPORTED )
if (WINDOWS)
target_include_directories(ll::apr SYSTEM INTERFACE ${prefix_result}/../include)
target_link_directories(ll::apr INTERFACE ${prefix_result})
- target_link_libraries(ll::apr INTERFACE apr-1 apr-util-1)
+ target_link_libraries(ll::apr INTERFACE libapr-1 libaprutil-1)
else ()
include(FindPkgConfig)
pkg_check_modules(Apr REQUIRED apr-1 apr-util-1)
diff --git a/indra/cmake/Boost.cmake b/indra/cmake/Boost.cmake
index 9ea1f6c9a6..5a9e10b38b 100644
--- a/indra/cmake/Boost.cmake
+++ b/indra/cmake/Boost.cmake
@@ -21,11 +21,15 @@ target_link_libraries( ll::boost INTERFACE
boost_fiber${sfx}
boost_filesystem${sfx}
boost_program_options${sfx}
- boost_regex${sfx}
boost_system${sfx}
boost_thread${sfx}
boost_url${sfx}
)
+if (WINDOWS)
+ target_link_libraries( ll::boost INTERFACE boost_json${sfx})
+else ()
+ target_link_libraries( ll::boost INTERFACE boost_regex${sfx})
+endif ()
target_compile_definitions( ll::boost INTERFACE BOOST_BIND_GLOBAL_PLACEHOLDERS )
return()
diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt
index 746d242560..5525ac9f24 100644
--- a/indra/cmake/CMakeLists.txt
+++ b/indra/cmake/CMakeLists.txt
@@ -24,6 +24,7 @@ set(cmake_SOURCE_FILES
FindAutobuild.cmake
FMODSTUDIO.cmake
FreeType.cmake
+ GLEXT.cmake
GLH.cmake
GLM.cmake
Havok.cmake
diff --git a/indra/cmake/GLEXT.cmake b/indra/cmake/GLEXT.cmake
index a780966f0c..f45b27e7b8 100644
--- a/indra/cmake/GLEXT.cmake
+++ b/indra/cmake/GLEXT.cmake
@@ -3,7 +3,9 @@ include(Prebuilt)
include(GLH)
add_library( ll::glext INTERFACE IMPORTED )
-use_system_binary(glext)
+#use_system_binary(glext)
+if (WINDOWS)
use_prebuilt_binary(glext)
+endif ()
diff --git a/indra/cmake/LLPrimitive.cmake b/indra/cmake/LLPrimitive.cmake
index 3429a744f5..6dc0659bd8 100644
--- a/indra/cmake/LLPrimitive.cmake
+++ b/indra/cmake/LLPrimitive.cmake
@@ -18,44 +18,48 @@ if( USE_CONAN )
"${CONAN_INCLUDE_DIRS_COLLADADOM}/collada-dom/1.4/" )
endif()
-if( LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD )
+if (LINUX OR CMAKE_SYSTEM_NAME MATCHES FreeBSD)
# Build of the collada-dom for Linux and FreeBSD is done in
# indra/llprimitive/CMakeLists.txt
return()
-elseif ( NOT WINDOWS )
+else ()
include(FindPkgConfig)
pkg_check_modules(Minizip REQUIRED minizip)
pkg_check_modules(Libxml2 REQUIRED libxml-2.0)
target_link_libraries( ll::minizip-ng INTERFACE ${Minizip_LIBRARIES} )
target_link_libraries( ll::libxml INTERFACE ${Libxml2_LIBRARIES} )
- if( ${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/colladadom_installed OR NOT ${colladadom_installed} EQUAL 0 )
- if( NOT EXISTS ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8.tar.gz )
+ if (${PREBUILD_TRACKING_DIR}/sentinel_installed IS_NEWER_THAN ${PREBUILD_TRACKING_DIR}/colladadom_installed OR NOT ${colladadom_installed} EQUAL 0)
+ if (NOT EXISTS ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8.tar.gz)
file(DOWNLOAD
https://github.com/secondlife/3p-colladadom/archive/refs/tags/v2.3-r8.tar.gz
${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8.tar.gz
)
- endif()
+ endif ()
file(ARCHIVE_EXTRACT
INPUT ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8.tar.gz
DESTINATION ${CMAKE_BINARY_DIR}
)
- if ( WINDOWS )
+ if (WINDOWS)
execute_process(
- COMMAND sed -i "s/SHARED/STATIC/g" CMakeLists.txt
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4
+ COMMAND sed -i "s/SHARED/STATIC/" 1.4/CMakeLists.txt
+ COMMAND sed -i "/#include <cstdarg>/a #define WIN32" dae/daeUtils.cpp
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src
)
- set(BOOST_LIBRARY_SUFFIX -vc143-mt-x64-1_88)
else ()
execute_process(
- COMMAND sed -i "" -e "s/SHARED/STATIC/g" CMakeLists.txt
- WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4
+ COMMAND sed -i "" -e "s/SHARED/STATIC/" src/1.4/CMakeLists.txt
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8
)
endif ()
- if( DARWIN )
+ if (DARWIN)
set(BOOST_CFLAGS -I${Libxml2_LIBRARY_DIRS}exec/boost/1.87/include)
set(BOOST_LIBS -L${Minizip_LIBRARY_DIRS}exec/boost/1.87/lib)
set(BOOST_LIBRARY_SUFFIX -mt)
- endif()
+ elseif (WINDOWS)
+ set(BOOST_CFLAGS -I${prefix_result}/../include)
+ set(BOOST_LIBS -L${prefix_result})
+ set(BOOST_LIBRARY_SUFFIX -vc143-mt-x64-1_88)
+ endif ()
file(MAKE_DIRECTORY ${LIBS_PREBUILT_DIR}/include/collada/1.4)
try_compile(COLLADADOM_RESULT
PROJECT colladadom
@@ -78,7 +82,26 @@ elseif ( NOT WINDOWS )
-DOPT_COLLADA14:BOOL=ON
-DCOLLADA_DOM_INCLUDE_INSTALL_DIR:PATH=${LIBS_PREBUILT_DIR}/include/collada
)
- if( ${COLLADADOM_RESULT} )
+ if (WINDOWS)
+ execute_process(
+ COMMAND MSBuild.exe ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/Project.sln -p:Configuration=Release
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8
+ OUTPUT_VARIABLE colladadom_installed
+ )
+ file(REMOVE_RECURSE ${LIBS_PREBUILT_DIR}/include/collada)
+ file(
+ COPY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/include
+ DESTINATION ${LIBS_PREBUILT_DIR}/include
+ )
+ file(RENAME
+ ${LIBS_PREBUILT_DIR}/include/include
+ ${LIBS_PREBUILT_DIR}/include/collada
+ )
+ file(RENAME
+ ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4/Release/collada14dom.lib
+ ${ARCH_PREBUILT_DIRS_RELEASE}/libcollada14dom23-s.lib
+ )
+ elseif (${COLLADADOM_RESULT})
execute_process(
COMMAND ${CMAKE_MAKE_PROGRAM} install
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8
@@ -88,17 +111,15 @@ elseif ( NOT WINDOWS )
${ARCH_PREBUILT_DIRS}/libcollada14dom.a
${ARCH_PREBUILT_DIRS_RELEASE}/libcollada14dom.a
)
- file(WRITE ${PREBUILD_TRACKING_DIR}/colladadom_installed "${colladadom_installed}")
- endif()
- endif()
-endif()
+ endif ()
+ file(WRITE ${PREBUILD_TRACKING_DIR}/colladadom_installed "${colladadom_installed}")
+ endif ()
+endif ()
-#use_system_binary( colladadom )
+if (FALSE)
+use_system_binary( colladadom )
-if (WINDOWS)
use_prebuilt_binary(colladadom)
-endif ()
-if( FALSE )
use_prebuilt_binary(minizip-ng) # needed for colladadom
use_prebuilt_binary(libxml2)
@@ -113,7 +134,7 @@ if (WINDOWS)
else()
target_link_libraries( ll::libxml INTERFACE ${ARCH_PREBUILT_DIRS_RELEASE}/libxml2.a)
endif()
-endif( FALSE )
+endif (FALSE)
target_include_directories( ll::colladadom SYSTEM INTERFACE
${LIBS_PREBUILT_DIR}/include/collada
diff --git a/indra/cmake/LLWindow.cmake b/indra/cmake/LLWindow.cmake
index 34df3ad33b..007b8dfba6 100644
--- a/indra/cmake/LLWindow.cmake
+++ b/indra/cmake/LLWindow.cmake
@@ -1,7 +1,7 @@
# -*- cmake -*-
include(Variables)
-include(GLH)
+include(GLEXT)
include(Prebuilt)
include_guard()
diff --git a/indra/llcommon/always_return.h b/indra/llcommon/always_return.h
index b99eb49096..a206471da5 100644
--- a/indra/llcommon/always_return.h
+++ b/indra/llcommon/always_return.h
@@ -79,22 +79,6 @@ namespace LL
DESIRED mDefault;
};
- // specialize for AlwaysReturn<void>
- template <>
- struct AlwaysReturn<void>
- {
- public:
- AlwaysReturn() {}
-
- // callable returns a type not convertible to DESIRED, return default
- template <typename CALLABLE, typename... ARGS>
- void operator()(CALLABLE&& callable, ARGS&&... args)
- {
- // discard whatever callable(args) returns
- std::forward<CALLABLE>(callable)(std::forward<ARGS>(args)...);
- }
- };
-
/**
* always_return<T>(some_function, some_args...) calls
* some_function(some_args...). It is guaranteed to return a value of type
diff --git a/indra/llcommon/llexception.cpp b/indra/llcommon/llexception.cpp
index 107fdc2b2d..c0154a569f 100644
--- a/indra/llcommon/llexception.cpp
+++ b/indra/llcommon/llexception.cpp
@@ -15,12 +15,7 @@
#include "llexception.h"
// STL headers
// std headers
-#include <iomanip>
-#include <sstream>
#include <typeinfo>
-#if LL_WINDOWS
-#include <excpt.h>
-#endif // LL_WINDOWS
// external library headers
#include <boost/exception/diagnostic_information.hpp>
#include <boost/exception/error_info.hpp>
@@ -34,6 +29,7 @@
// On Windows, header-only implementation causes macro collisions -- use
// prebuilt library
#define BOOST_STACKTRACE_LINK
+#include <excpt.h>
#endif // LL_WINDOWS
#include <boost/stacktrace.hpp>
@@ -98,47 +94,25 @@ void annotate_exception_(boost::exception& exc)
// For windows SEH exception handling we sometimes need a filter that will
// separate C++ exceptions from C SEH exceptions
-static constexpr U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
-static constexpr U32 STATUS_STACK_FULL = 0xC00000FD;
+static const U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
-void LL::seh::fill_stacktrace(std::string& stacktrace, U32 code)
+U32 msc_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop)
{
- // Sadly, despite its diagnostic importance, trying to capture a
- // stacktrace when the stack is already blown only terminates us faster.
- if (code == STATUS_STACK_FULL)
- {
- stacktrace = "(stack overflow, no traceback)";
- }
- else
- {
- stacktrace = to_string(boost::stacktrace::stacktrace());
- }
-}
+ const auto stack = to_string(boost::stacktrace::stacktrace());
+ LL_WARNS() << "SEH Exception handled (that probably shouldn't be): Code " << code
+ << "\n Stack trace: \n"
+ << stack << LL_ENDL;
-U32 LL::seh::common_filter(U32 code, struct _EXCEPTION_POINTERS*)
-{
if (code == STATUS_MSC_EXCEPTION)
{
- // C++ exception, don't stop at this handler
+ // C++ exception, go on
return EXCEPTION_CONTINUE_SEARCH;
}
else
{
- // This is a non-C++ exception, e.g. hardware check.
- // Pass control into the handler block.
+ // handle it
return EXCEPTION_EXECUTE_HANDLER;
}
}
-void LL::seh::rethrow(U32 code, const std::string& stacktrace)
-{
- std::ostringstream out;
- out << "Windows exception 0x" << std::hex << code;
- if (! stacktrace.empty())
- {
- out << '\n' << stacktrace;
- }
- LLTHROW(Windows_SEH_exception(out.str()));
-}
-
#endif //LL_WINDOWS
diff --git a/indra/llcommon/llexception.h b/indra/llcommon/llexception.h
index f58a553eb3..68e609444e 100644
--- a/indra/llcommon/llexception.h
+++ b/indra/llcommon/llexception.h
@@ -12,7 +12,6 @@
#if ! defined(LL_LLEXCEPTION_H)
#define LL_LLEXCEPTION_H
-#include "always_return.h"
#include <stdexcept>
#include <boost/exception/exception.hpp>
#include <boost/throw_exception.hpp>
@@ -103,115 +102,14 @@ void crash_on_unhandled_exception_(const char*, int, const char*, const std::str
log_unhandled_exception_(__FILE__, __LINE__, BOOST_CURRENT_FUNCTION, CONTEXT)
void log_unhandled_exception_(const char*, int, const char*, const std::string&);
-/*****************************************************************************
-* Structured Exception Handling
-*****************************************************************************/
-// this is used in platform-generic code -- define outside #if LL_WINDOWS
-struct Windows_SEH_exception: public LLException
-{
- Windows_SEH_exception(const std::string& what): LLException(what) {}
-};
-
-namespace LL
-{
-namespace seh
-{
-
-#if LL_WINDOWS //-------------------------------------------------------------
-
-void fill_stacktrace(std::string& stacktrace, U32 code);
-
-// wrapper around caller's U32 filter(U32 code, struct _EXCEPTION_POINTERS*)
-// filter function: capture a stacktrace, if possible, before forwarding the
-// call to the caller's filter() function
-template <typename FILTER>
-U32 filter_(std::string& stacktrace, FILTER&& filter,
- U32 code, struct _EXCEPTION_POINTERS* exptrs)
-{
- // By the time the handler gets control, the stack has been unwound,
- // so report the stack trace now at filter() time.
- fill_stacktrace(stacktrace, code);
- return std::forward<FILTER>(filter)(code, exptrs);
-}
-
-template <typename TRYCODE, typename FILTER, typename HANDLER>
-auto catcher_inner(std::string& stacktrace,
- TRYCODE&& trycode, FILTER&& filter, HANDLER&& handler)
-{
- __try
- {
- return std::forward<TRYCODE>(trycode)();
- }
- __except (filter_(stacktrace,
- std::forward<FILTER>(filter),
- GetExceptionCode(), GetExceptionInformation()))
- {
- return always_return<decltype(trycode())>(
- std::forward<HANDLER>(handler), GetExceptionCode(), stacktrace);
- }
-}
-
-// triadic variant specifies try(), filter(U32, struct _EXCEPTION_POINTERS*),
-// handler(U32, const std::string& stacktrace)
-// stacktrace may or may not be available
-template <typename TRYCODE, typename FILTER, typename HANDLER>
-auto catcher(TRYCODE&& trycode, FILTER&& filter, HANDLER&& handler)
-{
- // Construct and destroy this stacktrace string in the outer function
- // because we can't do either in the function with __try/__except.
- std::string stacktrace;
- return catcher_inner(stacktrace,
- std::forward<TRYCODE>(trycode),
- std::forward<FILTER>(filter),
- std::forward<HANDLER>(handler));
-}
-// common_filter() handles the typical case in which we want our handler
-// clause to handle only Structured Exceptions rather than explicitly-thrown
-// C++ exceptions
-U32 common_filter(U32 code, struct _EXCEPTION_POINTERS*);
-
-// dyadic variant specifies try(), handler(U32, stacktrace), assumes common_filter()
-template <typename TRYCODE, typename HANDLER>
-auto catcher(TRYCODE&& trycode, HANDLER&& handler)
-{
- return catcher(std::forward<TRYCODE>(trycode),
- common_filter,
- std::forward<HANDLER>(handler));
-}
-
-// monadic variant specifies try(), assumes default filter and handler
-template <typename TRYCODE>
-auto catcher(TRYCODE&& trycode)
-{
- return catcher(std::forward<TRYCODE>(trycode), rethrow);
-}
-
-[[noreturn]] void rethrow(U32 code, const std::string& stacktrace);
-
-#else // not LL_WINDOWS -----------------------------------------------------
-
-template <typename TRYCODE, typename FILTER, typename HANDLER>
-auto catcher(TRYCODE&& trycode, FILTER&&, HANDLER&&)
-{
- return std::forward<TRYCODE>(trycode)();
-}
-
-template <typename TRYCODE, typename HANDLER>
-auto catcher(TRYCODE&& trycode, HANDLER&&)
-{
- return std::forward<TRYCODE>(trycode)();
-}
-
-template <typename TRYCODE>
-auto catcher(TRYCODE&& trycode)
-{
- return std::forward<TRYCODE>(trycode)();
-}
+#if LL_WINDOWS
-#endif // not LL_WINDOWS -----------------------------------------------------
+// SEH exception filtering for use in __try __except
+// Separates C++ exceptions from C SEH exceptions
+// Todo: might be good idea to do some kind of seh_to_msc_wrapper(function, ARGS&&);
+U32 msc_exception_filter(U32 code, struct _EXCEPTION_POINTERS *exception_infop);
-} // namespace LL::seh
-} // namespace LL
+#endif //LL_WINDOWS
#endif /* ! defined(LL_LLEXCEPTION_H) */
diff --git a/indra/llcommon/llsdjson.cpp b/indra/llcommon/llsdjson.cpp
index 655869a704..a4b45ed80d 100644
--- a/indra/llcommon/llsdjson.cpp
+++ b/indra/llcommon/llsdjson.cpp
@@ -35,7 +35,11 @@
#include "llerror.h"
#include "../llmath/llmath.h"
+#if LL_WINDOWS
+#include <boost/json.hpp>
+#else
#include <boost/json/src.hpp>
+#endif
//=========================================================================
LLSD LlsdFromJson(const boost::json::value& val)
diff --git a/indra/llcommon/llwin32headers.h b/indra/llcommon/llwin32headers.h
index df433deb7a..32139821d5 100644
--- a/indra/llcommon/llwin32headers.h
+++ b/indra/llcommon/llwin32headers.h
@@ -29,6 +29,7 @@
#ifdef LL_WINDOWS
#include <windows.h> // Does not include winsock.h because WIN32_LEAN_AND_MEAN is defined
+#include <ws2tcpip.h>
#include <winsock2.h> // Requires windows.h
#endif
diff --git a/indra/llrender/llfontfreetype.cpp b/indra/llrender/llfontfreetype.cpp
index 41d0a1af31..e93c98970b 100644
--- a/indra/llrender/llfontfreetype.cpp
+++ b/indra/llrender/llfontfreetype.cpp
@@ -32,7 +32,7 @@
// Freetype stuff
#include <ft2build.h>
#ifdef LL_WINDOWS
-#include <freetype2\freetype\ftsystem.h>
+#include <freetype/ftsystem.h>
#endif
#include "llfontfreetypesvg.h"
diff --git a/indra/llrender/llgl.cpp b/indra/llrender/llgl.cpp
index 70a28a1740..ac66faaf5a 100644
--- a/indra/llrender/llgl.cpp
+++ b/indra/llrender/llgl.cpp
@@ -238,8 +238,6 @@ PFNWGLBLITCONTEXTFRAMEBUFFERAMDPROC wglBlitContextFramebufferAMD = n
PFNWGLSWAPINTERVALEXTPROC wglSwapIntervalEXT = nullptr;
PFNWGLGETSWAPINTERVALEXTPROC wglGetSwapIntervalEXT = nullptr;
-/*
-
// GL_VERSION_1_2
//PFNGLDRAWRANGEELEMENTSPROC glDrawRangeElements = nullptr;
//PFNGLTEXIMAGE3DPROC glTexImage3D = nullptr;
@@ -984,7 +982,6 @@ PFNGLMULTIDRAWARRAYSINDIRECTCOUNTPROC glMultiDrawArraysIndirectCount = nullpt
PFNGLMULTIDRAWELEMENTSINDIRECTCOUNTPROC glMultiDrawElementsIndirectCount = nullptr;
PFNGLPOLYGONOFFSETCLAMPPROC glPolygonOffsetClamp = nullptr;
-*/
#endif
LLGLManager gGLManager;
@@ -1434,7 +1431,6 @@ void LLGLManager::initExtensions()
mInited = true;
-/*
#if LL_WINDOWS
LL_DEBUGS("RenderInit") << "GL Probe: Getting symbols" << LL_ENDL;
@@ -2272,7 +2268,6 @@ void LLGLManager::initExtensions()
glPolygonOffsetClamp = (PFNGLPOLYGONOFFSETCLAMPPROC)GLH_EXT_GET_PROC_ADDRESS("glPolygonOffsetClamp");
#endif
-*/
}
void rotate_quat(LLQuaternion& rotation)
diff --git a/indra/llwindow/CMakeLists.txt b/indra/llwindow/CMakeLists.txt
index 1f0820a9f6..6debd54665 100644
--- a/indra/llwindow/CMakeLists.txt
+++ b/indra/llwindow/CMakeLists.txt
@@ -55,6 +55,7 @@ set(llwindow_LINK_LIBRARIES
llfilesystem
llxml
ll::glm
+ ll::glext
ll::uilibraries
ll::SDL
)
@@ -63,7 +64,7 @@ include_directories(${CMAKE_SOURCE_DIR}/llrender)
# Libraries on which this library depends, needed for Linux builds
# Sort by high-level to low-level
-if (NOT DARWIN)
+if (NOT (DARWIN OR WINDOWS))
list(APPEND viewer_SOURCE_FILES
llkeyboardsdl.cpp
llwindowsdl.cpp
diff --git a/indra/llwindow/llwindowwin32.cpp b/indra/llwindow/llwindowwin32.cpp
index a781e638ee..4fca74497f 100644
--- a/indra/llwindow/llwindowwin32.cpp
+++ b/indra/llwindow/llwindowwin32.cpp
@@ -160,7 +160,18 @@ HGLRC SafeCreateContext(HDC &hdc)
GLuint SafeChoosePixelFormat(HDC &hdc, const PIXELFORMATDESCRIPTOR *ppfd)
{
- return LL::seh::catcher([hdc, ppfd]{ return ChoosePixelFormat(hdc, ppfd); });
+ __try
+ {
+ return ChoosePixelFormat(hdc, ppfd);
+ }
+ __except (EXCEPTION_EXECUTE_HANDLER)
+ {
+ // convert to C++ styled exception
+ // C exception don't allow classes, so it's a regular char array
+ char integer_string[32];
+ sprintf(integer_string, "SEH, code: %lu\n", GetExceptionCode());
+ throw std::exception(integer_string);
+ }
}
//static
diff --git a/indra/newview/CMakeLists.txt b/indra/newview/CMakeLists.txt
index 32afa2ba5f..6657eee0b2 100644
--- a/indra/newview/CMakeLists.txt
+++ b/indra/newview/CMakeLists.txt
@@ -1492,7 +1492,7 @@ if (DARWIN)
list(APPEND viewer_SOURCE_FILES ${viewer_RESOURCE_FILES})
endif (DARWIN)
-if (NOT DARWIN)
+if (NOT (DARWIN OR WINDOWS))
LIST(APPEND viewer_SOURCE_FILES llappviewerlinux.cpp)
set_source_files_properties(
llappviewerlinux.cpp
@@ -2045,8 +2045,9 @@ endif()
set(ARTWORK_DIR ${CMAKE_CURRENT_SOURCE_DIR} CACHE PATH
"Path to artwork files.")
-set_source_files_properties(llinventorygallery.cpp PROPERTIES COMPILE_FLAGS
- -Wno-unused-but-set-variable)
+if (NOT WINDOWS)
+ set_source_files_properties(llinventorygallery.cpp PROPERTIES COMPILE_FLAGS -Wno-unused-but-set-variable)
+endif ()
if (CMAKE_CXX_COMPILER_ID MATCHES Clang)
set_source_files_properties(llappviewerlinux.cpp PROPERTIES
COMPILE_FLAGS -Wno-dangling-gsl
diff --git a/indra/newview/ViewerInstall.cmake b/indra/newview/ViewerInstall.cmake
index 1281136cef..353ec290ec 100644
--- a/indra/newview/ViewerInstall.cmake
+++ b/indra/newview/ViewerInstall.cmake
@@ -90,16 +90,6 @@ install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/${VIEWER_BINARY_NAME}
DESTINATION bin
)
-if (${LINUX_DISTRO} MATCHES arch)
- install(PROGRAMS linux_tools/launch_url.sh
- DESTINATION lib/${VIEWER_BINARY_NAME}
- )
-else (${LINUX_DISTRO} MATCHES arch)
- install(PROGRAMS linux_tools/launch_url.sh
- DESTINATION libexec/${VIEWER_BINARY_NAME}
- )
-endif (${LINUX_DISTRO} MATCHES arch)
-
if (LINUX)
if (${LINUX_DISTRO} MATCHES debian OR (${LINUX_DISTRO} MATCHES ubuntu))
set(_LIB lib/${ARCH}-linux-gnu)
diff --git a/indra/newview/linux_tools/launch_url.sh b/indra/newview/linux_tools/launch_url.sh
index 7c4ebf2291..404ea36f26 100755
--- a/indra/newview/linux_tools/launch_url.sh
+++ b/indra/newview/linux_tools/launch_url.sh
@@ -61,7 +61,6 @@ fi
# will be tried first, which is a debian alternative.
BROWSER_COMMANDS=" \
x-www-browser \
- chrome \
firefox \
mozilla-firefox \
iceweasel \
diff --git a/indra/newview/llappviewer.cpp b/indra/newview/llappviewer.cpp
index 7580100977..3f716cc4ef 100644
--- a/indra/newview/llappviewer.cpp
+++ b/indra/newview/llappviewer.cpp
@@ -131,10 +131,12 @@
#include "stringize.h"
#include "llcoros.h"
#include "llexception.h"
+#if !LL_WINDOWS
#if LL_DARWIN || LL_LINUX || __FreeBSD__
#include "cef/dullahan_version.h"
-#endif
+#endif // LL_DARWIN || LL_LINUX || __FreeBSD__
#include "vlc/libvlc_version.h"
+#endif // !LL_WINDOWS
#if LL_DARWIN
#if LL_SDL
@@ -1544,7 +1546,15 @@ bool LLAppViewer::doFrame()
if(fpsLimitSleepFor)
{
+#if LL_WINDOWS
+ U64 time1 = 0, time2 = 0;
+ QueryPerformanceCounter((LARGE_INTEGER *)&time1);
+ do {
+ QueryPerformanceCounter((LARGE_INTEGER *)&time2);
+ } while ((time2-time1) < fpsLimitSleepFor);
+#else
usleep(fpsLimitSleepFor);
+#endif
}
// yield some time to the os based on command line option
@@ -3453,7 +3463,7 @@ LLSD LLAppViewer::getViewerInfo() const
info["LIBCEF_VERSION"] = "Undefined";
#endif
-//#if !LL_LINUX
+#if !LL_WINDOWS
std::ostringstream vlc_ver_codec;
vlc_ver_codec << LIBVLC_VERSION_MAJOR;
vlc_ver_codec << ".";
@@ -3461,11 +3471,9 @@ LLSD LLAppViewer::getViewerInfo() const
vlc_ver_codec << ".";
vlc_ver_codec << LIBVLC_VERSION_REVISION;
info["LIBVLC_VERSION"] = vlc_ver_codec.str();
-/*
#else
info["LIBVLC_VERSION"] = "Undefined";
#endif
-*/
S32 packets_in = (S32)LLViewerStats::instance().getRecording().getSum(LLStatViewer::PACKETS_IN);
if (packets_in > 0)
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index ef609026ad..4f5fa53312 100644
--- a/indra/newview/llappviewerwin32.cpp
+++ b/indra/newview/llappviewerwin32.cpp
@@ -396,10 +396,17 @@ void ll_nvapi_init(NvDRSSessionHandle hSession)
}
}
-int APIENTRY wWinMain(HINSTANCE hInstance,
- HINSTANCE hPrevInstance,
- PWSTR pCmdLine,
- int nCmdShow)
+//#define DEBUGGING_SEH_FILTER 1
+#if DEBUGGING_SEH_FILTER
+# define WINMAIN DebuggingWinMain
+#else
+# define WINMAIN wWinMain
+#endif
+
+int APIENTRY WINMAIN(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ PWSTR pCmdLine,
+ int nCmdShow)
{
// Call Tracy first thing to have it allocate memory
// https://github.com/wolfpld/tracy/issues/196
@@ -548,6 +555,27 @@ int APIENTRY wWinMain(HINSTANCE hInstance,
return 0;
}
+#if DEBUGGING_SEH_FILTER
+// The compiler doesn't like it when you use __try/__except blocks
+// in a method that uses object destructors. Go figure.
+// This winmain just calls the real winmain inside __try.
+// The __except calls our exception filter function. For debugging purposes.
+int APIENTRY wWinMain(HINSTANCE hInstance,
+ HINSTANCE hPrevInstance,
+ PWSTR lpCmdLine,
+ int nCmdShow)
+{
+ __try
+ {
+ WINMAIN(hInstance, hPrevInstance, lpCmdLine, nCmdShow);
+ }
+ __except( viewer_windows_exception_handler( GetExceptionInformation() ) )
+ {
+ _tprintf( _T("Exception handled.\n") );
+ }
+}
+#endif
+
void LLAppViewerWin32::disableWinErrorReporting()
{
std::string executable_name = gDirUtilp->getExecutableFilename();
diff --git a/indra/newview/skins/default/xui/en/floater_about.xml b/indra/newview/skins/default/xui/en/floater_about.xml
index 09b134eac5..40cb1b2c43 100644
--- a/indra/newview/skins/default/xui/en/floater_about.xml
+++ b/indra/newview/skins/default/xui/en/floater_about.xml
@@ -70,7 +70,7 @@
follows="all"
left="10"
name="megapahit_credits_panel"
- height="420"
+ height="405"
top="10">
<text
follows="top|left|right"
@@ -84,35 +84,27 @@
Megapahit is brought to you by (in order of appearance):
</text>
<text_editor
- enabled="false"
- follows="top|left"
- height="260"
- bg_readonly_color="Transparent"
- left="5"
- text_color="LtGray"
- max_length="65536"
- top_pad="5"
- width="545"
- word_wrap="true">
-Erik Kundiman
-LinneNoir
-milo (observeur)
-Fritigern Gothly
-Kou Ayashi
-Hadet Sonnenkern
-Remmy (Secret Foxtail)
-Eris Ravenwood
-gwigz (nya)
-EmilyAmiee
-Bavid Dailey
-Aria (Tashia Redrose)
-Cate (32a)
-Hiroo Ono
-Melodey
-Keysin (scoutkeysin)
-Yikes Lopez
-~ ( ^-^ ) ~ (cutie_qu)
- </text_editor>
+ enabled="false"
+ font="Monospace"
+ follows="top|left"
+ height="200"
+ bg_readonly_color="Transparent"
+ left="5"
+ text_color="LtGray"
+ max_length="65536"
+ top_pad="5"
+ width="475"
+ word_wrap="false">
+ Erik Kundiman EmilyAmiee
+ LinneNoir Bavid Dailey
+ milo (observeur) Aria (Tashia Redrose)
+ Fritigern Gothly Cate (32a)
+ Kou Ayashi Hiroo Ono
+ Hadet Sonnenkern Melodey
+ Remmy (Secret Foxtail) Keysin (scoutkeysin)
+ Eris Ravenwood Yikes Lopez
+ gwigz (nya) ~ ( ^-^ ) ~ (cutie_qu)
+ </text_editor>
<text
follows="top|left"
font.style="BOLD"
@@ -206,27 +198,27 @@ Dummy Name replaced at run time
top="5"
width="465"
word_wrap="true">
- 3Dconnexion SDK Copyright (C) 1992-2009 3Dconnexion
- APR Copyright (C) 2011 The Apache Software Foundation
- Collada DOM Copyright 2006 Sony Computer Entertainment Inc.
- cURL Copyright (C) 1996-2010, Daniel Stenberg, (daniel@haxx.se)
- expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
- FreeType Copyright (C) 1996-2002, 2006 David Turner, Robert Wilhelm, and Werner Lemberg.
- GL Copyright (C) 1999-2004 Brian Paul.
- jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
- llphysicsextensions_tpv Copyright (c) 2010, Linden Research, Inc.
- meshoptimizer Copyright (c) 2016-2021 Arseny Kapoulkine
- ogg/vorbis Copyright (C) 2002, Xiphophorus
- OpenSSL Copyright (C) 1998-2008 The OpenSSL Project.
- PCRE Copyright (c) 1997-2012 University of Cambridge
- SDL Copyright (C) 1997-2024 Sam Lantinga
- SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
- xxHash Copyright (C) 2012-2020 Yann Collet.
- zlib Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler.
+3Dconnexion SDK Copyright (C) 1992-2009 3Dconnexion
+APR Copyright (C) 2011 The Apache Software Foundation
+Collada DOM Copyright 2006 Sony Computer Entertainment Inc.
+cURL Copyright (C) 1996-2010, Daniel Stenberg, (daniel@haxx.se)
+expat Copyright (C) 1998, 1999, 2000 Thai Open Source Software Center Ltd.
+FreeType Copyright (C) 1996-2002, 2006 David Turner, Robert Wilhelm, and Werner Lemberg.
+GL Copyright (C) 1999-2004 Brian Paul.
+jpeglib Copyright (C) 1991-1998, Thomas G. Lane.
+llphysicsextensions_tpv Copyright (c) 2010, Linden Research, Inc.
+meshoptimizer Copyright (c) 2016-2021 Arseny Kapoulkine
+ogg/vorbis Copyright (C) 2002, Xiphophorus
+OpenSSL Copyright (C) 1998-2008 The OpenSSL Project.
+PCRE Copyright (c) 1997-2012 University of Cambridge
+SDL Copyright (C) 1997-2024 Sam Lantinga
+SSLeay Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
+xxHash Copyright (C) 2012-2020 Yann Collet.
+zlib Copyright (C) 1995-2012 Jean-loup Gailly and Mark Adler.
- This software contains source code provided by NVIDIA Corporation.
+This software contains source code provided by NVIDIA Corporation.
- All rights reserved. See licenses.txt for details.
+All rights reserved. See licenses.txt for details.
</text_editor>
</panel>
</tab_container>
diff --git a/indra/test/test.cpp b/indra/test/test.cpp
index 6e280819df..09147a65a3 100644
--- a/indra/test/test.cpp
+++ b/indra/test/test.cpp
@@ -36,7 +36,6 @@
#include "linden_common.h"
#include "llerrorcontrol.h"
-#include "llexception.h"
#include "lltut.h"
#include "chained_callback.h"
#include "stringize.h"
@@ -57,6 +56,13 @@
#include <boost/iostreams/tee.hpp>
#include <boost/iostreams/stream.hpp>
+// On Mac, got:
+// #error "Boost.Stacktrace requires `_Unwind_Backtrace` function. Define
+// `_GNU_SOURCE` macro or `BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED` if
+// _Unwind_Backtrace is available without `_GNU_SOURCE`."
+#define BOOST_STACKTRACE_GNU_SOURCE_NOT_REQUIRED
+#include <boost/stacktrace.hpp>
+
#include <fstream>
void wouldHaveCrashed(const std::string& message);
@@ -506,6 +512,64 @@ void wouldHaveCrashed(const std::string& message)
static LLTrace::ThreadRecorder* sMasterThreadRecorder = NULL;
+// this is used in platform-generic code -- define outside #if LL_WINDOWS
+struct Windows_SEH_exception: public std::runtime_error
+{
+ Windows_SEH_exception(const std::string& what): std::runtime_error(what) {}
+};
+
+#if LL_WINDOWS
+
+static constexpr U32 STATUS_MSC_EXCEPTION = 0xE06D7363; // compiler specific
+static constexpr U32 STATUS_STACK_FULL = 0xC00000FD;
+
+U32 seh_filter(U32 code, struct _EXCEPTION_POINTERS*)
+{
+ if (code == STATUS_MSC_EXCEPTION)
+ {
+ // C++ exception, go on -- but TUT is supposed to have caught those already?!
+ return EXCEPTION_CONTINUE_SEARCH;
+ }
+ else
+ {
+ // This is a non-C++ exception, e.g. hardware check.
+ // By the time the handler gets control, the stack has been unwound,
+ // so report the stack trace now at filter() time.
+ // Sadly, even though, at the time of this writing, stack overflow is
+ // the problem we would most like to diagnose, calling another
+ // function when the stack is already blown only terminates us faster.
+ if (code != STATUS_STACK_FULL)
+ {
+ std::cerr << boost::stacktrace::stacktrace() << std::endl;
+ }
+ // pass control into the handler block
+ return EXCEPTION_EXECUTE_HANDLER;
+ }
+}
+
+template <typename CALLABLE0, typename CALLABLE1>
+void seh_catcher(CALLABLE0&& trycode, CALLABLE1&& handler)
+{
+ __try
+ {
+ trycode();
+ }
+ __except (seh_filter(GetExceptionCode(), GetExceptionInformation()))
+ {
+ handler(GetExceptionCode());
+ }
+}
+
+#else // not LL_WINDOWS
+
+template <typename CALLABLE0, typename CALLABLE1>
+void seh_catcher(CALLABLE0&& trycode, CALLABLE1&&)
+{
+ trycode();
+}
+
+#endif // not LL_WINDOWS
+
int main(int argc, char **argv)
{
ll_init_apr();
@@ -638,7 +702,7 @@ int main(int argc, char **argv)
// a chained_callback subclass must be linked with previous
mycallback->link();
- LL::seh::catcher(
+ seh_catcher(
// __try
[test_group]
{
@@ -652,7 +716,7 @@ int main(int argc, char **argv)
}
},
// __except
- [mycallback](U32 code, const std::string& /*stacktrace*/)
+ [mycallback](U32 code)
{
static std::map<U32, const char*> codes = {
{ 0xC0000005, "Access Violation" },