cmake: Add evmc::evmc_cpp INTERFACE library for evmc.hpp

This commit is contained in:
Paweł Bylica 2019-11-28 20:02:20 +01:00
parent 63c2165d4a
commit beb0d92c11
No known key found for this signature in database
GPG Key ID: 7A0C037434FE77EF
9 changed files with 21 additions and 16 deletions

View File

@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning].
- In the Rust bindings added more type aliases (`MessageKind`, `MessageFlags`, `StatusCode`, - In the Rust bindings added more type aliases (`MessageKind`, `MessageFlags`, `StatusCode`,
`StorageStatus`, `Revision`). `StorageStatus`, `Revision`).
[#206](https://github.com/ethereum/evmc/pull/206) [#206](https://github.com/ethereum/evmc/pull/206)
- In CMake the `evmc::evmc_cpp` target has been added which represents the C++ EVMC API.
[#470](https://github.com/ethereum/evmc/pull/470)
### Changed ### Changed

View File

@ -71,7 +71,6 @@ configure_package_config_file(
) )
if(EVMC_INSTALL) if(EVMC_INSTALL)
install(TARGETS evmc EXPORT evmcTargets)
install(DIRECTORY include/evmc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) install(DIRECTORY include/evmc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
install( install(

View File

@ -8,11 +8,11 @@ add_subdirectory(example_vm)
add_subdirectory(example_precompiles_vm) add_subdirectory(example_precompiles_vm)
add_library(evmc-example-host STATIC example_host.cpp) add_library(evmc-example-host STATIC example_host.cpp)
target_link_libraries(evmc-example-host PRIVATE evmc) target_link_libraries(evmc-example-host PRIVATE evmc::evmc_cpp)
add_executable(evmc-example-static example.c) add_executable(evmc-example-static example.c)
target_link_libraries(evmc-example-static PRIVATE evmc-example-host evmc::example-vm-static evmc) target_link_libraries(evmc-example-static PRIVATE evmc-example-host evmc::example-vm-static evmc::evmc)
target_compile_definitions(evmc-example-static PRIVATE STATICALLY_LINKED_EXAMPLE) target_compile_definitions(evmc-example-static PRIVATE STATICALLY_LINKED_EXAMPLE)
add_executable(evmc-example example.c) add_executable(evmc-example example.c)
target_link_libraries(evmc-example PRIVATE evmc-example-host evmc evmc::loader) target_link_libraries(evmc-example PRIVATE evmc-example-host evmc::loader)

View File

@ -4,11 +4,11 @@
add_library(example-precompiles-vm SHARED example_precompiles_vm.cpp example_precompiles_vm.h) add_library(example-precompiles-vm SHARED example_precompiles_vm.cpp example_precompiles_vm.h)
add_library(evmc::example-precompiles-vm ALIAS example-precompiles-vm) add_library(evmc::example-precompiles-vm ALIAS example-precompiles-vm)
target_link_libraries(example-precompiles-vm PRIVATE evmc) target_link_libraries(example-precompiles-vm PRIVATE evmc::evmc)
add_library(example-precompiles-vm-static STATIC example_precompiles_vm.cpp example_precompiles_vm.h) add_library(example-precompiles-vm-static STATIC example_precompiles_vm.cpp example_precompiles_vm.h)
add_library(evmc::example-precompiles-vm-static ALIAS example-precompiles-vm-static) add_library(evmc::example-precompiles-vm-static ALIAS example-precompiles-vm-static)
target_link_libraries(example-precompiles-vm-static PRIVATE evmc) target_link_libraries(example-precompiles-vm-static PRIVATE evmc::evmc)
set_source_files_properties(example_precompiles_vm.cpp PROPERTIES set_source_files_properties(example_precompiles_vm.cpp PROPERTIES
COMPILE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}") COMPILE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}")

View File

@ -4,11 +4,11 @@
add_library(example-vm SHARED example_vm.c example_vm.h) add_library(example-vm SHARED example_vm.c example_vm.h)
add_library(evmc::example-vm ALIAS example-vm) add_library(evmc::example-vm ALIAS example-vm)
target_link_libraries(example-vm PRIVATE evmc) target_link_libraries(example-vm PRIVATE evmc::evmc)
add_library(example-vm-static STATIC example_vm.c example_vm.h) add_library(example-vm-static STATIC example_vm.c example_vm.h)
add_library(evmc::example-vm-static ALIAS example-vm-static) add_library(evmc::example-vm-static ALIAS example-vm-static)
target_link_libraries(example-vm-static PRIVATE evmc) target_link_libraries(example-vm-static PRIVATE evmc::evmc)
set_source_files_properties(example_vm.cpp PROPERTIES set_source_files_properties(example_vm.cpp PROPERTIES
COMPILE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}") COMPILE_DEFINITIONS PROJECT_VERSION="${PROJECT_VERSION}")

View File

@ -6,6 +6,15 @@ add_library(evmc INTERFACE)
add_library(evmc::evmc ALIAS evmc) add_library(evmc::evmc ALIAS evmc)
target_include_directories(evmc INTERFACE $<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:include>) target_include_directories(evmc INTERFACE $<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:include>)
add_library(evmc_cpp INTERFACE)
add_library(evmc::evmc_cpp ALIAS evmc_cpp)
target_include_directories(evmc_cpp INTERFACE $<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:include>)
target_link_libraries(evmc_cpp INTERFACE evmc::evmc)
add_subdirectory(instructions) add_subdirectory(instructions)
add_subdirectory(loader) add_subdirectory(loader)
add_subdirectory(mocked_host) add_subdirectory(mocked_host)
if(EVMC_INSTALL)
install(TARGETS evmc evmc_cpp EXPORT evmcTargets)
endif()

View File

@ -13,10 +13,7 @@ set_target_properties(loader PROPERTIES
OUTPUT_NAME evmc-loader OUTPUT_NAME evmc-loader
POSITION_INDEPENDENT_CODE TRUE POSITION_INDEPENDENT_CODE TRUE
) )
target_include_directories(loader PUBLIC target_link_libraries(loader INTERFACE ${CMAKE_DL_LIBS} PUBLIC evmc::evmc)
$<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
target_link_libraries(loader INTERFACE ${CMAKE_DL_LIBS})
if(EVMC_INSTALL) if(EVMC_INSTALL)
install(TARGETS loader EXPORT evmcTargets DESTINATION ${CMAKE_INSTALL_LIBDIR}) install(TARGETS loader EXPORT evmcTargets DESTINATION ${CMAKE_INSTALL_LIBDIR})

View File

@ -6,9 +6,7 @@ add_library(mocked_host INTERFACE)
target_sources(mocked_host INTERFACE $<BUILD_INTERFACE:${include_dir}/evmc/mocked_host.hpp>) target_sources(mocked_host INTERFACE $<BUILD_INTERFACE:${include_dir}/evmc/mocked_host.hpp>)
add_library(evmc::mocked_host ALIAS mocked_host) add_library(evmc::mocked_host ALIAS mocked_host)
target_include_directories(mocked_host INTERFACE target_link_libraries(mocked_host INTERFACE evmc::evmc_cpp)
$<BUILD_INTERFACE:${include_dir}>$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
)
if(EVMC_INSTALL) if(EVMC_INSTALL)
install(TARGETS mocked_host EXPORT evmcTargets) install(TARGETS mocked_host EXPORT evmcTargets)

View File

@ -11,7 +11,7 @@ find_package(GTest CONFIG REQUIRED)
set_target_properties(GTest::gtest PROPERTIES INTERFACE_COMPILE_DEFINITIONS GTEST_HAS_TR1_TUPLE=0) set_target_properties(GTest::gtest PROPERTIES INTERFACE_COMPILE_DEFINITIONS GTEST_HAS_TR1_TUPLE=0)
add_library(loader-mocked STATIC ${PROJECT_SOURCE_DIR}/lib/loader/loader.c) add_library(loader-mocked STATIC ${PROJECT_SOURCE_DIR}/lib/loader/loader.c)
target_link_libraries(loader-mocked PRIVATE evmc) target_link_libraries(loader-mocked PRIVATE evmc::evmc)
target_compile_definitions(loader-mocked PRIVATE EVMC_LOADER_MOCK=1) target_compile_definitions(loader-mocked PRIVATE EVMC_LOADER_MOCK=1)
add_executable( add_executable(