diff --git a/.circleci/config.yml b/.circleci/config.yml index e4b4d0654..f6346c2d1 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -292,13 +292,13 @@ jobs: command: codecov --flags all --gcov-root build - store_artifacts: *artifacts_test_results - # Builds in C++17 mode and uses debug build in order to speed up. + # Builds in C++20 mode and uses debug build in order to speed up. # Do *NOT* store any artifacts or workspace as we don't run tests on this build. - b_ubu_cxx17: + b_ubu_cxx20: <<: *build_ubuntu1904 environment: CMAKE_BUILD_TYPE: Debug - CMAKE_OPTIONS: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/cxx17.cmake -DUSE_CVC4=OFF + CMAKE_OPTIONS: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchains/cxx20.cmake -DUSE_CVC4=OFF steps: - checkout - run: *run_build @@ -612,7 +612,7 @@ workflows: # build-only - b_docs: *workflow_trigger_on_tags - b_archlinux: *workflow_trigger_on_tags - - b_ubu_cxx17: *workflow_trigger_on_tags + - b_ubu_cxx20: *workflow_trigger_on_tags - b_ubu_ossfuzz: *workflow_trigger_on_tags # OS/X build and tests diff --git a/.travis.yml b/.travis.yml index 7e1114974..5754fa0a9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -188,7 +188,7 @@ cache: install: - test $SOLC_INSTALL_DEPS_TRAVIS != On || (scripts/install_deps.sh) - - test "$TRAVIS_OS_NAME" != "linux" || (scripts/install_cmake.sh) + - test "$TRAVIS_OS_NAME" != "linux" || (sudo scripts/install_cmake.sh) before_script: # Disable tests unless run on the release branch, on tags or with daily cron diff --git a/CMakeLists.txt b/CMakeLists.txt index f3d724d26..a1927bf33 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.5.0) +cmake_minimum_required(VERSION 3.9.0) set(ETH_CMAKE_DIR "${CMAKE_CURRENT_LIST_DIR}/cmake" CACHE PATH "The the path to the cmake directory") list(APPEND CMAKE_MODULE_PATH ${ETH_CMAKE_DIR}) @@ -13,11 +13,6 @@ eth_policy() set(PROJECT_VERSION "0.5.12") project(solidity VERSION ${PROJECT_VERSION} LANGUAGES C CXX) -if (${CMAKE_VERSION} VERSION_LESS "3.9.0") - # needed for the big endian test for older cmake versions - enable_language(C) -endif() - include(TestBigEndian) TEST_BIG_ENDIAN(IS_BIG_ENDIAN) if (IS_BIG_ENDIAN) diff --git a/cmake/jsoncpp.cmake b/cmake/jsoncpp.cmake index 4ca8581dc..48cec7318 100644 --- a/cmake/jsoncpp.cmake +++ b/cmake/jsoncpp.cmake @@ -15,9 +15,9 @@ set(JSONCPP_INCLUDE_DIR "${prefix}/include") # versions used in the CI runs. if(EMSCRIPTEN) # Do not include all flags in CMAKE_CXX_FLAGS for emscripten, - # but only use -std=c++14. Using all flags causes build failures + # but only use -std=c++17. Using all flags causes build failures # at the moment. - set(JSONCPP_CXX_FLAGS -std=c++14) + set(JSONCPP_CXX_FLAGS -std=c++17) else() set(JSONCPP_CXX_FLAGS ${CMAKE_CXX_FLAGS}) endif() diff --git a/cmake/toolchains/cxx17.cmake b/cmake/toolchains/cxx17.cmake deleted file mode 100644 index 04a865ebd..000000000 --- a/cmake/toolchains/cxx17.cmake +++ /dev/null @@ -1,4 +0,0 @@ -# Require C++17. -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED TRUE) -set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/cmake/toolchains/cxx20.cmake b/cmake/toolchains/cxx20.cmake new file mode 100644 index 000000000..ad34e5749 --- /dev/null +++ b/cmake/toolchains/cxx20.cmake @@ -0,0 +1,4 @@ +# Require C++20. +set(CMAKE_CXX_STANDARD 20) # This requires at least CMake 3.12 to understand this C++20 flag +set(CMAKE_CXX_STANDARD_REQUIRED TRUE) +set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/cmake/toolchains/default.cmake b/cmake/toolchains/default.cmake index baf859b70..07fc80e8e 100644 --- a/cmake/toolchains/default.cmake +++ b/cmake/toolchains/default.cmake @@ -1,4 +1,4 @@ -# Require C++14. -set(CMAKE_CXX_STANDARD 14) +# Require C++17. +set(CMAKE_CXX_STANDARD 17) # This requires at least CMake 3.8 to accept this C++17 flag. set(CMAKE_CXX_STANDARD_REQUIRED TRUE) set(CMAKE_CXX_EXTENSIONS OFF) diff --git a/docs/installing-solidity.rst b/docs/installing-solidity.rst index 2d8f257d4..ade678087 100644 --- a/docs/installing-solidity.rst +++ b/docs/installing-solidity.rst @@ -184,7 +184,7 @@ The following are dependencies for all builds of Solidity: +-----------------------------------+-------------------------------------------------------+ | Software | Notes | +===================================+=======================================================+ -| `CMake`_ (version 3.5+) | Cross-platform build file generator. | +| `CMake`_ (version 3.9+) | Cross-platform build file generator. | +-----------------------------------+-------------------------------------------------------+ | `Boost`_ (version 1.65+) | C++ libraries. | +-----------------------------------+-------------------------------------------------------+ diff --git a/libdevcore/CMakeLists.txt b/libdevcore/CMakeLists.txt index a092e3140..8bc3bb525 100644 --- a/libdevcore/CMakeLists.txt +++ b/libdevcore/CMakeLists.txt @@ -34,6 +34,6 @@ set(sources ) add_library(devcore ${sources}) -target_link_libraries(devcore PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::regex Boost::system Threads::Threads) +target_link_libraries(devcore PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::regex Boost::system) target_include_directories(devcore PUBLIC "${CMAKE_SOURCE_DIR}") add_dependencies(devcore solidity_BuildInfo.h) diff --git a/scripts/install_cmake.sh b/scripts/install_cmake.sh index e334b2c90..134b86f09 100755 --- a/scripts/install_cmake.sh +++ b/scripts/install_cmake.sh @@ -6,16 +6,18 @@ set -e -VERSION=3.7.1 -PREFIX=~/.local +VERSION_MAJOR=3 +VERSION_MINOR=15 +VERSION_MICRO=2 +VERSION=$VERSION_MAJOR.$VERSION_MINOR.$VERSION_MICRO +PREFIX="/usr/local" OS=$(uname -s) case $OS in -Linux) SHA256=7b4b7a1d9f314f45722899c0521c261e4bfab4a6b532609e37fef391da6bade2;; -Darwin) SHA256=1851d1448964893fdc5a8c05863326119f397a3790e0c84c40b83499c7960267;; +Linux) SHA256=f8cbec2abc433938bd9378b129d1d288bb33b8b5a277afe19644683af6e32a59;; +Darwin) SHA256=7ec056d641b8cbea98b220efdcc99da1991758a370063dcac3a0cd388d6b30b6;; esac - BIN=$PREFIX/bin PATH=$PREFIX/bin:$PATH @@ -24,7 +26,7 @@ if test -f $BIN/cmake && ($BIN/cmake --version | grep -q "$VERSION"); then echo "CMake $VERSION already installed in $BIN" else FILE=cmake-$VERSION-$OS-x86_64.tar.gz - URL=https://cmake.org/files/v3.7/$FILE + URL=https://cmake.org/files/v$VERSION_MAJOR.$VERSION_MINOR/$FILE ERROR=0 TMPFILE=$(mktemp --tmpdir cmake-$VERSION-$OS-x86_64.XXXXXXXX.tar.gz) echo "Downloading CMake ($URL)..."