diff options
Diffstat (limited to 'indra')
-rw-r--r-- | indra/cmake/APR.cmake | 2 | ||||
-rw-r--r-- | indra/cmake/Boost.cmake | 5 | ||||
-rw-r--r-- | indra/cmake/CMakeLists.txt | 1 | ||||
-rw-r--r-- | indra/cmake/GLEXT.cmake | 4 | ||||
-rw-r--r-- | indra/cmake/LLPrimitive.cmake | 42 | ||||
-rw-r--r-- | indra/cmake/LLWindow.cmake | 2 | ||||
-rw-r--r-- | indra/llcommon/always_return.h | 16 | ||||
-rw-r--r-- | indra/llcommon/llexception.cpp | 44 | ||||
-rw-r--r-- | indra/llcommon/llexception.h | 114 | ||||
-rw-r--r-- | indra/llcommon/llsdjson.cpp | 2 | ||||
-rw-r--r-- | indra/llcommon/llwin32headers.h | 1 | ||||
-rw-r--r-- | indra/llrender/llfontfreetype.cpp | 2 | ||||
-rw-r--r-- | indra/llrender/llgl.cpp | 5 | ||||
-rw-r--r-- | indra/llwindow/CMakeLists.txt | 3 | ||||
-rw-r--r-- | indra/llwindow/llwindowwin32.cpp | 13 | ||||
-rw-r--r-- | indra/newview/CMakeLists.txt | 9 | ||||
-rw-r--r-- | indra/newview/ViewerInstall.cmake | 10 | ||||
-rwxr-xr-x | indra/newview/linux_tools/launch_url.sh | 1 | ||||
-rw-r--r-- | indra/newview/llappviewer.cpp | 16 | ||||
-rw-r--r-- | indra/newview/llappviewerwin32.cpp | 36 | ||||
-rw-r--r-- | indra/test/test.cpp | 70 |
21 files changed, 191 insertions, 207 deletions
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..df5f05a200 100644 --- a/indra/cmake/Boost.cmake +++ b/indra/cmake/Boost.cmake @@ -20,12 +20,15 @@ target_link_libraries( ll::boost INTERFACE boost_context${sfx} boost_fiber${sfx} boost_filesystem${sfx} + boost_json${sfx} boost_program_options${sfx} - boost_regex${sfx} boost_system${sfx} boost_thread${sfx} boost_url${sfx} ) +if (NOT WINDOWS) + 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..6a24f62619 100644 --- a/indra/cmake/LLPrimitive.cmake +++ b/indra/cmake/LLPrimitive.cmake @@ -22,7 +22,7 @@ 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) @@ -41,13 +41,16 @@ elseif ( NOT WINDOWS ) ) if ( WINDOWS ) execute_process( - COMMAND sed -i "s/SHARED/STATIC/g" CMakeLists.txt + COMMAND sed -i "s/SHARED/STATIC/" CMakeLists.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4 ) - set(BOOST_LIBRARY_SUFFIX -vc143-mt-x64-1_88) + execute_process( + COMMAND sed -i "/#include <cstdarg>/a #define WIN32" daeUtils.cpp + WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/dae + ) else () execute_process( - COMMAND sed -i "" -e "s/SHARED/STATIC/g" CMakeLists.txt + COMMAND sed -i "" -e "s/SHARED/STATIC/" CMakeLists.txt WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/3p-colladadom-2.3-r8/src/1.4 ) endif () @@ -55,6 +58,10 @@ elseif ( NOT WINDOWS ) 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) + 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 @@ -88,17 +95,34 @@ elseif ( NOT WINDOWS ) ${ARCH_PREBUILT_DIRS}/libcollada14dom.a ${ARCH_PREBUILT_DIRS_RELEASE}/libcollada14dom.a ) - file(WRITE ${PREBUILD_TRACKING_DIR}/colladadom_installed "${colladadom_installed}") + elseif ( 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 + ) 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) 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..a3f80b7c2e 100644 --- a/indra/llcommon/llsdjson.cpp +++ b/indra/llcommon/llsdjson.cpp @@ -35,7 +35,7 @@ #include "llerror.h" #include "../llmath/llmath.h" -#include <boost/json/src.hpp> +#include <boost/json.hpp> //========================================================================= 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 80f0b60f98..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 @@ -2196,7 +2197,7 @@ if (LINUX) set(CPACK_RPM_PACKAGE_REQUIRES "apr-util, boost-fiber, boost-program-options, boost-regex, boost-thread, boost-url, expat, fltk, mesa-libGLU, hunspell, libnghttp2, openjpeg2, SDL2, vlc-libs, vlc-plugins-base, libvorbis" CACHE STRING "RPM package requirements.") else () - set(CPACK_RPM_PACKAGE_REQUIRES "libapr-util1-0, libboost_fiber1_87_0, libboost_program_options1_87_0, libboost_regex1_87_0, libboost_thread1_87_0, libboost_url1_87_0, libboost_url1_87_0-x86-64-v3, expat, libfltk1_3, libGLU1, libhunspell-1_7-0, libnghttp2-14, openjpeg2, libSDL2-2_0-0, libvlc5, vlc-codecs, libvorbis0" + set(CPACK_RPM_PACKAGE_REQUIRES "libapr-util1-0, libboost_fiber1_88_0, libboost_program_options1_88_0, libboost_regex1_88_0, libboost_thread1_88_0, libboost_url1_88_0, libboost_url1_88_0-x86-64-v3, expat, libfltk1_3, libGLU1, libhunspell-1_7-0, libnghttp2-14, openjpeg2, libSDL2-2_0-0, libvlc5, vlc-codecs, libvorbis0" CACHE STRING "RPM package requirements.") endif () endif () 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/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" }, |