Browse Source

boost compatibility changes in msvc

cl-refactor
debris 10 years ago
parent
commit
fc8cb6d7af
  1. 17
      cmake/EthDependencies.cmake
  2. 12
      libdevcore/CMakeLists.txt
  3. 16
      libdevcore/CommonData.cpp

17
cmake/EthDependencies.cmake

@ -53,6 +53,23 @@ set(Boost_COMPILER -vc120)
find_package(Boost 1.55.0 REQUIRED COMPONENTS thread date_time system regex) find_package(Boost 1.55.0 REQUIRED COMPONENTS thread date_time system regex)
if (Boost_FOUND)
message(" - boost header: ${Boost_INCLUDE_DIRS}")
message(" - boost lib : ${Boost_LIBRARIES}")
endif()

12
libdevcore/CMakeLists.txt

@ -5,8 +5,9 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DSTATICLIB")
aux_source_directory(. SRC_LIST) aux_source_directory(. SRC_LIST)
include_directories(${LEVELDB_INCLUDE_DIR})
include_directories(..) include_directories(..)
include_directories(${LEVELDB_INCLUDE_DIR})
include_directories(${Boost_INCLUDE_DIRS})
set(EXECUTABLE devcore) set(EXECUTABLE devcore)
@ -18,16 +19,13 @@ else()
add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS}) add_library(${EXECUTABLE} SHARED ${SRC_LIST} ${HEADERS})
endif() endif()
target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARY})
target_link_libraries(${EXECUTABLE} ${Boost_SYSTEM_LIBRARY})
if (APPLE) if (APPLE)
# Latest mavericks boost libraries only come with -mt
target_link_libraries(${EXECUTABLE} boost_system-mt)
target_link_libraries(${EXECUTABLE} boost_filesystem-mt)
target_link_libraries(${EXECUTABLE} boost_thread-mt)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT})
elseif (UNIX) elseif (UNIX)
find_package(Boost 1.53 REQUIRED COMPONENTS thread system)
target_link_libraries(${EXECUTABLE} ${Boost_THREAD_LIBRARY} ${Boost_SYSTEM_LIBRARY})
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT}) target_link_libraries(${EXECUTABLE} ${CMAKE_THREAD_LIBS_INIT})
endif() endif()

16
libdevcore/CommonData.cpp

@ -89,13 +89,25 @@ bytes dev::fromHex(std::string const& _s)
{ {
ret.push_back(fromHex(_s[s++])); ret.push_back(fromHex(_s[s++]));
} }
catch (...){ ret.push_back(0); cwarn << boost::current_exception_diagnostic_information(); } catch (...)
{
ret.push_back(0);
// msvc does not support it
#ifndef BOOST_NO_EXCEPTIONS
cwarn << boost::current_exception_diagnostic_information();
#endif
}
for (unsigned i = s; i < _s.size(); i += 2) for (unsigned i = s; i < _s.size(); i += 2)
try try
{ {
ret.push_back((byte)(fromHex(_s[i]) * 16 + fromHex(_s[i + 1]))); ret.push_back((byte)(fromHex(_s[i]) * 16 + fromHex(_s[i + 1])));
} }
catch (...){ ret.push_back(0); cwarn << boost::current_exception_diagnostic_information(); } catch (...){
ret.push_back(0);
#ifndef BOOST_NO_EXCEPTIONS
cwarn << boost::current_exception_diagnostic_information();
#endif
}
return ret; return ret;
} }

Loading…
Cancel
Save