Skip to content

Commit

Permalink
Merge pull request ethereum#216 from ethereum/cmake-test-tools
Browse files Browse the repository at this point in the history
CMake: Add option EVMC_TEST_TOOLS
  • Loading branch information
chfast authored Mar 14, 2019
2 parents 645c550 + e3c3661 commit 4335f43
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 10 deletions.
17 changes: 12 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
Expand Down Expand Up @@ -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()

Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 6 additions & 3 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand All @@ -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)

0 comments on commit 4335f43

Please sign in to comment.