diff --git a/CMakeLists.txt b/CMakeLists.txt index 37ce083..56fc8ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,35 +10,40 @@ INCLUDE( SetupTargetMacros ) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR} ) INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/include ) INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/vendor/cyoencode-1.0.2/src ) -INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost_1.51/include ) SET( DEFAULT_HEADER_INSTALL_DIR include/\${target} ) SET( DEFAULT_LIBRARY_INSTALL_DIR lib/ ) SET( DEFAULT_EXECUTABLE_INSTALL_DIR bin/ ) SET( CMAKE_DEBUG_POSTFIX _debug ) SET( BUILD_SHARED_LIBS NO ) -SET(Boost_USE_STATIC_LIBS ON) -FIND_PACKAGE(Boost 1.51 COMPONENTS thread date_time system filesystem program_options signals serialization chrono unit_test_framework context ) if( WIN32 ) set( RPCRT4 Rpcrt4 ) + #boost + SET( Boost_INCLUDE_DIR $ENV{BOOST_ROOT} ) +else(WIN32) + SET(Boost_USE_STATIC_LIBS ON) + FIND_PACKAGE(Boost 1.51 COMPONENTS thread date_time system filesystem program_options signals serialization chrono unit_test_framework context ) endif( WIN32 ) LINK_DIRECTORIES( ${Boost_LIBRARY_DIRS} ) IF( WIN32 ) ADD_DEFINITIONS( -DWIN32 ) - ADD_DEFINITIONS( -DBOOST_CONTEXT_NO_LIB ) + #ADD_DEFINITIONS( -DBOOST_CONTEXT_NO_LIB ) + ADD_DEFINITIONS( -DNOMINMAX ) ADD_DEFINITIONS( -D_SCL_SECURE_NO_WARNINGS ) ADD_DEFINITIONS( -D_WIN32_WINNT=0x0501 ) ADD_DEFINITIONS( -D_CRT_SECURE_NO_WARNINGS ) - ADD_DEFINITIONS( -DBOOST_ALL_NO_LIB -DBOOST_THREAD_BUILD_LIB) + #USE SHARED LIBS FOR BOOST ON WINDOWS + #ADD_DEFINITIONS( -DBOOST_ALL_NO_LIB -DBOOST_THREAD_BUILD_LIB) ADD_DEFINITIONS( -DWIN32) # Activate C++ exception handling IF (NOT CMAKE_CXX_FLAGS MATCHES "/EHsc") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") ENDIF() ELSE(WIN32) + INCLUDE_DIRECTORIES( ${CMAKE_CURRENT_SOURCE_DIR}/vendor/boost_1.51/include ) SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x -Wall -Wno-unused-local-typedefs -fmax-errors=3" ) ENDIF(WIN32) @@ -162,7 +167,7 @@ IF( UNIX ) ENDIF() ENDIF( UNIX ) -IF( WIN32 ) +IF( BOOST_1_51 ) ENABLE_LANGUAGE(ASM_MASM) # SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHa" ) @@ -188,7 +193,7 @@ IF( WIN32 ) message(STATUS " item type from 'Does not participate in build' to 'Microsoft Macro Assembler'") ENDIF() -ENDIF(WIN32) +ENDIF(BOOST_1_51) set( sources ${fc_sources} diff --git a/include/fc/exception/exception.hpp b/include/fc/exception/exception.hpp index ea181db..55b7379 100644 --- a/include/fc/exception/exception.hpp +++ b/include/fc/exception/exception.hpp @@ -191,10 +191,12 @@ namespace fc * @brief Checks a condition and throws an assert_exception if the test is FALSE */ #define FC_ASSERT( TEST, ... ) \ -if( !(TEST) ) { FC_THROW_EXCEPTION( assert_exception, #TEST __VA_ARGS__ ); } +do { if( !(TEST) ) { FC_THROW_EXCEPTION( assert_exception, #TEST ": " __VA_ARGS__ ); } } while(0); #define FC_THROW( FORMAT, ... ) \ - throw fc::exception( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ) + do { \ + throw fc::exception( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \ + } while(0) #define FC_EXCEPTION( EXCEPTION_TYPE, FORMAT, ... ) \ fc::EXCEPTION_TYPE( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ) @@ -204,7 +206,9 @@ if( !(TEST) ) { FC_THROW_EXCEPTION( assert_exception, #TEST __VA_ARGS__ ); } * @param format - a const char* string with "${keys}" */ #define FC_THROW_EXCEPTION( EXCEPTION, FORMAT, ... ) \ - throw fc::EXCEPTION( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ) + do { \ + throw fc::EXCEPTION( FC_LOG_MESSAGE( error, FORMAT, __VA_ARGS__ ) ); \ + } while(0) /** diff --git a/include/fc/ptr.hpp b/include/fc/ptr.hpp index b52da28..67e5270 100644 --- a/include/fc/ptr.hpp +++ b/include/fc/ptr.hpp @@ -1,5 +1,5 @@ #pragma once -#include +//#include #include #include #include diff --git a/include/fc/rpc/json_connection.hpp b/include/fc/rpc/json_connection.hpp index e275362..0a71fb7 100644 --- a/include/fc/rpc/json_connection.hpp +++ b/include/fc/rpc/json_connection.hpp @@ -40,7 +40,7 @@ namespace fc { namespace rpc { */ ///@{ void add_method( const fc::string& name, method ); - void add_method( const fc::string& name, named_param_method ); + void add_named_param_method( const fc::string& name, named_param_method ); void remove_method( const fc::string& name ); //@} diff --git a/include/fc/rpc/variant_connection.hpp b/include/fc/rpc/variant_connection.hpp index cb6973e..93cb29b 100644 --- a/include/fc/rpc/variant_connection.hpp +++ b/include/fc/rpc/variant_connection.hpp @@ -40,7 +40,7 @@ namespace fc { namespace rpc { */ ///@{ void add_method( const fc::string& name, method ); - void add_method( const fc::string& name, named_param_method ); + void add_named_param_method( const fc::string& name, named_param_method ); void remove_method( const fc::string& name ); //@} diff --git a/include/fc/uint128.hpp b/include/fc/uint128.hpp index f0da0f8..2115da8 100644 --- a/include/fc/uint128.hpp +++ b/include/fc/uint128.hpp @@ -67,7 +67,7 @@ namespace fc friend bool operator >= ( const uint128& l, const uint128& r ) { return l == r || l > r; } friend bool operator <= ( const uint128& l, const uint128& r ) { return l == r || l < r; } - uint32_t to_integer()const { return lo; } + uint32_t to_integer()const { return (uint32_t)lo; } uint64_t to_uint64()const { return lo; } uint64_t low_bits()const { return lo; } uint64_t high_bits()const { return hi; } diff --git a/src/crypto/crc.cpp b/src/crypto/crc.cpp index 430eb1e..14fd41c 100644 --- a/src/crypto/crc.cpp +++ b/src/crypto/crc.cpp @@ -1,5 +1,5 @@ #include -#include +//#include /* Tables generated with code like the following: #define CRCPOLY 0x82f63b78 // reversed 0x1EDC6F41 diff --git a/src/rpc/json_connection.cpp b/src/rpc/json_connection.cpp index c5f95a4..5c88752 100644 --- a/src/rpc/json_connection.cpp +++ b/src/rpc/json_connection.cpp @@ -272,7 +272,7 @@ namespace fc { namespace rpc { { my->_methods.emplace(std::pair(name,fc::move(m))); } - void json_connection::add_method( const fc::string& name, named_param_method m ) + void json_connection::add_named_param_method( const fc::string& name, named_param_method m ) { my->_named_param_methods.emplace(std::pair(name,fc::move(m))); } diff --git a/src/uint128.cpp b/src/uint128.cpp index 23aface..ab559d0 100644 --- a/src/uint128.cpp +++ b/src/uint128.cpp @@ -1,6 +1,9 @@ #include #include #include +#ifdef WIN32 +#include +#endif namespace fc {