various fixes to allow mac osx compilation

This commit is contained in:
mydesktop 2014-04-30 13:52:21 -04:00
parent 9c70be0e77
commit 67df296650
13 changed files with 40 additions and 20 deletions

1
.gitignore vendored
View file

@ -1,2 +1,3 @@
.DS_Store
/build /build
/tags /tags

View file

@ -3,12 +3,22 @@ cmake_minimum_required(VERSION 2.8.6)
set(VERSION "0.1") set(VERSION "0.1")
# $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$ # $Format:Packaged from commit %H%nset(COMMIT %h)%nset(REFS "%d")$
function(set_static_flags)
if (NOT APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
endif()
endfunction(set_static_flags)
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release") set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
enable_testing() enable_testing()
include_directories(src contrib/epee/include external "${CMAKE_BINARY_DIR}/version") include_directories(src contrib/epee/include external "${CMAKE_BINARY_DIR}/version")
if(APPLE)
include_directories(SYSTEM /usr/include/malloc)
endif()
set(STATIC ${MSVC} CACHE BOOL "Link libraries statically") set(STATIC ${MSVC} CACHE BOOL "Link libraries statically")
if(MSVC) if(MSVC)
@ -65,7 +75,7 @@ else()
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${RELEASE_FLAGS}")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${RELEASE_FLAGS}")
if(STATIC) if(STATIC)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++") set_static_flags()
endif() endif()
endif() endif()
@ -81,7 +91,7 @@ include_directories(SYSTEM ${Boost_INCLUDE_DIRS})
if(MINGW) if(MINGW)
set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock") set(Boost_LIBRARIES "${Boost_LIBRARIES};ws2_32;mswsock")
elseif(NOT MSVC) elseif(NOT MSVC)
set(Boost_LIBRARIES "${Boost_LIBRARIES};rt") set(Boost_LIBRARIES "${Boost_LIBRARIES}")
endif() endif()
set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version") set(COMMIT_ID_IN_VERSION ON CACHE BOOL "Include commit ID in version")

View file

@ -210,7 +210,7 @@ namespace epee
template<class t_value> template<class t_value>
bool portable_storage::get_value(const std::string& value_name, t_value& val, hsection hparent_section) bool portable_storage::get_value(const std::string& value_name, t_value& val, hsection hparent_section)
{ {
BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> )); //BOOST_MPL_ASSERT(( boost::mpl::contains<storage_entry::types, t_value> ));
//TRY_ENTRY(); //TRY_ENTRY();
if(!hparent_section) hparent_section = &m_root; if(!hparent_section) hparent_section = &m_root;
storage_entry* pentry = find_storage_entry(value_name, hparent_section); storage_entry* pentry = find_storage_entry(value_name, hparent_section);

View file

@ -37,6 +37,7 @@ static const char _NR[] = {
#include <malloc.h> #include <malloc.h>
#include <string.h> #include <string.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#ifdef WIN32 #ifdef WIN32
#include <process.h> #include <process.h>

View file

@ -25,7 +25,7 @@ namespace cryptonote
typedef std::pair<uint64_t, crypto::public_key> output_entry; typedef std::pair<uint64_t, crypto::public_key> output_entry;
std::vector<output_entry> outputs; //index + key std::vector<output_entry> outputs; //index + key
uint64_t real_output; //index in outputs vector of real output_entry size_t real_output; //index in outputs vector of real output_entry
crypto::public_key real_out_tx_key; //incoming real tx public key crypto::public_key real_out_tx_key; //incoming real tx public key
size_t real_output_in_tx_index; //index in transaction outputs vector size_t real_output_in_tx_index; //index in transaction outputs vector
uint64_t amount; //money uint64_t amount; //money

View file

@ -745,7 +745,9 @@ namespace nodetool
template<class t_payload_net_handler> template<class t_payload_net_handler>
bool node_server<t_payload_net_handler>::get_local_node_data(basic_node_data& node_data) bool node_server<t_payload_net_handler>::get_local_node_data(basic_node_data& node_data)
{ {
time(&node_data.local_time); time_t local_time;
time(&local_time);
node_data.local_time = local_time;
node_data.peer_id = m_config.m_peer_id; node_data.peer_id = m_config.m_peer_id;
if(!m_hide_my_port) if(!m_hide_my_port)
node_data.my_port = m_external_port ? m_external_port : m_listenning_port; node_data.my_port = m_external_port ? m_external_port : m_listenning_port;

View file

@ -86,7 +86,7 @@ namespace nodetool
struct basic_node_data struct basic_node_data
{ {
uuid network_id; uuid network_id;
time_t local_time; uint64_t local_time;
uint32_t my_port; uint32_t my_port;
peerid_type peer_id; peerid_type peer_id;
@ -153,7 +153,7 @@ namespace nodetool
struct response struct response
{ {
time_t local_time; uint64_t local_time;
t_playload_type payload_data; t_playload_type payload_data;
std::list<peerlist_entry> local_peerlist; std::list<peerlist_entry> local_peerlist;

View file

@ -536,7 +536,7 @@ namespace cryptonote
if (!have_block) if (!have_block)
{ {
error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR; error_resp.code = CORE_RPC_ERROR_CODE_INTERNAL_ERROR;
error_resp.message = "Internal error: can't get block by height. Height = " + req.height + '.'; error_resp.message = "Internal error: can't get block by height. Height = " + std::to_string(req.height) + '.';
return false; return false;
} }
bool responce_filled = fill_block_header_responce(blk, false, req.height, block_hash, res.block_header); bool responce_filled = fill_block_header_responce(blk, false, req.height, block_hash, res.block_header);

View file

@ -469,7 +469,7 @@ bool simple_wallet::refresh(const std::vector<std::string>& args)
return true; return true;
message_writer() << "Starting refresh..."; message_writer() << "Starting refresh...";
uint64_t fetched_blocks = 0; size_t fetched_blocks = 0;
bool ok = false; bool ok = false;
std::ostringstream ss; std::ostringstream ss;
try try

View file

@ -204,6 +204,8 @@
#define GTEST_NAME_ "Google Test" #define GTEST_NAME_ "Google Test"
#define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/" #define GTEST_PROJECT_URL_ "http://code.google.com/p/googletest/"
#define GTEST_HAS_TR1_TUPLE 0
// Determines the version of gcc that is used to compile this. // Determines the version of gcc that is used to compile this.
#ifdef __GNUC__ #ifdef __GNUC__
// 40302 means version 4.3.2. // 40302 means version 4.3.2.

View file

@ -212,8 +212,8 @@ namespace net_load_tests
struct request struct request
{ {
size_t open_request_target; uint64_t open_request_target;
size_t max_opened_conn_count; uint64_t max_opened_conn_count;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(open_request_target) KV_SERIALIZE(open_request_target)
@ -240,9 +240,9 @@ namespace net_load_tests
struct response struct response
{ {
size_t opened_connections_count; uint64_t opened_connections_count;
size_t new_connection_counter; uint64_t new_connection_counter;
size_t close_connection_counter; uint64_t close_connection_counter;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(opened_connections_count) KV_SERIALIZE(opened_connections_count)
@ -295,7 +295,7 @@ namespace net_load_tests
struct request struct request
{ {
size_t request_size; uint64_t request_size;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(request_size) KV_SERIALIZE(request_size)
@ -310,7 +310,7 @@ namespace net_load_tests
struct request struct request
{ {
std::string data; std::string data;
size_t response_size; uint64_t response_size;
BEGIN_KV_SERIALIZE_MAP() BEGIN_KV_SERIALIZE_MAP()
KV_SERIALIZE(data) KV_SERIALIZE(data)

View file

@ -14,7 +14,9 @@
void set_process_affinity(int core) void set_process_affinity(int core)
{ {
#if defined(BOOST_WINDOWS) #if defined (__APPLE__)
return;
#elif defined(BOOST_WINDOWS)
DWORD_PTR mask = 1; DWORD_PTR mask = 1;
for (int i = 0; i < core; ++i) for (int i = 0; i < core; ++i)
{ {
@ -34,7 +36,9 @@ void set_process_affinity(int core)
void set_thread_high_priority() void set_thread_high_priority()
{ {
#if defined(BOOST_WINDOWS) #if defined(__APPLE__)
return;
#elif defined(BOOST_WINDOWS)
::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS); ::SetPriorityClass(::GetCurrentProcess(), HIGH_PRIORITY_CLASS);
#elif defined(BOOST_HAS_PTHREADS) #elif defined(BOOST_HAS_PTHREADS)
pthread_attr_t attr; pthread_attr_t attr;