diff --git a/CMakeLists.txt b/CMakeLists.txt index e310a1e3..358d07a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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 @@ -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 .) diff --git a/appveyor.yml b/appveyor.yml index 2f1987c3..1ea9acd1 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -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 @@ -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% diff --git a/nano/nano_wallet/entry_com.cpp b/nano/nano_wallet/entry_com.cpp new file mode 100644 index 00000000..60777ffe --- /dev/null +++ b/nano/nano_wallet/entry_com.cpp @@ -0,0 +1,48 @@ +#include +#include +#include +#include +#include + +#include +#include + +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; +}