Skip to content

Commit

Permalink
Make nano_wallet for Windows console (#1653)
Browse files Browse the repository at this point in the history
* Make nano_wallet for Windows console

* Formatting

* Link to latest supported VC++ Redistributable 2017

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

* Add .com file to AppVeyor zip archive

* Proper 7z command
  • Loading branch information
SergiySW authored and argakiig committed Feb 1, 2019
1 parent 00dd12a commit 7cb4296
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 2 deletions.
7 changes: 7 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,12 @@ if (NANO_GUI OR RAIBLOCKS_GUI)

if (WIN32)
target_link_libraries (nano_wallet Qt5::WinExtras)
# nano_wallet.com executable for Windows console
add_executable(nano_wallet_com
nano/nano_wallet/entry_com.cpp)
target_link_libraries (nano_wallet_com
node)
set_target_properties (nano_wallet_com PROPERTIES COMPILE_FLAGS "-DBOOST_ASIO_HAS_STD_ARRAY=1" OUTPUT_NAME "nano_wallet" SUFFIX ".com")
endif()

add_executable (qt_system
Expand Down Expand Up @@ -399,6 +405,7 @@ if (NANO_GUI OR RAIBLOCKS_GUI)
get_target_property (Qt5WindowsPlugin Qt5::QWindowsIntegrationPlugin LOCATION)
get_filename_component (Qt5_bin_DIR ${Qt5_DIR}/../../../bin ABSOLUTE)
install (TARGETS nano_wallet DESTINATION .)
install (TARGETS nano_wallet_com DESTINATION .)
install (FILES ${CMAKE_CURRENT_BINARY_DIR}/${WIN_REDIST} DESTINATION .)
install (FILES ${Qt5_bin_DIR}/libGLESv2.dll DESTINATION .)
install (FILES ${Qt5_bin_DIR}/Qt5Core.dll DESTINATION .)
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ install:
- ps: Invoke-WebRequest -Uri https://download.microsoft.com/download/5/7/b/57b2947c-7221-4f33-b35e-2fc78cb10df4/vc_redist.x64.exe -OutFile .\vc_redist.x64.exe
- ps: Invoke-WebRequest -Uri https://aka.ms/vs/15/release/vc_redist.x64.exe -OutFile .\vc_redist.x64.exe
build:
project: INSTALL.vcxproj
parallel: true
Expand All @@ -28,7 +28,7 @@ after_build:
- cmd: >-
cpack -NSIS --verbose
7z a nano.zip %APPVEYOR_BUILD_FOLDER%\Release\*.exe
7z a nano.zip %APPVEYOR_BUILD_FOLDER%\Release\*.exe %APPVEYOR_BUILD_FOLDER%\Release\*.com
artifacts:
- path: nano.zip
name: nano_release_%network%
Expand Down
48 changes: 48 additions & 0 deletions nano/nano_wallet/entry_com.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#include <nano/lib/errors.hpp>
#include <nano/lib/utility.hpp>
#include <nano/node/cli.hpp>
#include <nano/node/rpc.hpp>
#include <nano/node/working.hpp>

#include <boost/make_shared.hpp>
#include <boost/program_options.hpp>

int main (int argc, char * const * argv)
{
nano::set_umask ();
try
{
boost::program_options::options_description description ("Command line options");
description.add_options () ("help", "Print out options");
nano::add_node_options (description);
boost::program_options::variables_map vm;
boost::program_options::store (boost::program_options::command_line_parser (argc, argv).options (description).allow_unregistered ().run (), vm);
boost::program_options::notify (vm);
int result (0);

if (!vm.count ("data_path"))
{
std::string error_string;
if (!nano::migrate_working_path (error_string))
{
throw std::runtime_error (error_string);
}
}

auto ec = nano::handle_node_options (vm);
if (ec == nano::error_cli::unknown_command && vm.count ("help") != 0)
{
std::cout << description << std::endl;
}
return result;
}
catch (std::exception const & e)
{
std::cerr << boost::str (boost::format ("Exception while initializing %1%") % e.what ());
}
catch (...)
{
std::cerr << boost::str (boost::format ("Unknown exception while initializing"));
}
return 1;
}

0 comments on commit 7cb4296

Please sign in to comment.