Merge pull request #195 from ethereum/gcc4

Test minimal supported compilers
This commit is contained in:
Paweł Bylica 2019-03-12 00:42:58 +01:00 committed by GitHub
commit fb820fcf74
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 62 additions and 32 deletions

View File

@ -21,6 +21,7 @@ include(CMakePackageConfigHelpers)
include(GNUInstallDirs) include(GNUInstallDirs)
if(EVMC_TESTING) if(EVMC_TESTING)
set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages")
include(HunterGate) include(HunterGate)
include(HunterConfig) include(HunterConfig)
include(defaults/HunterCacheServers) include(defaults/HunterCacheServers)

View File

@ -18,10 +18,10 @@ Please visit the [documentation].
### Languages support ### Languages support
| Language | Supported Versions | | Language | Supported Versions | Supported Compilers
| ----------------------- | ------------------- | | ----------------------- | ------------------- | -------------------
| **C** | C90, C99, C11 | | **C** | C90, C99, C11 | GCC 6+, clang 3.8+
| **C++** _(helpers)_[^1] | C++11, C++14, C++17 | | **C++** _(helpers)_[^1] | C++11, C++14, C++17 | GCC 6+, clang 3.8+
| **Go** _(bindings)_ | 1.9, 1.10, 1.11 | | **Go** _(bindings)_ | 1.9, 1.10, 1.11 |
[^1]: C++ support is provided by C headers and some optional C++ helpers. [^1]: C++ support is provided by C headers and some optional C++ helpers.

View File

@ -3,12 +3,13 @@ jobs:
lint: lint:
docker: docker:
- image: ethereum/cpp-build-env:7 - image: ethereum/cpp-build-env:10
steps: steps:
- checkout - checkout
- run: - run:
name: "Check code format" name: "Check code format"
command: | command: |
clang-format --version
find examples include lib test -name '*.hpp' -o -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format -i find examples include lib test -name '*.hpp' -o -name '*.cpp' -o -name '*.h' -o -name '*.c' | xargs clang-format -i
git diff --color --exit-code git diff --color --exit-code
- run: - run:
@ -18,11 +19,21 @@ jobs:
sudo pip3 install codespell sudo pip3 install codespell
codespell --quiet-level=4 --ignore-words=./.codespell-whitelist codespell --quiet-level=4 --ignore-words=./.codespell-whitelist
build-cxx11: &build build: &build
docker: docker:
- image: ethereum/cpp-build-env:7 - image: ethereum/cpp-build-env:10
steps: steps:
- checkout - checkout
- run:
name: "Environment"
command: |
CC=${CC:-cc}
CXX=${CXX:-cpp}
echo CC: $CC
echo CXX: $CXX
$CC --version
$CXX --version
cmake --version
- run: - run:
name: "Configure" name: "Configure"
working_directory: ~/build working_directory: ~/build
@ -63,23 +74,35 @@ jobs:
name: "Run evmc-vmtester libevmc-example-vm.so" name: "Run evmc-vmtester libevmc-example-vm.so"
command: ~/install/bin/evmc-vmtester ~/install/lib/libevmc-example-vm.so command: ~/install/bin/evmc-vmtester ~/install/lib/libevmc-example-vm.so
build-cxx17:
<<: *build
environment:
CC: gcc-8
CXX: g++-8
CMAKE_OPTIONS: -DTOOLCHAIN=cxx17-pic
build-cxx14: build-cxx14:
<<: *build <<: *build
environment: environment:
CC: clang-3.8 CC: clang-8
CXX: clang++-3.8 CXX: clang++-8
CMAKE_OPTIONS: -DTOOLCHAIN=cxx14-pic CMAKE_OPTIONS: -DTOOLCHAIN=cxx14-pic
build-cxx17: build-gcc6:
<<: *build <<: *build
environment: environment:
CC: gcc-6 CC: gcc-6
CXX: g++-6 CXX: g++-6
CMAKE_OPTIONS: -DTOOLCHAIN=cxx17-pic
build-clang3.8:
<<: *build
environment:
CC: clang-3.8
CXX: clang++-3.8
test-docs: test-docs:
docker: docker:
- image: ethereum/cpp-build-env - image: ethereum/cpp-build-env:10
steps: steps:
- checkout - checkout
- run: - run:
@ -98,7 +121,7 @@ jobs:
upload-docs: upload-docs:
docker: docker:
- image: ethereum/cpp-build-env - image: ethereum/cpp-build-env:10
steps: steps:
- checkout - checkout
- run: - run:
@ -141,9 +164,10 @@ workflows:
evmc: evmc:
jobs: jobs:
- lint - lint
- build-cxx11
- build-cxx14
- build-cxx17 - build-cxx17
- build-cxx14
- build-gcc6
- build-clang3.8
- bindings-go-1.11 - bindings-go-1.11
- bindings-go-1.10 - bindings-go-1.10
- bindings-go-1.9 - bindings-go-1.9

View File

@ -1,5 +1,5 @@
# EVMC: Ethereum Client-VM Connector API. # EVMC: Ethereum Client-VM Connector API.
# Copyright 2018 The EVMC Authors. # 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. See the LICENSE file.
hunter_add_package(GTest) hunter_add_package(GTest)
@ -8,6 +8,7 @@ find_package(GTest CONFIG REQUIRED)
if(NOT CMAKE_CXX_STANDARD) if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_C_EXTENSIONS OFF)
endif() endif()
add_subdirectory(integration) add_subdirectory(integration)

View File

@ -5,28 +5,32 @@
# This CMake script creates multiple additional targets to test the compilation of public headers # This CMake script creates multiple additional targets to test the compilation of public headers
# with different C and C++ standards. # with different C and C++ standards.
set(standards c_std_90;c_std_99;c_std_11;cxx_std_11;cxx_std_14)
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 3.8.1)
list(APPEND standards cxx_std_17)
endif()
list(APPEND all_features ${CMAKE_CXX_COMPILE_FEATURES})
list(APPEND all_features ${CMAKE_C_COMPILE_FEATURES})
macro(create_compilation_test STANDARD) macro(create_compilation_test STANDARD)
if (${STANDARD} MATCHES "^(C|CXX)([0-9]+)$") if (${STANDARD} MATCHES "^(c|cxx)_std_([0-9]+)$")
set(lang ${CMAKE_MATCH_1}) set(lang ${CMAKE_MATCH_1})
set(num ${CMAKE_MATCH_2}) set(num ${CMAKE_MATCH_2})
else() else()
message(FATAL_ERROR "Unknown language standard: ${STANDARD}") message(FATAL_ERROR "Unknown standard: ${STANDARD}")
endif() endif()
if (lang STREQUAL CXX) if(${STANDARD} IN_LIST all_features)
set(ext cpp) set(target test-compile-${STANDARD})
add_library(${target} OBJECT compilation_test.${lang})
target_compile_features(${target} PRIVATE ${STANDARD})
target_include_directories(${target} PRIVATE ${include_dir})
else() else()
set(ext c) message(STATUS "Compilation test SKIPPED: ${STANDARD}")
endif() endif()
string(TOLOWER ${STANDARD} standard)
set(target test-compile-${standard})
add_library(${target} OBJECT compilation_test.${ext})
target_include_directories(${target} PRIVATE ${include_dir})
set_target_properties(${target} PROPERTIES ${lang}_STANDARD ${num} ${lang}_EXTENSIONS OFF)
endmacro() endmacro()
foreach(standard C90;C99;C11;CXX11;CXX14;CXX17) foreach(standard ${standards})
create_compilation_test(${standard}) create_compilation_test(${standard})
endforeach() endforeach()

View File

@ -111,9 +111,9 @@ TEST_F(evmc_vm_test, version)
TEST_F(evmc_vm_test, set_tracer) TEST_F(evmc_vm_test, set_tracer)
{ {
static const auto tracer_callback = [](evmc_tracer_context*, size_t, evmc_status_code, int64_t, static const auto tracer_callback =
size_t, const evmc_uint256be*, size_t, size_t, size_t, [](evmc_tracer_context*, size_t, evmc_status_code, int64_t, size_t, const evmc_uint256be*,
const uint8_t*) noexcept {}; size_t, size_t, size_t, const uint8_t*) noexcept {};
if (vm->set_tracer) if (vm->set_tracer)
vm->set_tracer(vm, tracer_callback, nullptr); vm->set_tracer(vm, tracer_callback, nullptr);
} }