mirror of https://github.com/status-im/evmc.git
Enhance compilation tests
This commit is contained in:
parent
f27aa78a34
commit
377167f76a
|
@ -1,6 +1,6 @@
|
||||||
# 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.
|
||||||
|
|
||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
|
|
||||||
|
|
|
@ -173,7 +173,7 @@ enum evmc_opcode
|
||||||
|
|
||||||
OP_REVERT = 0xfd,
|
OP_REVERT = 0xfd,
|
||||||
OP_INVALID = 0xfe,
|
OP_INVALID = 0xfe,
|
||||||
OP_SELFDESTRUCT = 0xff,
|
OP_SELFDESTRUCT = 0xff
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -40,7 +40,7 @@ enum evmc_loader_error_code
|
||||||
EVMC_LOADER_INSTANCE_CREATION_FAILURE = 4,
|
EVMC_LOADER_INSTANCE_CREATION_FAILURE = 4,
|
||||||
|
|
||||||
/** The ABI version of the VM instance has mismatched. */
|
/** The ABI version of the VM instance has mismatched. */
|
||||||
EVMC_LOADER_ABI_VERSION_MISMATCH = 5,
|
EVMC_LOADER_ABI_VERSION_MISMATCH = 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,19 +1,32 @@
|
||||||
# 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.
|
||||||
|
|
||||||
add_library(test-compile-c99 STATIC compilation_test.c)
|
# This CMake script creates multiple additional targets to test the compilation of public headers
|
||||||
target_link_libraries(test-compile-c99 PRIVATE evmc)
|
# with different C and C++ standards.
|
||||||
set_target_properties(test-compile-c99 PROPERTIES C_STANDARD 99 C_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
add_library(test-compile-c11 STATIC ${PROJECT_SOURCE_DIR}/include/evmc/evmc.h compilation_test.c)
|
macro(create_compilation_test STANDARD)
|
||||||
target_link_libraries(test-compile-c11 PRIVATE evmc)
|
if (${STANDARD} MATCHES "^(C|CXX)([0-9]+)$")
|
||||||
set_target_properties(test-compile-c11 PROPERTIES C_STANDARD 11 C_EXTENSIONS OFF)
|
set(lang ${CMAKE_MATCH_1})
|
||||||
|
set(num ${CMAKE_MATCH_2})
|
||||||
|
else()
|
||||||
|
message(FATAL_ERROR "Unknown language standard: ${STANDARD}")
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(test-compile-cxx98 STATIC compilation_test.cpp)
|
if (lang STREQUAL CXX)
|
||||||
target_link_libraries(test-compile-cxx98 PRIVATE evmc)
|
set(ext cpp)
|
||||||
set_target_properties(test-compile-cxx98 PROPERTIES CXX_STANDARD 98 CXX_EXTENSIONS OFF)
|
else()
|
||||||
|
set(ext c)
|
||||||
|
endif()
|
||||||
|
|
||||||
add_library(test-compile-cxx11 STATIC compilation_test.cpp)
|
string(TOLOWER ${STANDARD} standard)
|
||||||
target_link_libraries(test-compile-cxx11 PRIVATE evmc)
|
set(target test-compile-${standard})
|
||||||
set_target_properties(test-compile-cxx11 PROPERTIES CXX_STANDARD 11 CXX_EXTENSIONS OFF)
|
|
||||||
|
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()
|
||||||
|
|
||||||
|
foreach(standard C90;C99;C11;CXX11;CXX14;CXX17)
|
||||||
|
create_compilation_test(${standard})
|
||||||
|
endforeach()
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
/* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/* Test compilation of C public headers. */
|
||||||
|
|
||||||
#include <evmc/evmc.h>
|
#include <evmc/evmc.h>
|
||||||
|
#include <evmc/instructions.h>
|
||||||
|
#include <evmc/loader.h>
|
||||||
#include <evmc/utils.h>
|
#include <evmc/utils.h>
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
/* 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Test compilation of C and C++ public headers.
|
||||||
|
|
||||||
#include <evmc/evmc.h>
|
#include <evmc/evmc.h>
|
||||||
|
#include <evmc/instructions.h>
|
||||||
|
#include <evmc/loader.h>
|
||||||
#include <evmc/utils.h>
|
#include <evmc/utils.h>
|
||||||
|
#include <evmc/helpers.hpp>
|
||||||
|
|
Loading…
Reference in New Issue