This repository was archived by the owner on Nov 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +36
-4
lines changed
examples/use_evmc_in_cmake Expand file tree Collapse file tree 6 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 22
33## [ 6.3.0] - unreleased
44
5+ - Added: [[ #303 ] ( https://github.com/ethereum/evmc/pull/303 )]
6+ A CMake helper for running evmc-vmtester.
57- Added: [[ #313 ] ( https://github.com/ethereum/evmc/pull/313 )]
68 The loader module introduces standardized EVMC module configuration string
79 which contains path to the module and additional options.
Original file line number Diff line number Diff line change @@ -79,6 +79,7 @@ install(
7979 FILES
8080 ${CMAKE_CURRENT_BINARY_DIR} /evmcConfig.cmake
8181 ${CMAKE_CURRENT_BINARY_DIR} /evmcConfigVersion.cmake
82+ cmake/EVMC.cmake
8283 DESTINATION ${CMAKE_INSTALL_LIBDIR} /cmake/evmc
8384)
8485
Original file line number Diff line number Diff line change 11@PACKAGE_INIT@
22
3- include (" ${CMAKE_CURRENT_LIST_DIR} /evmcTargets.cmake" )
3+ include (${CMAKE_CURRENT_LIST_DIR} /evmcTargets.cmake )
44check_required_components (evmc )
5+
6+ include (${CMAKE_CURRENT_LIST_DIR} /EVMC.cmake )
Original file line number Diff line number Diff line change 1+ # EVMC: Ethereum Client-VM Connector API.
2+ # Copyright 2019 The EVMC Authors.
3+ # Licensed under the Apache License, Version 2.0.
4+
5+
6+ # Adds a CMake test to check the given EVMC VM implementation with the evmc-vmtester tool.
7+ #
8+ # evmc_add_vm_test(NAME <test_name> TARGET <vm>)
9+ # - NAME argument specifies the name of the added test,
10+ # - TARGET argument specifies the CMake target being a shared library with EVMC VM implementation.
11+ function (evmc_add_vm_test )
12+ if (NOT TARGET evmc::evmc-vmtester)
13+ message (FATAL_ERROR "The evmc-vmtester has not been installed with this EVMC package" )
14+ endif ()
15+
16+ cmake_parse_arguments ("" "" NAME ;TARGET "" ${ARGN} )
17+ add_test (NAME ${_NAME} COMMAND $<TARGET_FILE :evmc ::evmc -vmtester > $<TARGET_FILE :${_TARGET} >)
18+ endfunction ()
Original file line number Diff line number Diff line change @@ -12,3 +12,10 @@ find_package(evmc CONFIG REQUIRED)
1212
1313add_executable (use_evmc_in_cmake use_evmc_in_cmake.c )
1414target_link_libraries (use_evmc_in_cmake PRIVATE evmc::evmc )
15+
16+
17+
18+ # Only for integration tests.
19+ if (NOT COMMAND evmc_add_vm_test)
20+ message (FATAL_ERROR "Function evmc_add_vm_test() not in EVMC.cmake module" )
21+ endif ()
Original file line number Diff line number Diff line change 22# Copyright 2018-2019 The EVMC Authors.
33# Licensed under the Apache License, Version 2.0.
44
5+ include (EVMC )
56include (GNUInstallDirs )
67
78add_executable (evmc-vmtester vmtester.hpp vmtester.cpp tests.cpp )
89set_target_properties (evmc-vmtester PROPERTIES RUNTIME_OUTPUT_DIRECTORY .. )
910target_link_libraries (evmc-vmtester PRIVATE evmc loader evmc-example-host GTest::gtest )
1011set_source_files_properties (vmtester.cpp PROPERTIES COMPILE_DEFINITIONS PROJECT_VERSION = "${PROJECT_VERSION} " )
12+ add_executable (evmc::evmc-vmtester ALIAS evmc-vmtester )
1113
1214
13- install (TARGETS evmc-vmtester RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
15+ install (TARGETS evmc-vmtester EXPORT evmcTargets RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} )
1416
1517set (prefix ${PROJECT_NAME} /vmtester)
1618
17- add_test (NAME ${prefix} /examplevm COMMAND evmc-vmtester $< TARGET_FILE : evmc - example -vm > )
18- add_test (NAME ${prefix} /example_precompiles_vm COMMAND evmc-vmtester $< TARGET_FILE : evmc - example -precompiles -vm > )
19+ evmc_add_vm_test (NAME ${prefix} /examplevm TARGET evmc-example-vm )
20+ evmc_add_vm_test (NAME ${prefix} /example_precompiles_vm TARGET evmc-example-precompiles-vm )
1921
2022add_test (NAME ${prefix} /help COMMAND evmc-vmtester --version --help )
2123set_tests_properties (${prefix} /help PROPERTIES PASS_REGULAR_EXPRESSION "Usage:" )
You can’t perform that action at this time.
0 commit comments