mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #6914 from ethereum/boost170
Use imported targets for boost and update emscripten boost to 1.70.
This commit is contained in:
commit
502d22a26e
@ -78,7 +78,7 @@ jobs:
|
||||
name: Save Boost build
|
||||
key: *boost-cache-key
|
||||
paths:
|
||||
- boost_1_68_0
|
||||
- boost_1_70_0_install
|
||||
- store_artifacts:
|
||||
path: emscripten_build/libsolc/soljson.js
|
||||
destination: soljson.js
|
||||
|
@ -183,7 +183,7 @@ git:
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- boost_1_68_0
|
||||
- boost_1_70_0_install
|
||||
- $HOME/.local
|
||||
|
||||
install:
|
||||
|
@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.0.0)
|
||||
cmake_minimum_required(VERSION 3.5.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})
|
||||
|
@ -15,6 +15,8 @@ Bugfixes:
|
||||
Build System:
|
||||
* Attempt to use stock Z3 cmake files to find Z3 and only fall back to manual discovery.
|
||||
* Generate a cmake error for gcc versions older than 5.0.
|
||||
* CMake: use imported targets for boost.
|
||||
* Emscripten build: upgrade to boost 1.70.
|
||||
|
||||
|
||||
|
||||
|
@ -1,21 +1,6 @@
|
||||
# all dependencies that are not directly included in the cpp-ethereum distribution are defined here
|
||||
# for this to work, download the dependency via the cmake script in extdep or install them manually!
|
||||
|
||||
function(eth_show_dependency DEP NAME)
|
||||
get_property(DISPLAYED GLOBAL PROPERTY ETH_${DEP}_DISPLAYED)
|
||||
if (NOT DISPLAYED)
|
||||
set_property(GLOBAL PROPERTY ETH_${DEP}_DISPLAYED TRUE)
|
||||
if (NOT("${${DEP}_VERSION}" STREQUAL ""))
|
||||
message(STATUS "${NAME} version: ${${DEP}_VERSION}")
|
||||
endif()
|
||||
message(STATUS "${NAME} headers: ${${DEP}_INCLUDE_DIRS}")
|
||||
message(STATUS "${NAME} lib : ${${DEP}_LIBRARIES}")
|
||||
if (NOT("${${DEP}_DLLS}" STREQUAL ""))
|
||||
message(STATUS "${NAME} dll : ${${DEP}_DLLS}")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
if (DEFINED MSVC)
|
||||
# by defining CMAKE_PREFIX_PATH variable, cmake will look for dependencies first in our own repository before looking in system paths like /usr/local/ ...
|
||||
# this must be set to point to the same directory as $ETH_DEPENDENCY_INSTALL_DIR in /extdep directory
|
||||
@ -41,6 +26,29 @@ set(ETH_SCRIPTS_DIR ${ETH_CMAKE_DIR}/scripts)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
option(Boost_USE_STATIC_LIBS "Link Boost statically" ON)
|
||||
|
||||
find_package(Boost 1.65.0 QUIET REQUIRED COMPONENTS regex filesystem unit_test_framework program_options system)
|
||||
set(BOOST_COMPONENTS "regex;filesystem;unit_test_framework;program_options;system")
|
||||
|
||||
eth_show_dependency(Boost boost)
|
||||
find_package(Boost 1.65.0 QUIET REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
# If cmake is older than boost and boost is older than 1.70,
|
||||
# find_package does not define imported targets, so we have to
|
||||
# define them manually.
|
||||
|
||||
if (NOT TARGET Boost::boost) # header only target
|
||||
add_library(Boost::boost INTERFACE IMPORTED)
|
||||
target_include_directories(Boost::boost INTERFACE ${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
get_property(LOCATION TARGET Boost::boost PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
|
||||
message(STATUS "Found Boost headers in ${LOCATION}")
|
||||
|
||||
foreach (BOOST_COMPONENT IN LISTS BOOST_COMPONENTS)
|
||||
if (NOT TARGET Boost::${BOOST_COMPONENT})
|
||||
add_library(Boost::${BOOST_COMPONENT} UNKNOWN IMPORTED)
|
||||
string(TOUPPER ${BOOST_COMPONENT} BOOST_COMPONENT_UPPER)
|
||||
set_property(TARGET Boost::${BOOST_COMPONENT} PROPERTY IMPORTED_LOCATION ${Boost_${BOOST_COMPONENT_UPPER}_LIBRARY})
|
||||
set_property(TARGET Boost::${BOOST_COMPONENT} PROPERTY INTERFACE_LINK_LIBRARIES ${Boost_${BOOST_COMPONENT_UPPER}_LIBRARIES})
|
||||
set_property(TARGET Boost::${BOOST_COMPONENT} PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS})
|
||||
endif()
|
||||
get_property(LOCATION TARGET Boost::${BOOST_COMPONENT} PROPERTY IMPORTED_LOCATION)
|
||||
message(STATUS "Found Boost::${BOOST_COMPONENT} at ${LOCATION}")
|
||||
endforeach()
|
||||
|
@ -184,7 +184,7 @@ The following are dependencies for all builds of Solidity:
|
||||
+-----------------------------------+-------------------------------------------------------+
|
||||
| Software | Notes |
|
||||
+===================================+=======================================================+
|
||||
| `CMake`_ | Cross-platform build file generator. |
|
||||
| `CMake`_ (version 3.5+) | Cross-platform build file generator. |
|
||||
+-----------------------------------+-------------------------------------------------------+
|
||||
| `Boost`_ (version 1.65+) | C++ libraries. |
|
||||
+-----------------------------------+-------------------------------------------------------+
|
||||
@ -201,6 +201,13 @@ The following are dependencies for all builds of Solidity:
|
||||
.. _CMake: https://cmake.org/download/
|
||||
.. _z3: https://github.com/Z3Prover/z3
|
||||
|
||||
.. note::
|
||||
Solidity versions prior to 0.5.10 can fail to correctly link against Boost versions 1.70+.
|
||||
A possible workaround is to temporarily rename ``<Boost install path>/lib/cmake/Boost-1.70.0``
|
||||
prior to running the cmake command to configure solidity.
|
||||
|
||||
Starting from 0.5.10 linking against Boost 1.70+ should work without manual intervention.
|
||||
|
||||
Prerequisites - macOS
|
||||
---------------------
|
||||
|
||||
|
@ -34,7 +34,6 @@ set(sources
|
||||
)
|
||||
|
||||
add_library(devcore ${sources})
|
||||
target_link_libraries(devcore PUBLIC jsoncpp ${Boost_FILESYSTEM_LIBRARIES} ${Boost_REGEX_LIBRARIES} ${Boost_SYSTEM_LIBRARIES} Threads::Threads)
|
||||
target_link_libraries(devcore PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::regex Boost::system Threads::Threads)
|
||||
target_include_directories(devcore PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
target_include_directories(devcore SYSTEM PUBLIC ${Boost_INCLUDE_DIRS})
|
||||
add_dependencies(devcore solidity_BuildInfo.h)
|
||||
|
@ -137,7 +137,7 @@ if (NOT (${Z3_FOUND} OR ${CVC4_FOUND}))
|
||||
endif()
|
||||
|
||||
add_library(solidity ${sources} ${z3_SRCS} ${cvc4_SRCS})
|
||||
target_link_libraries(solidity PUBLIC yul evmasm langutil devcore ${Boost_FILESYSTEM_LIBRARY} ${Boost_SYSTEM_LIBRARY})
|
||||
target_link_libraries(solidity PUBLIC yul evmasm langutil devcore Boost::boost Boost::filesystem Boost::system)
|
||||
|
||||
if (${Z3_FOUND})
|
||||
target_link_libraries(solidity PUBLIC z3::libz3)
|
||||
|
@ -1,5 +1,5 @@
|
||||
add_executable(lllc main.cpp)
|
||||
target_link_libraries(lllc PRIVATE lll ${Boost_SYSTEM_LIBRARY})
|
||||
target_link_libraries(lllc PRIVATE lll Boost::boost Boost::system)
|
||||
|
||||
if (INSTALL_LLLC)
|
||||
include(GNUInstallDirs)
|
||||
|
@ -64,15 +64,14 @@ fi
|
||||
|
||||
# Boost
|
||||
echo -en 'travis_fold:start:compiling_boost\\r'
|
||||
cd "$WORKSPACE"/boost_1_68_0
|
||||
# if b2 exists, it is a fresh checkout, otherwise it comes from the cache
|
||||
# and is already compiled
|
||||
test -e b2 && (
|
||||
test -e "$WORKSPACE"/boost_1_70_0_install/include/boost/version.hpp || (
|
||||
cd "$WORKSPACE"/boost_1_70_0
|
||||
./b2 toolset=emscripten link=static variant=release threading=single runtime-link=static \
|
||||
system regex filesystem unit_test_framework program_options cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all"
|
||||
find . -name 'libboost*.a' -exec cp {} . \;
|
||||
rm -rf b2 libs doc tools more bin.v2 status
|
||||
--with-system --with-regex --with-filesystem --with-test --with-program_options cxxflags="-Wno-unused-local-typedef -Wno-variadic-macros -Wno-c99-extensions -Wno-all" \
|
||||
--prefix="$WORKSPACE"/boost_1_70_0_install install
|
||||
)
|
||||
ln -sf "$WORKSPACE"/boost_1_70_0_install/lib/* /emsdk_portable/sdk/system/lib
|
||||
ln -sf "$WORKSPACE"/boost_1_70_0_install/include/* /emsdk_portable/sdk/system/include
|
||||
echo -en 'travis_fold:end:compiling_boost\\r'
|
||||
|
||||
echo -en 'travis_fold:start:install_cmake.sh\\r'
|
||||
@ -87,15 +86,8 @@ cd $BUILD_DIR
|
||||
cmake \
|
||||
-DCMAKE_TOOLCHAIN_FILE=../cmake/toolchains/emscripten.cmake \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
-DBoost_FOUND=1 \
|
||||
-DBoost_USE_STATIC_LIBS=1 \
|
||||
-DBoost_USE_STATIC_RUNTIME=1 \
|
||||
-DBoost_INCLUDE_DIR="$WORKSPACE"/boost_1_68_0/ \
|
||||
-DBoost_FILESYSTEM_LIBRARY_RELEASE="$WORKSPACE"/boost_1_68_0/libboost_filesystem.a \
|
||||
-DBoost_PROGRAM_OPTIONS_LIBRARY_RELEASE="$WORKSPACE"/boost_1_68_0/libboost_program_options.a \
|
||||
-DBoost_REGEX_LIBRARY_RELEASE="$WORKSPACE"/boost_1_68_0/libboost_regex.a \
|
||||
-DBoost_SYSTEM_LIBRARY_RELEASE="$WORKSPACE"/boost_1_68_0/libboost_system.a \
|
||||
-DBoost_UNIT_TEST_FRAMEWORK_LIBRARY_RELEASE="$WORKSPACE"/boost_1_68_0/libboost_unit_test_framework.a \
|
||||
-DTESTS=0 \
|
||||
..
|
||||
make -j 4
|
||||
|
@ -30,15 +30,15 @@
|
||||
set -ev
|
||||
|
||||
echo -en 'travis_fold:start:installing_dependencies\\r'
|
||||
test -e boost_1_68_0 -a -e boost_1_68_0/boost || (
|
||||
rm -rf boost_1_68_0
|
||||
rm -f boost.tar.xz
|
||||
wget -q 'https://sourceforge.net/projects/boost/files/boost/1.68.0/boost_1_68_0.tar.gz/download'\
|
||||
-O boost.tar.xz
|
||||
test "$(shasum boost.tar.xz)" = "a78cf6ebb111a48385dd0c135e145a6819a8c856 boost.tar.xz"
|
||||
tar -xzf boost.tar.xz
|
||||
rm boost.tar.xz
|
||||
cd boost_1_68_0
|
||||
test -e boost_1_70_0_install/include/boost/version.hpp || (
|
||||
rm -rf boost_1_70_0
|
||||
rm -f boost.tar.gz
|
||||
wget -q 'https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.gz/download'\
|
||||
-O boost.tar.gz
|
||||
test "$(shasum boost.tar.gz)" = "7804c782deb00f36ac80b1000b71a3707eadb620 boost.tar.gz"
|
||||
tar -xzf boost.tar.gz
|
||||
rm boost.tar.gz
|
||||
cd boost_1_70_0
|
||||
./bootstrap.sh
|
||||
wget -q 'https://raw.githubusercontent.com/tee3/boost-build-emscripten/master/emscripten.jam'
|
||||
test "$(shasum emscripten.jam)" = "a7e13fc2c1e53b0e079ef440622f879aa6da3049 emscripten.jam"
|
||||
|
@ -5,7 +5,7 @@ set(
|
||||
)
|
||||
|
||||
add_executable(solc ${sources})
|
||||
target_link_libraries(solc PRIVATE solidity ${Boost_PROGRAM_OPTIONS_LIBRARIES})
|
||||
target_link_libraries(solc PRIVATE solidity Boost::boost Boost::program_options)
|
||||
|
||||
include(GNUInstallDirs)
|
||||
install(TARGETS solc DESTINATION "${CMAKE_INSTALL_BINDIR}")
|
||||
|
@ -30,7 +30,7 @@ add_executable(soltest ${sources} ${headers}
|
||||
${libsolidity_sources} ${libsolidity_headers}
|
||||
${libsolidity_util_sources} ${libsolidity_util_headers}
|
||||
)
|
||||
target_link_libraries(soltest PRIVATE libsolc yul solidity yulInterpreter evmasm devcore ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(soltest PRIVATE libsolc yul solidity yulInterpreter evmasm devcore Boost::boost Boost::program_options Boost::unit_test_framework)
|
||||
|
||||
if (LLL)
|
||||
target_link_libraries(soltest PRIVATE lll)
|
||||
|
@ -2,13 +2,13 @@ add_subdirectory(ossfuzz)
|
||||
|
||||
add_subdirectory(yulInterpreter)
|
||||
add_executable(yulrun yulrun.cpp)
|
||||
target_link_libraries(yulrun PRIVATE yulInterpreter libsolc evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES})
|
||||
target_link_libraries(yulrun PRIVATE yulInterpreter libsolc evmasm Boost::boost Boost::program_options)
|
||||
|
||||
add_executable(solfuzzer afl_fuzzer.cpp fuzzer_common.cpp)
|
||||
target_link_libraries(solfuzzer PRIVATE libsolc evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_SYSTEM_LIBRARIES})
|
||||
target_link_libraries(solfuzzer PRIVATE libsolc evmasm Boost::boost Boost::program_options Boost::system)
|
||||
|
||||
add_executable(yulopti yulopti.cpp)
|
||||
target_link_libraries(yulopti PRIVATE solidity ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_SYSTEM_LIBRARIES})
|
||||
target_link_libraries(yulopti PRIVATE solidity Boost::boost Boost::program_options Boost::system)
|
||||
|
||||
add_executable(isoltest
|
||||
isoltest.cpp
|
||||
@ -31,4 +31,4 @@ add_executable(isoltest
|
||||
../libyul/YulOptimizerTest.cpp
|
||||
../libyul/YulInterpreterTest.cpp
|
||||
)
|
||||
target_link_libraries(isoltest PRIVATE libsolc solidity yulInterpreter evmasm ${Boost_PROGRAM_OPTIONS_LIBRARIES} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES})
|
||||
target_link_libraries(isoltest PRIVATE libsolc solidity yulInterpreter evmasm Boost::boost Boost::program_options Boost::unit_test_framework)
|
||||
|
Loading…
Reference in New Issue
Block a user