Merge pull request #216 from ethereum/cmake-test-tools

CMake: Add option EVMC_TEST_TOOLS
This commit is contained in:
Paweł Bylica 2019-03-14 18:31:01 +01:00 committed by GitHub
commit 4335f434b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 10 deletions

View File

@ -9,9 +9,13 @@ if(TARGET evmc)
return()
endif()
option(EVMC_TESTING "Build EVMC tests and test tools" OFF)
option(EVMC_EXAMPLES "Build EVMC examples" ${EVMC_TESTING})
option(HUNTER_ENABLED "Enable Hunter package manager support" "${EVMC_TESTING}")
option(EVMC_TESTING "Build EVMC examples, tests and test tools (i.e. everything)" OFF)
option(EVMC_TEST_TOOLS "Build EVMC test tools" ${EVMC_TESTING})
if(EVMC_TESTING OR EVMC_TEST_TOOLS)
set(hunter_and_examples_required TRUE)
endif()
option(EVMC_EXAMPLES "Build EVMC examples" ${hunter_and_examples_required})
option(HUNTER_ENABLED "Enable Hunter package manager support" ${hunter_and_examples_required})
include(cmake/cable/bootstrap.cmake)
include(CableBuildType)
@ -20,7 +24,7 @@ include(CableToolchains)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
if(EVMC_TESTING)
if(HUNTER_ENABLED)
set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages")
include(HunterGate)
include(HunterConfig)
@ -49,10 +53,13 @@ add_subdirectory(lib)
if(EVMC_TESTING)
enable_testing()
endif()
if(EVMC_TESTING OR EVMC_TEST_TOOLS)
add_subdirectory(test)
endif()
if(EVMC_EXAMPLES OR EVMC_TESTING)
if(EVMC_TESTING OR EVMC_EXAMPLES)
add_subdirectory(examples)
endif()

View File

@ -24,7 +24,7 @@ before_build:
if ($env:GENERATOR) {
if (!(test-path build)) { mkdir build }
cd build
cmake -Wno-dev -G "$env:GENERATOR" .. -DBUILD_SHARED_LIBS=ON -DEVMC_EXAMPLES=ON -DEVMC_TESTING=ON -DCMAKE_INSTALL_PREFIX=C:\install
cmake -Wno-dev -G "$env:GENERATOR" .. -DBUILD_SHARED_LIBS=ON -DEVMC_TESTING=ON -DCMAKE_INSTALL_PREFIX=C:\install
}
build_script:

View File

@ -35,7 +35,7 @@ jobs:
- run:
name: "Configure"
working_directory: ~/build
command: cmake ../project -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_SHARED_LIBS=ON -DEVMC_EXAMPLES=ON -DEVMC_TESTING=ON $CMAKE_OPTIONS
command: cmake ../project -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_SHARED_LIBS=ON -DEVMC_TESTING=ON $CMAKE_OPTIONS
- run:
name: "Build"
command: cmake --build ~/build

View File

@ -1,6 +1,6 @@
# EVMC: Ethereum Client-VM Connector API.
# Copyright 2019 The EVMC Authors.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
# Licensed under the Apache License, Version 2.0.
hunter_add_package(GTest)
find_package(GTest CONFIG REQUIRED)
@ -11,6 +11,9 @@ if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_C_EXTENSIONS OFF)
endif()
add_subdirectory(integration)
add_subdirectory(unittests)
if(EVMC_TESTING)
add_subdirectory(integration)
add_subdirectory(unittests)
endif()
add_subdirectory(vmtester)