parent
4f04b10e00
commit
ca6014ccd6
@ -1,59 +0,0 @@
|
||||
# --------------------------------- FindMiniupnpc Start ---------------------------------
|
||||
# Locate miniupnp library
|
||||
# This module defines
|
||||
# MINIUPNP_FOUND, if false, do not try to link to miniupnp
|
||||
# MINIUPNP_LIBRARY, the miniupnp variant
|
||||
# MINIUPNP_INCLUDE_DIR, where to find miniupnpc.h and family)
|
||||
# MINIUPNPC_VERSION_1_7_OR_HIGHER, set if we detect the version of miniupnpc is 1.7 or higher
|
||||
#
|
||||
# Note that the expected include convention is
|
||||
# #include "miniupnpc.h"
|
||||
# and not
|
||||
# #include <miniupnpc/miniupnpc.h>
|
||||
# This is because, the miniupnpc location is not standardized and may exist
|
||||
# in locations other than miniupnpc/
|
||||
|
||||
if (MINIUPNP_INCLUDE_DIR AND MINIUPNP_LIBRARY)
|
||||
# Already in cache, be silent
|
||||
set(MINIUPNP_FIND_QUIETLY TRUE)
|
||||
endif ()
|
||||
|
||||
find_path(MINIUPNP_INCLUDE_DIR miniupnpc.h
|
||||
HINTS $ENV{MINIUPNP_INCLUDE_DIR}
|
||||
PATH_SUFFIXES miniupnpc
|
||||
)
|
||||
|
||||
find_library(MINIUPNP_LIBRARY miniupnpc
|
||||
HINTS $ENV{MINIUPNP_LIBRARY}
|
||||
)
|
||||
|
||||
find_library(MINIUPNP_STATIC_LIBRARY libminiupnpc.a
|
||||
HINTS $ENV{MINIUPNP_STATIC_LIBRARY}
|
||||
)
|
||||
|
||||
set(MINIUPNP_INCLUDE_DIRS ${MINIUPNP_INCLUDE_DIR})
|
||||
set(MINIUPNP_LIBRARIES ${MINIUPNP_LIBRARY})
|
||||
set(MINIUPNP_STATIC_LIBRARIES ${MINIUPNP_STATIC_LIBRARY})
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(
|
||||
MiniUPnPc DEFAULT_MSG
|
||||
MINIUPNP_INCLUDE_DIR
|
||||
MINIUPNP_LIBRARY
|
||||
)
|
||||
|
||||
IF(MINIUPNPC_FOUND)
|
||||
file(STRINGS "${MINIUPNP_INCLUDE_DIR}/miniupnpc.h" MINIUPNPC_API_VERSION_STR REGEX "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+[0-9]+")
|
||||
if(MINIUPNPC_API_VERSION_STR MATCHES "^#define[\t ]+MINIUPNPC_API_VERSION[\t ]+([0-9]+)")
|
||||
set(MINIUPNPC_API_VERSION "${CMAKE_MATCH_1}")
|
||||
if (${MINIUPNPC_API_VERSION} GREATER "10" OR ${MINIUPNPC_API_VERSION} EQUAL "10")
|
||||
message(STATUS "Found miniupnpc API version " ${MINIUPNPC_API_VERSION})
|
||||
set(MINIUPNP_FOUND true)
|
||||
set(MINIUPNPC_VERSION_1_7_OR_HIGHER true)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ENDIF()
|
||||
|
||||
mark_as_advanced(MINIUPNP_INCLUDE_DIR MINIUPNP_LIBRARY MINIUPNP_STATIC_LIBRARY)
|
||||
# --------------------------------- FindMiniupnpc End ---------------------------------
|
@ -0,0 +1,97 @@
|
||||
# Copyright (c) 2011 Milo Yip (miloyip@gmail.com)
|
||||
# Copyright (c) 2013 Rafal Jeczalik (rjeczalik@gmail.com)
|
||||
# Distributed under the MIT License (see license.txt file)
|
||||
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
# Finds the rapidjson library
|
||||
#
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
# Variables used by this module, they can change the default behaviour.
|
||||
# Those variables need to be either set before calling find_package
|
||||
# or exported as environment variables before running CMake:
|
||||
#
|
||||
# RAPIDJSON_INCLUDEDIR - Set custom include path, useful when rapidjson headers are
|
||||
# outside system paths
|
||||
# RAPIDJSON_USE_SSE2 - Configure rapidjson to take advantage of SSE2 capabilities
|
||||
# RAPIDJSON_USE_SSE42 - Configure rapidjson to take advantage of SSE4.2 capabilities
|
||||
#
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
# Variables defined by this module:
|
||||
#
|
||||
# RAPIDJSON_FOUND - True if rapidjson was found
|
||||
# RAPIDJSON_INCLUDE_DIRS - Path to rapidjson include directory
|
||||
# RAPIDJSON_CXX_FLAGS - Extra C++ flags required for compilation with rapidjson
|
||||
#
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
# Example usage:
|
||||
#
|
||||
# set(RAPIDJSON_USE_SSE2 ON)
|
||||
# set(RAPIDJSON_INCLUDEDIR "/opt/github.com/rjeczalik/rapidjson/include")
|
||||
#
|
||||
# find_package(rapidjson REQUIRED)
|
||||
#
|
||||
# include_directories("${RAPIDJSON_INCLUDE_DIRS}")
|
||||
# set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${RAPIDJSON_CXX_FLAGS}")
|
||||
# add_executable(foo foo.cc)
|
||||
#
|
||||
# -----------------------------------------------------------------------------------
|
||||
|
||||
foreach(opt RAPIDJSON_INCLUDEDIR RAPIDJSON_USE_SSE2 RAPIDJSON_USE_SSE42)
|
||||
if(${opt} AND DEFINED ENV{${opt}} AND NOT ${opt} STREQUAL "$ENV{${opt}}")
|
||||
message(WARNING "Conflicting ${opt} values: ignoring environment variable and using CMake cache entry.")
|
||||
elseif(DEFINED ENV{${opt}} AND NOT ${opt})
|
||||
set(${opt} "$ENV{${opt}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
find_path(
|
||||
RAPIDJSON_INCLUDE_DIRS
|
||||
NAMES rapidjson/rapidjson.h
|
||||
PATHS ${RAPIDJSON_INCLUDEDIR}
|
||||
DOC "Include directory for the rapidjson library."
|
||||
)
|
||||
|
||||
mark_as_advanced(RAPIDJSON_INCLUDE_DIRS)
|
||||
|
||||
if(RAPIDJSON_INCLUDE_DIRS)
|
||||
set(RAPIDJSON_FOUND TRUE)
|
||||
endif()
|
||||
|
||||
mark_as_advanced(RAPIDJSON_FOUND)
|
||||
|
||||
if(RAPIDJSON_USE_SSE42)
|
||||
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE42")
|
||||
if(MSVC)
|
||||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE4.2")
|
||||
else()
|
||||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse4.2")
|
||||
endif()
|
||||
else()
|
||||
if(RAPIDJSON_USE_SSE2)
|
||||
set(RAPIDJSON_CXX_FLAGS "-DRAPIDJSON_SSE2")
|
||||
if(MSVC)
|
||||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} /arch:SSE2")
|
||||
else()
|
||||
set(RAPIDJSON_CXX_FLAGS "${RAPIDJSON_CXX_FLAGS} -msse2")
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
mark_as_advanced(RAPIDJSON_CXX_FLAGS)
|
||||
|
||||
if(RAPIDJSON_FOUND)
|
||||
if(NOT rapidjson_FIND_QUIETLY)
|
||||
message(STATUS "Found rapidjson header files in ${RAPIDJSON_INCLUDE_DIRS}")
|
||||
if(DEFINED RAPIDJSON_CXX_FLAGS)
|
||||
message(STATUS "Found rapidjson C++ extra compilation flags: ${RAPIDJSON_CXX_FLAGS}")
|
||||
endif()
|
||||
endif()
|
||||
elseif(rapidjson_FIND_REQUIRED)
|
||||
message(FATAL_ERROR "Could not find rapidjson")
|
||||
else()
|
||||
message(STATUS "Optional package rapidjson was not found")
|
||||
endif()
|
@ -0,0 +1,21 @@
|
||||
SET(CLANG_TARGET "arm64-apple-darwin")
|
||||
SET(CONF_TRIPLE "aarch64-apple-darwin")
|
||||
SET(BUILD_TAG "mac-armv8")
|
||||
SET(CMAKE_OSX_ARCHITECTURES "arm64")
|
||||
set(ARM ON)
|
||||
set(ARM_ID "armv8-a")
|
||||
SET(LLVM_ENABLE_PIC OFF)
|
||||
SET(LLVM_ENABLE_PIE OFF)
|
||||
|
||||
set(WALLET_CRYPTO_LIBRARY "cn")
|
||||
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -D_GNU_SOURCE -fvisibility=default -march=armv8-a+crypto -mfix-cortex-a53-835769")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -D_GNU_SOURCE -fvisibility=default -march=armv8-a+crypto -mfix-cortex-a53-835769")
|
||||
|
||||
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=default -fno-strict-aliasing -D_GNU_SOURCE -Wpointer-arith -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-range-loop-construct -Wno-unused-variable -Wno-error=inline-asm -Wno-reorder -Wno-missing-field-initializers -fPIC -Wno-uninitialized -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -Werror=switch -Werror=return-type -fno-strict-aliasing -fvisibility=default -DGTEST_HAS_TR1_TUPLE=0 -fno-aligned-allocation")
|
||||
#set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fno-strict-aliasing -D_GNU_SOURCE -Wpointer-arith -Wwrite-strings -Wno-error=extra -Wno-error=deprecated-declarations -Wno-unused-parameter -Wno-unused-variable -Wno-range-loop-construct -Wno-error=undef -Wno-error=inline-asm -Waggregate-return -Wnested-externs -Wold-style-definition -Wstrict-prototypes -Wno-uninitialized -Wformat -Wformat-security -fstack-protector -fstack-protector-strong -Werror=switch -Werror=return-type -fno-strict-aliasing")
|
||||
|
||||
execute_process(COMMAND brew --prefix openssl OUTPUT_VARIABLE OPENSSL_ROOT_DIR OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
execute_process(COMMAND brew --prefix boost OUTPUT_VARIABLE BOOST_ROOT OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
find_library(IOKIT_LIBRARY IOKit)
|
@ -0,0 +1,4 @@
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
||||
|
||||
set(WALLET_CRYPTO_LIBRARY "amd64-64-24k")
|
@ -1,258 +0,0 @@
|
||||
#include "readline_buffer.h"
|
||||
#include <readline/readline.h>
|
||||
#include <readline/history.h>
|
||||
#include <iostream>
|
||||
#include <boost/thread/mutex.hpp>
|
||||
#include <boost/thread/lock_guard.hpp>
|
||||
#include <boost/algorithm/string.hpp>
|
||||
|
||||
static bool same_as_last_line(const std::string&);
|
||||
static void install_line_handler();
|
||||
static void remove_line_handler();
|
||||
|
||||
static boost::mutex sync_mutex;
|
||||
static rdln::linestatus line_stat;
|
||||
static char *the_line;
|
||||
|
||||
namespace
|
||||
{
|
||||
rdln::readline_buffer* current = NULL;
|
||||
}
|
||||
|
||||
rdln::suspend_readline::suspend_readline()
|
||||
: m_buffer(NULL), m_restart(false)
|
||||
{
|
||||
m_buffer = current;
|
||||
if(!m_buffer)
|
||||
return;
|
||||
m_restart = m_buffer->is_running();
|
||||
if(m_restart)
|
||||
m_buffer->stop();
|
||||
}
|
||||
|
||||
rdln::suspend_readline::~suspend_readline()
|
||||
{
|
||||
if(!m_buffer)
|
||||
return;
|
||||
if(m_restart)
|
||||
m_buffer->start();
|
||||
}
|
||||
|
||||
std::vector<std::string>& rdln::readline_buffer::completion_commands()
|
||||
{
|
||||
static std::vector<std::string> commands = {"exit"};
|
||||
return commands;
|
||||
}
|
||||
|
||||
rdln::readline_buffer::readline_buffer()
|
||||
: std::stringbuf(), m_cout_buf(NULL), m_prompt_length(0)
|
||||
{
|
||||
current = this;
|
||||
}
|
||||
|
||||
void rdln::readline_buffer::start()
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
||||
if(m_cout_buf != NULL)
|
||||
return;
|
||||
m_cout_buf = std::cout.rdbuf();
|
||||
std::cout.rdbuf(this);
|
||||
install_line_handler();
|
||||
}
|
||||
|
||||
void rdln::readline_buffer::stop()
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
||||
if(m_cout_buf == NULL)
|
||||
return;
|
||||
std::cout.rdbuf(m_cout_buf);
|
||||
m_cout_buf = NULL;
|
||||
remove_line_handler();
|
||||
}
|
||||
|
||||
rdln::linestatus rdln::readline_buffer::get_line(std::string& line) const
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
||||
line_stat = rdln::partial;
|
||||
if (!m_cout_buf)
|
||||
{
|
||||
line = "";
|
||||
return rdln::full;
|
||||
}
|
||||
rl_callback_read_char();
|
||||
if (line_stat == rdln::full)
|
||||
{
|
||||
line = the_line;
|
||||
free(the_line);
|
||||
the_line = NULL;
|
||||
}
|
||||
return line_stat;
|
||||
}
|
||||
|
||||
void rdln::readline_buffer::set_prompt(const std::string& prompt)
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
||||
if(m_cout_buf == NULL)
|
||||
return;
|
||||
rl_set_prompt(std::string(m_prompt_length, ' ').c_str());
|
||||
rl_redisplay();
|
||||
rl_set_prompt(prompt.c_str());
|
||||
rl_redisplay();
|
||||
m_prompt_length = prompt.size();
|
||||
}
|
||||
|
||||
void rdln::readline_buffer::add_completion(const std::string& command)
|
||||
{
|
||||
if(std::find(completion_commands().begin(), completion_commands().end(), command) != completion_commands().end())
|
||||
return;
|
||||
completion_commands().push_back(command);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& rdln::readline_buffer::get_completions()
|
||||
{
|
||||
return completion_commands();
|
||||
}
|
||||
|
||||
int rdln::readline_buffer::sync()
|
||||
{
|
||||
boost::lock_guard<boost::mutex> lock(sync_mutex);
|
||||
|
||||
if (m_cout_buf == nullptr)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if RL_READLINE_VERSION < 0x0700
|
||||
char lbuf[2] = {0,0};
|
||||
char *line = NULL;
|
||||
int end = 0, point = 0;
|
||||
#endif
|
||||
|
||||
if (rl_end || (rl_prompt && *rl_prompt))
|
||||
{
|
||||
#if RL_READLINE_VERSION >= 0x0700
|
||||
rl_clear_visible_line();
|
||||
#else
|
||||
line = rl_line_buffer;
|
||||
end = rl_end;
|
||||
point = rl_point;
|
||||
rl_line_buffer = lbuf;
|
||||
rl_end = 0;
|
||||
rl_point = 0;
|
||||
rl_save_prompt();
|
||||
rl_redisplay();
|
||||
#endif
|
||||
}
|
||||
|
||||
do
|
||||
{
|
||||
m_cout_buf->sputc( this->sgetc() );
|
||||
}
|
||||
while ( this->snextc() != EOF );
|
||||
|
||||
#if RL_READLINE_VERSION < 0x0700
|
||||
if (end || (rl_prompt && *rl_prompt))
|
||||
{
|
||||
rl_restore_prompt();
|
||||
rl_line_buffer = line;
|
||||
rl_end = end;
|
||||
rl_point = point;
|
||||
}
|
||||
#endif
|
||||
rl_on_new_line();
|
||||
rl_redisplay();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void handle_line(char* line)
|
||||
{
|
||||
bool exit = false;
|
||||
if (line)
|
||||
{
|
||||
line_stat = rdln::full;
|
||||
the_line = line;
|
||||
std::string test_line = line;
|
||||
boost::trim_right(test_line);
|
||||
if(!test_line.empty())
|
||||
{
|
||||
if (!same_as_last_line(test_line))
|
||||
{
|
||||
add_history(test_line.c_str());
|
||||
history_set_pos(history_length);
|
||||
}
|
||||
if (test_line == "exit" || test_line == "q")
|
||||
exit = true;
|
||||
}
|
||||
} else
|
||||
/* EOF */
|
||||
{
|
||||
line_stat = rdln::empty;
|
||||
exit = true;
|
||||
}
|
||||
rl_done = 1;
|
||||
if (exit)
|
||||
rl_set_prompt("");
|
||||
return;
|
||||
}
|
||||
|
||||
// same_as_last_line returns true, if the last line in the history is
|
||||
// equal to test_line.
|
||||
static bool same_as_last_line(const std::string& test_line)
|
||||
{
|
||||
// Note that state->offset == state->length, when a new line was entered.
|
||||
HISTORY_STATE* state = history_get_history_state();
|
||||
return state->length > 0
|
||||
&& test_line.compare(state->entries[state->length-1]->line) == 0;
|
||||
}
|
||||
|
||||
static char* completion_matches(const char* text, int state)
|
||||
{
|
||||
static size_t list_index;
|
||||
static size_t len;
|
||||
|
||||
if(state == 0)
|
||||
{
|
||||
list_index = 0;
|
||||
len = strlen(text);
|
||||
}
|
||||
|
||||
const std::vector<std::string>& completions = rdln::readline_buffer::get_completions();
|
||||
for(; list_index<completions.size(); )
|
||||
{
|
||||
const std::string& cmd = completions[list_index++];
|
||||
if(cmd.compare(0, len, text) == 0)
|
||||
{
|
||||
return strdup(cmd.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static char** attempted_completion(const char* text, int start, int end)
|
||||
{
|
||||
rl_attempted_completion_over = 1;
|
||||
return rl_completion_matches(text, completion_matches);
|
||||
}
|
||||
|
||||
static void install_line_handler()
|
||||
{
|
||||
rl_attempted_completion_function = attempted_completion;
|
||||
rl_callback_handler_install("", handle_line);
|
||||
stifle_history(500);
|
||||
}
|
||||
|
||||
static void remove_line_handler()
|
||||
{
|
||||
rl_replace_line("", 0);
|
||||
rl_set_prompt("");
|
||||
rl_redisplay();
|
||||
rl_callback_handler_remove();
|
||||
}
|
||||
|
||||
void rdln::clear_screen()
|
||||
{
|
||||
rl_clear_screen(0, 0);
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit 772267cb20db1d9c4ddd9271d1024fd5a3ba3adb
|
||||
Subproject commit 142e873e32b62d1853ec8c82f23b86b293ee4085
|
Loading…
Reference in new issue