Boost upgrade to 1.52

This commit is contained in:
Latif Khalifa
2013-10-05 20:27:20 +02:00
parent 5f5943548b
commit 4118afc146
10 changed files with 119 additions and 65 deletions

View File

@@ -12,30 +12,73 @@ if (STANDALONE)
else (STANDALONE)
use_prebuilt_binary(boost)
set(Boost_INCLUDE_DIRS ${LIBS_PREBUILT_DIR}/${LL_ARCH_DIR}/include)
set(Boost_VERSION "1.52")
if (WINDOWS)
set(BOOST_VERSION 1_45)
set(BOOST_OPTIM_SUFFIX mt)
set(BOOST_DEBUG_SUFFIX mt-gd)
set(Boost_CONTEXT_LIBRARY
optimized libboost_context-mt
debug libboost_context-mt-gd)
set(Boost_FILESYSTEM_LIBRARY
optimized libboost_filesystem-mt
debug libboost_filesystem-mt-gd)
set(Boost_PROGRAM_OPTIONS_LIBRARY
optimized libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
debug libboost_program_options-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
optimized libboost_program_options-mt
debug libboost_program_options-mt-gd)
set(Boost_REGEX_LIBRARY
optimized libboost_regex-vc${MSVC_SUFFIX}-${BOOST_OPTIM_SUFFIX}-${BOOST_VERSION}
debug libboost_regex-vc${MSVC_SUFFIX}-${BOOST_DEBUG_SUFFIX}-${BOOST_VERSION})
elseif (DARWIN)
set(Boost_FILESYSTEM_LIBRARY boost_filesystem)
set(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options)
set(Boost_REGEX_LIBRARY boost_regex)
set(Boost_SYSTEM_LIBRARY boost_system)
set(Boost_DATE_TIME_LIBRARY boost_date_time)
optimized libboost_regex-mt
debug libboost_regex-mt-gd)
set(Boost_SIGNALS_LIBRARY
optimized libboost_signals-mt
debug libboost_signals-mt-gd)
set(Boost_SYSTEM_LIBRARY
optimized libboost_system-mt
debug libboost_system-mt-gd)
set(Boost_THREAD_LIBRARY
optimized libboost_thread-mt
debug libboost_thread-mt-gd)
elseif (LINUX)
set(Boost_FILESYSTEM_LIBRARY boost_filesystem-mt)
set(Boost_PROGRAM_OPTIONS_LIBRARY boost_program_options-mt)
set(Boost_REGEX_LIBRARY boost_regex-mt)
set(Boost_SYSTEM_LIBRARY boost_system-mt)
set(Boost_DATE_TIME_LIBRARY boost_date_time-mt)
set(Boost_CONTEXT_LIBRARY
optimized boost_context-mt
debug boost_context-mt-d)
set(Boost_FILESYSTEM_LIBRARY
optimized boost_filesystem-mt
debug boost_filesystem-mt-d)
set(Boost_PROGRAM_OPTIONS_LIBRARY
optimized boost_program_options-mt
debug boost_program_options-mt-d)
set(Boost_REGEX_LIBRARY
optimized boost_regex-mt
debug boost_regex-mt-d)
set(Boost_SIGNALS_LIBRARY
optimized boost_signals-mt
debug boost_signals-mt-d)
set(Boost_SYSTEM_LIBRARY
optimized boost_system-mt
debug boost_system-mt-d)
set(Boost_THREAD_LIBRARY
optimized boost_thread-mt
debug boost_thread-mt-d)
elseif (DARWIN)
set(Boost_CONTEXT_LIBRARY
optimized boost_context-mt
debug boost_context-mt-d)
set(Boost_FILESYSTEM_LIBRARY
optimized boost_filesystem-mt
debug boost_filesystem-mt-d)
set(Boost_PROGRAM_OPTIONS_LIBRARY
optimized boost_program_options-mt
debug boost_program_options-mt-d)
set(Boost_REGEX_LIBRARY
optimized boost_regex-mt
debug boost_regex-mt-d)
set(Boost_SIGNALS_LIBRARY
optimized boost_signals-mt
debug boost_signals-mt-d)
set(Boost_SYSTEM_LIBRARY
optimized boost_system-mt
debug boost_system-mt-d)
set(Boost_THREAD_LIBRARY
optimized boost_thread-mt
debug boost_thread-mt-d)
endif (WINDOWS)
endif (STANDALONE)

View File

@@ -28,10 +28,6 @@ else (STANDALONE)
set(COLLADADOM_LIBRARIES
debug libcollada14dom22-d
optimized libcollada14dom22
debug libboost_filesystem-vc100-mt-gd-1_45.lib
optimized libboost_filesystem-vc100-mt-1_45.lib
debug libboost_system-vc100-mt-gd-1_45.lib
optimized libboost_system-vc100-mt-1_45.lib
)
else (WINDOWS)
set(COLLADADOM_LIBRARIES

View File

@@ -273,6 +273,7 @@ target_link_libraries(
${EXPAT_LIBRARIES}
${ZLIB_LIBRARIES}
${WINDOWS_LIBRARIES}
${Boost_CONTEXT_LIBRARY}
${Boost_REGEX_LIBRARY}
${CORESERVICES_LIBRARY}
)

View File

@@ -39,7 +39,12 @@
#include "llerror.h"
#include "stringize.h"
LLCoros::LLCoros()
LLCoros::LLCoros():
// MAINT-2724: default coroutine stack size too small on Windows.
// Previously we used
// boost::context::guarded_stack_allocator::default_stacksize();
// empirically this is 64KB on Windows and Linux. Try quadrupling.
mStackSize(256*1024)
{
// Register our cleanup() method for "mainloop" ticks
LLEventPumps::instance().obtain("mainloop").listen(
@@ -55,7 +60,7 @@ bool LLCoros::cleanup(const LLSD&)
// since last tick?
if (mi->second->exited())
{
LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL;
LL_INFOS("LLCoros") << "LLCoros: cleaning up coroutine " << mi->first << LL_ENDL;
// The erase() call will invalidate its passed iterator value --
// so increment mi FIRST -- but pass its original value to
// erase(). This is what postincrement is all about.
@@ -89,7 +94,7 @@ std::string LLCoros::generateDistinctName(const std::string& prefix) const
{
if (mCoros.find(name) == mCoros.end())
{
LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL;
LL_INFOS("LLCoros") << "LLCoros: launching coroutine " << name << LL_ENDL;
return name;
}
}
@@ -115,7 +120,7 @@ std::string LLCoros::getNameByID(const void* self_id) const
// passed to us comes.
for (CoroMap::const_iterator mi(mCoros.begin()), mend(mCoros.end()); mi != mend; ++mi)
{
namespace coro_private = boost::coroutines::detail;
namespace coro_private = boost::dcoroutines::detail;
if (static_cast<void*>(coro_private::coroutine_accessor::get_impl(const_cast<coro&>(*mi->second)).get())
== self_id)
{
@@ -125,6 +130,12 @@ std::string LLCoros::getNameByID(const void* self_id) const
return "";
}
void LLCoros::setStackSize(S32 stacksize)
{
LL_INFOS("LLCoros") << "Setting coroutine stack size to " << stacksize << LL_ENDL;
mStackSize = stacksize;
}
/*****************************************************************************
* MUST BE LAST
*****************************************************************************/

View File

@@ -29,7 +29,7 @@
#if ! defined(LL_LLCOROS_H)
#define LL_LLCOROS_H
#include <boost/coroutine/coroutine.hpp>
#include <boost/dcoroutine/coroutine.hpp>
#include "llsingleton.h"
#include <boost/ptr_container/ptr_map.hpp>
#include <string>
@@ -78,8 +78,8 @@
class LL_COMMON_API LLCoros: public LLSingleton<LLCoros>
{
public:
/// Canonical boost::coroutines::coroutine signature we use
typedef boost::coroutines::coroutine<void()> coro;
/// Canonical boost::dcoroutines::coroutine signature we use
typedef boost::dcoroutines::coroutine<void()> coro;
/// Canonical 'self' type
typedef coro::self self;
@@ -125,7 +125,7 @@ public:
template <typename CALLABLE>
std::string launch(const std::string& prefix, const CALLABLE& callable)
{
return launchImpl(prefix, new coro(callable));
return launchImpl(prefix, new coro(callable, mStackSize));
}
/**
@@ -152,6 +152,9 @@ public:
/// getName() by self.get_id()
std::string getNameByID(const void* self_id) const;
/// for delayed initialization
void setStackSize(S32 stacksize);
private:
friend class LLSingleton<LLCoros>;
LLCoros();
@@ -159,6 +162,7 @@ private:
std::string generateDistinctName(const std::string& prefix) const;
bool cleanup(const LLSD&);
S32 mStackSize;
typedef boost::ptr_map<std::string, coro> CoroMap;
CoroMap mCoros;
};

View File

@@ -29,8 +29,8 @@
#if ! defined(LL_LLEVENTCORO_H)
#define LL_LLEVENTCORO_H
#include <boost/coroutine/coroutine.hpp>
#include <boost/coroutine/future.hpp>
#include <boost/dcoroutine/coroutine.hpp>
#include <boost/dcoroutine/future.hpp>
#include <boost/optional.hpp>
#include <string>
#include <stdexcept>
@@ -206,13 +206,13 @@ LLSD postAndWait(SELF& self, const LLSD& event, const LLEventPumpOrPumpName& req
const LLEventPumpOrPumpName& replyPump, const LLSD& replyPumpNamePath=LLSD())
{
// declare the future
boost::coroutines::future<LLSD> future(self);
boost::dcoroutines::future<LLSD> future(self);
// make a callback that will assign a value to the future, and listen on
// the specified LLEventPump with that callback
std::string listenerName(LLEventDetail::listenerNameForCoro(self));
LLTempBoundListener connection(
replyPump.getPump().listen(listenerName,
voidlistener(boost::coroutines::make_callback(future))));
voidlistener(boost::dcoroutines::make_callback(future))));
// skip the "post" part if requestPump is default-constructed
if (requestPump)
{
@@ -257,7 +257,7 @@ namespace LLEventDetail
* This helper is specifically for the two-pump version of waitForEventOn().
* We use a single future object, but we want to listen on two pumps with it.
* Since we must still adapt from (the callable constructed by)
* boost::coroutines::make_callback() (void return) to provide an event
* boost::dcoroutines::make_callback() (void return) to provide an event
* listener (bool return), we've adapted LLVoidListener for the purpose. The
* basic idea is that we construct a distinct instance of WaitForEventOnHelper
* -- binding different instance data -- for each of the pumps. Then, when a
@@ -331,16 +331,16 @@ LLEventWithID postAndWait2(SELF& self, const LLSD& event,
const LLSD& replyPump1NamePath=LLSD())
{
// declare the future
boost::coroutines::future<LLEventWithID> future(self);
boost::dcoroutines::future<LLEventWithID> future(self);
// either callback will assign a value to this future; listen on
// each specified LLEventPump with a callback
std::string name(LLEventDetail::listenerNameForCoro(self));
LLTempBoundListener connection0(
replyPump0.getPump().listen(name + "a",
LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 0)));
LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 0)));
LLTempBoundListener connection1(
replyPump1.getPump().listen(name + "b",
LLEventDetail::wfeoh(boost::coroutines::make_callback(future), 1)));
LLEventDetail::wfeoh(boost::dcoroutines::make_callback(future), 1)));
// skip the "post" part if requestPump is default-constructed
if (requestPump)
{

View File

@@ -56,14 +56,7 @@ LLShaderMgr::LLShaderMgr()
{
{
const std::string dumpdir = gDirUtilp->getExpandedFilename(LL_PATH_LOGS,"shader_dump")+gDirUtilp->getDirDelimiter();
try
{
boost::filesystem::remove_all(dumpdir);
}
catch(const boost::filesystem::filesystem_error& e)
{
llinfos << "boost::filesystem::remove_all(\""+dumpdir+"\") failed: '" + e.code().message() + "'" << llendl;
}
gDirUtilp->deleteDirAndContents(dumpdir);
}
}

View File

@@ -111,7 +111,7 @@ std::vector<std::string> LLDir::getFilesInDir(const std::string &dirname)
{
if (boost::filesystem::is_regular_file(dir_itr->status()))
{
v.push_back(dir_itr->path().filename().c_str());
v.push_back(dir_itr->path().filename().string());
}
}
}
@@ -180,14 +180,19 @@ S32 LLDir::deleteFilesInDir(const std::string &dirname, const std::string &mask)
U32 LLDir::deleteDirAndContents(const std::string& dir_name)
{
//Removes the directory and its contents. Returns number of files removed.
#if defined(LL_LINUX)
// Singu TODO: Workaround for boost crashing on linux
deleteFilesInDir(dir_name, "*");
boost::filesystem::remove(dir_name);
return 1;
#else
return boost::filesystem::remove_all(dir_name);
#endif
// Singu Note: boost::filesystem throws exceptions
S32 res = 0;
try
{
res = boost::filesystem::remove_all(dir_name);
}
catch(const boost::filesystem::filesystem_error& e)
{
llinfos << "boost::filesystem::remove_all(\"" + dir_name + "\") failed: '" + e.code().message() + "'" << llendl;
}
return res;
}
const std::string LLDir::findFile(const std::string &filename,

View File

@@ -1589,6 +1589,7 @@ target_link_libraries(${VIEWER_BINARY_NAME}
${LLCOMMON_LIBRARIES}
${NDOF_LIBRARY}
${viewer_LIBRARIES}
${Boost_CONTEXT_LIBRARY}
${Boost_FILESYSTEM_LIBRARY}
${Boost_PROGRAM_OPTIONS_LIBRARY}
${Boost_REGEX_LIBRARY}

View File

@@ -181,30 +181,30 @@
<key>darwin</key>
<map>
<key>md5sum</key>
<string>e859007376f28d699bfea420e44d02e3</string>
<string>b31c495d5e77daa09394b370fc228312</string>
<key>url</key>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.45.0-darwin-20110304.tar.bz2</uri>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-darwin-20130221.tar.bz2</uri>
</map>
<key>linux</key>
<map>
<key>md5sum</key>
<string>6e71c78873593aea2ec5c68dcfde0167</string>
<string>c11e7bd8c35401f240338ebea5390499</string>
<key>url</key>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.45.0-linux-20110604.tar.bz2</uri>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-linux-20130222.tar.bz2</uri>
</map>
<key>linux64</key>
<map>
<key>md5sum</key>
<string>ac6e5b52d5cf13443607c09d8c62b6c5</string>
<string>fab1924c7c83c2fb945957b0a9a211e5</string>
<key>url</key>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.48.0-linux-x86_64-20120719.tar.bz2</uri>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-linux64-20130531.tar.bz2</uri>
</map>
<key>windows</key>
<map>
<key>md5sum</key>
<string>ba3165f8e51c7a59f55c7464932fbfc1</string>
<string>eb13ff93db50d4b08648a5c78ba05310</string>
<key>url</key>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.45.0-windows-20120704.tar.bz2</uri>
<uri>https://bitbucket.org/SingularityViewer/libraries/downloads/boost-1.52.0-windows-20130221.tar.bz2</uri>
</map>
</map>
</map>