From 18a96c8d0487d0e6a6acd370eba2e70403c9eded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Bylica?= Date: Thu, 5 Jul 2018 15:05:20 +0200 Subject: [PATCH] vmtester: Use CLI11 instead of boost::program_options --- cmake/HunterConfig.cmake | 4 ++-- test/vmtester/CMakeLists.txt | 6 +++--- test/vmtester/vmtester.cpp | 29 ++++------------------------- 3 files changed, 9 insertions(+), 30 deletions(-) diff --git a/cmake/HunterConfig.cmake b/cmake/HunterConfig.cmake index 36d5712..d55e4c3 100644 --- a/cmake/HunterConfig.cmake +++ b/cmake/HunterConfig.cmake @@ -6,6 +6,6 @@ # Hunter is going to be initialized only if building with tests, # where it is needed to get dependencies. HunterGate( - URL "https://github.com/ruslo/hunter/archive/v0.20.37.tar.gz" - SHA1 "51886d10428c924cc21756abc17623bcf4986386" + URL "https://github.com/ruslo/hunter/archive/v0.22.23.tar.gz" + SHA1 "16c562a69489ff9c1b5266a12d5e903084de693a" ) diff --git a/test/vmtester/CMakeLists.txt b/test/vmtester/CMakeLists.txt index b586a2d..2026953 100644 --- a/test/vmtester/CMakeLists.txt +++ b/test/vmtester/CMakeLists.txt @@ -4,8 +4,8 @@ include(GNUInstallDirs) -hunter_add_package(Boost COMPONENTS program_options) -find_package(Boost CONFIG REQUIRED program_options) +hunter_add_package(CLI11) +find_package(CLI11) add_executable(evmc-vmtester vmtester.hpp vmtester.cpp tests.cpp) set_target_properties(evmc-vmtester PROPERTIES RUNTIME_OUTPUT_DIRECTORY ..) @@ -16,7 +16,7 @@ target_link_libraries( evmc loader GTest::gtest - Boost::program_options + CLI11::CLI11 ) install(TARGETS evmc-vmtester RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/test/vmtester/vmtester.cpp b/test/vmtester/vmtester.cpp index ea7ba2d..4f0f067 100644 --- a/test/vmtester/vmtester.cpp +++ b/test/vmtester/vmtester.cpp @@ -6,13 +6,11 @@ #include -#include +#include #include #include -namespace opts = boost::program_options; - namespace { evmc_create_fn create_fn; @@ -36,29 +34,10 @@ int main(int argc, char* argv[]) { std::string vm_path; - opts::options_description desc("EVMC VM Tester Options"); - auto add_option = desc.add_options(); - add_option("help", "Show help message"); - add_option("vm", opts::value(&vm_path)->value_name("path")->required(), - "Path to the VM shared library to be tested"); - - opts::positional_options_description positional; - positional.add("vm", 1); - + CLI::App app{"EVMC VM Tester"}; + app.add_option("vm", vm_path, "Path to the VM shared library to be tested"); testing::InitGoogleTest(&argc, argv); - - opts::variables_map variables_map; - opts::store( - opts::command_line_parser(argc, argv).options(desc).positional(positional).run(), - variables_map); - - if (variables_map.count("help")) - { - std::cout << "\n" << desc << "\n"; - return 0; - } - - opts::notify(variables_map); + CLI11_PARSE(app, argc, argv); std::cout << "Testing " << vm_path << "\n"; evmc_loader_error_code ec;