Skip to content

Commit

Permalink
Defaulting to C++17 for building.
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Parpart authored and ekpyron committed Aug 13, 2019
1 parent bd105ad commit e91c6ac
Show file tree
Hide file tree
Showing 10 changed files with 24 additions and 27 deletions.
8 changes: 4 additions & 4 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 1 addition & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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})
Expand All @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions cmake/jsoncpp.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
4 changes: 0 additions & 4 deletions cmake/toolchains/cxx17.cmake

This file was deleted.

4 changes: 4 additions & 0 deletions cmake/toolchains/cxx20.cmake
Original file line number Diff line number Diff line change
@@ -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)
4 changes: 2 additions & 2 deletions cmake/toolchains/default.cmake
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 1 addition & 1 deletion docs/installing-solidity.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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. |
+-----------------------------------+-------------------------------------------------------+
Expand Down
2 changes: 1 addition & 1 deletion libdevcore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
14 changes: 8 additions & 6 deletions scripts/install_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)..."
Expand Down

0 comments on commit e91c6ac

Please sign in to comment.