From 721da7475d02a9c969927dbddf486b15f8774087 Mon Sep 17 00:00:00 2001 From: kenshi84 Date: Thu, 2 Feb 2017 23:17:43 +0900 Subject: [PATCH] build on windows --- CMakeLists.txt | 21 ++++++++++++++++++--- main.cpp | 2 +- src/page.h | 4 ++-- src/tools.cpp | 7 ++++++- 4 files changed, 27 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d65eb..448b97b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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}) diff --git a/main.cpp b/main.cpp index bbbd5e4..8602bab 100644 --- a/main.cpp +++ b/main.cpp @@ -177,7 +177,7 @@ int main(int ac, const char* av[]) { }); CROW_ROUTE(app, "/tx//") - ([&](string tx_hash, uint with_ring_signatures) { + ([&](string tx_hash, uint16_t with_ring_signatures) { return xmrblocks.show_tx(tx_hash, with_ring_signatures); }); diff --git a/src/page.h b/src/page.h index 78fbb16..5bc0f2d 100644 --- a/src/page.h +++ b/src/page.h @@ -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); diff --git a/src/tools.cpp b/src/tools.cpp index d37adfe..c3d9348 100644 --- a/src/tools.cpp +++ b/src/tools.cpp @@ -3,7 +3,7 @@ // #include "tools.h" - +#include 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, 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)); }