aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaweł Bylica <chfast@gmail.com>2017-08-28 23:04:41 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2018-12-19 20:32:15 +0800
commitb57a36ddae0b84d5643f23dc14a9f1a01c7c9112 (patch)
tree55f69bf87d94ded28aba3c1efd49e5e66c5bc267
parent8875092073a30c94659f8a373658ca8286803054 (diff)
downloaddexon-solidity-b57a36ddae0b84d5643f23dc14a9f1a01c7c9112.tar.gz
dexon-solidity-b57a36ddae0b84d5643f23dc14a9f1a01c7c9112.tar.zst
dexon-solidity-b57a36ddae0b84d5643f23dc14a9f1a01c7c9112.zip
CMake: Use toolchain files
-rw-r--r--CMakeLists.txt2
-rw-r--r--cmake/EthCompilerSettings.cmake8
-rw-r--r--cmake/EthToolchains.cmake8
-rw-r--r--cmake/toolchains/default.cmake4
-rw-r--r--cmake/toolchains/emscripten.cmake2
-rwxr-xr-xscripts/travis-emscripten/build_emscripten.sh3
6 files changed, 18 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 399dd9df..cc59c6f4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -3,6 +3,8 @@ cmake_minimum_required(VERSION 3.0.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})
+include(EthToolchains)
+
# Set cmake_policies
include(EthPolicy)
eth_policy()
diff --git a/cmake/EthCompilerSettings.cmake b/cmake/EthCompilerSettings.cmake
index 70505fdb..19cf0694 100644
--- a/cmake/EthCompilerSettings.cmake
+++ b/cmake/EthCompilerSettings.cmake
@@ -24,10 +24,6 @@ endif()
eth_add_cxx_compiler_flag_if_supported(-Wimplicit-fallthrough)
if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang"))
-
- # Use ISO C++14 standard language.
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")
-
# Enables all the warnings about constructions that some users consider questionable,
# and that are easy to avoid. Also enable some extra warning flags that are not
# enabled by -Wall. Finally, treat at warnings-as-errors, which forces developers
@@ -78,10 +74,8 @@ if (("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" MA
# into errors, which makes sense.
# http://stackoverflow.com/questions/21617158/how-to-silence-unused-command-line-argument-error-with-clang-without-disabling-i
add_compile_options(-Qunused-arguments)
- endif()
- if (EMSCRIPTEN)
- # Do not emit a separate memory initialiser file
+ elseif(EMSCRIPTEN)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --memory-init-file 0")
# Leave only exported symbols as public and aggressively remove others
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fdata-sections -ffunction-sections -Wl,--gc-sections -fvisibility=hidden")
diff --git a/cmake/EthToolchains.cmake b/cmake/EthToolchains.cmake
new file mode 100644
index 00000000..a4263b7d
--- /dev/null
+++ b/cmake/EthToolchains.cmake
@@ -0,0 +1,8 @@
+if(NOT CMAKE_TOOLCHAIN_FILE)
+ # Use default toolchain file if none is provided.
+ set(
+ CMAKE_TOOLCHAIN_FILE
+ "${CMAKE_CURRENT_LIST_DIR}/toolchains/default.cmake"
+ CACHE FILEPATH "The CMake toolchain file"
+ )
+endif()
diff --git a/cmake/toolchains/default.cmake b/cmake/toolchains/default.cmake
new file mode 100644
index 00000000..baf859b7
--- /dev/null
+++ b/cmake/toolchains/default.cmake
@@ -0,0 +1,4 @@
+# Require C++14.
+set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
+set(CMAKE_CXX_EXTENSIONS OFF)
diff --git a/cmake/toolchains/emscripten.cmake b/cmake/toolchains/emscripten.cmake
new file mode 100644
index 00000000..6c29074f
--- /dev/null
+++ b/cmake/toolchains/emscripten.cmake
@@ -0,0 +1,2 @@
+include("${CMAKE_CURRENT_LIST_DIR}/default.cmake")
+include("$ENV{EMSCRIPTEN}/cmake/Modules/Platform/Emscripten.cmake")
diff --git a/scripts/travis-emscripten/build_emscripten.sh b/scripts/travis-emscripten/build_emscripten.sh
index 32899903..d1978a7c 100755
--- a/scripts/travis-emscripten/build_emscripten.sh
+++ b/scripts/travis-emscripten/build_emscripten.sh
@@ -79,9 +79,8 @@ cd $WORKSPACE
mkdir -p build
cd build
cmake \
- -DCMAKE_TOOLCHAIN_FILE=$EMSCRIPTEN/cmake/Modules/Platform/Emscripten.cmake \
+ -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/emscripten.cmake \
-DCMAKE_BUILD_TYPE=Release \
- -DEMSCRIPTEN=1 \
-DBoost_FOUND=1 \
-DBoost_USE_STATIC_LIBS=1 \
-DBoost_USE_STATIC_RUNTIME=1 \