mirror of
https://github.com/status-im/evmc.git
synced 2025-02-22 16:08:22 +00:00
vmtester: Use CLI11 instead of boost::program_options
This commit is contained in:
parent
8331ca15de
commit
18a96c8d04
@ -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"
|
||||
)
|
||||
|
@ -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})
|
||||
|
@ -6,13 +6,11 @@
|
||||
|
||||
#include <evmc/loader.h>
|
||||
|
||||
#include <boost/program_options.hpp>
|
||||
#include <CLI/CLI.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <memory>
|
||||
|
||||
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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user