Merge pull request #36 from kenshi84/build-win

build on windows
This commit is contained in:
moneroexamples 2017-02-03 05:10:04 +08:00 committed by GitHub
commit af9b290458
4 changed files with 27 additions and 7 deletions

View file

@ -8,7 +8,9 @@ project(${PROJECT_NAME})
set(CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -std=c++14")
if (WIN32)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj -O3")
endif()
# find boost
find_package(Boost COMPONENTS
@ -91,6 +93,9 @@ add_library(wallet STATIC IMPORTED)
set_property(TARGET wallet
PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libwallet.a)
add_library(unbound STATIC IMPORTED)
set_property(TARGET unbound PROPERTY IMPORTED_LOCATION ${MONERO_LIBS_DIR}/libunbound.a)
# include boost headers
include_directories(${Boost_INCLUDE_DIRS})
include_directories("ext/mstch/include")
@ -183,12 +188,22 @@ set(LIBRARIES
pthread
unbound
curl
dl
crypto
ssl)
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin" AND NOT WIN32)
set(LIBRARIES ${LIBRARIES} unwind)
endif()
if (WIN32)
set(LIBRARIES ${LIBRARIES}
wsock32
ntdll
ws2_32
Iphlpapi
)
else()
set(LIBRARIES ${LIBRARIES} dl)
endif()
target_link_libraries(${PROJECT_NAME} ${LIBRARIES})

View file

@ -177,7 +177,7 @@ int main(int ac, const char* av[]) {
});
CROW_ROUTE(app, "/tx/<string>/<uint>")
([&](string tx_hash, uint with_ring_signatures) {
([&](string tx_hash, uint16_t with_ring_signatures) {
return xmrblocks.show_tx(tx_hash, with_ring_signatures);
});

View file

@ -1019,7 +1019,7 @@ public:
}
string
show_tx(string tx_hash_str, uint with_ring_signatures = 0)
show_tx(string tx_hash_str, uint16_t with_ring_signatures = 0)
{
// parse tx hash string to hash object
@ -4060,7 +4060,7 @@ private:
}
mstch::map
construct_tx_context(transaction tx, uint with_ring_signatures = 0)
construct_tx_context(transaction tx, uint16_t with_ring_signatures = 0)
{
tx_details txd = get_tx_details(tx);

View file

@ -3,7 +3,7 @@
//
#include "tools.h"
#include <codecvt>
namespace xmreg
@ -139,7 +139,12 @@ remove_trailing_path_separator(const string& in_path)
bf::path
remove_trailing_path_separator(const bf::path& in_path)
{
#ifdef WIN32
std::wstring_convert<std::codecvt_utf8<wchar_t>, wchar_t> converter;
string path_str = converter.to_bytes(in_path.native());
#else
string path_str = in_path.native();
#endif
return bf::path(remove_trailing_path_separator(path_str));
}