mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add range-v3.
This commit is contained in:
parent
dfcba3bbd3
commit
eac2bcf72f
@ -30,6 +30,7 @@ include(EthCcache)
|
||||
# Let's find our dependencies
|
||||
include(EthDependencies)
|
||||
include(jsoncpp)
|
||||
include(range-v3)
|
||||
include_directories(SYSTEM ${JSONCPP_INCLUDE_DIR})
|
||||
|
||||
find_package(Threads)
|
||||
|
38
cmake/range-v3.cmake
Normal file
38
cmake/range-v3.cmake
Normal file
@ -0,0 +1,38 @@
|
||||
include(ExternalProject)
|
||||
|
||||
if (${CMAKE_SYSTEM_NAME} STREQUAL "Emscripten")
|
||||
set(RANGE_V3_CMAKE_COMMAND emcmake cmake)
|
||||
else()
|
||||
set(RANGE_V3_CMAKE_COMMAND ${CMAKE_COMMAND})
|
||||
endif()
|
||||
|
||||
set(prefix "${CMAKE_BINARY_DIR}/deps")
|
||||
set(RANGE_V3_INCLUDE_DIR "${prefix}/include")
|
||||
|
||||
ExternalProject_Add(range-v3-project
|
||||
PREFIX "${prefix}"
|
||||
DOWNLOAD_DIR "${CMAKE_SOURCE_DIR}/deps/downloads"
|
||||
DOWNLOAD_NAME range-v3-0.11.0.tar.gz
|
||||
URL https://github.com/ericniebler/range-v3/archive/0.11.0.tar.gz
|
||||
URL_HASH SHA256=376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c
|
||||
CMAKE_COMMAND ${RANGE_V3_CMAKE_COMMAND}
|
||||
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=<INSTALL_DIR>
|
||||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
-DBUILD_TESTING=OFF
|
||||
-DRANGES_CXX_STD=${CMAKE_CXX_STANDARD}
|
||||
-DRANGE_V3_DOCS=OFF
|
||||
-DRANGE_V3_EXAMPLES=OFF
|
||||
-DRANGE_V3_TESTS=OFF
|
||||
-DRANGES_BUILD_CALENDAR_EXAMPLE=OFF
|
||||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
||||
BUILD_BYPRODUCTS "${RANGE_V3_INCLUDE_DIR}/range/v3/all.hpp"
|
||||
)
|
||||
|
||||
# Create range-v3 imported library
|
||||
add_library(range-v3 INTERFACE IMPORTED)
|
||||
file(MAKE_DIRECTORY ${RANGE_V3_INCLUDE_DIR}) # Must exist.
|
||||
set_target_properties(range-v3 PROPERTIES
|
||||
INTERFACE_COMPILE_OPTIONS "\$<\$<CXX_COMPILER_ID:MSVC>:/permissive->"
|
||||
INTERFACE_SYSTEM_INCLUDE_DIRECTORIES ${RANGE_V3_INCLUDE_DIR}
|
||||
INTERFACE_INCLUDE_DIRECTORIES ${RANGE_V3_INCLUDE_DIR})
|
||||
add_dependencies(range-v3 range-v3-project)
|
@ -46,6 +46,8 @@
|
||||
#include <boost/range/adaptor/transformed.hpp>
|
||||
#include <boost/range/algorithm/copy.hpp>
|
||||
|
||||
#include <range/v3/view/enumerate.hpp>
|
||||
|
||||
#include <limits>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
@ -167,8 +169,8 @@ pair<u256, unsigned> const* MemberList::memberStorageOffset(string const& _name)
|
||||
{
|
||||
StorageOffsets const& offsets = storageOffsets();
|
||||
|
||||
for (size_t index = 0; index < m_memberTypes.size(); ++index)
|
||||
if (m_memberTypes[index].name == _name)
|
||||
for (auto&& [index, member]: m_memberTypes | ranges::views::enumerate)
|
||||
if (member.name == _name)
|
||||
return offsets.offset(index);
|
||||
return nullptr;
|
||||
}
|
||||
|
@ -40,7 +40,7 @@ set(sources
|
||||
)
|
||||
|
||||
add_library(solutil ${sources})
|
||||
target_link_libraries(solutil PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::system)
|
||||
target_link_libraries(solutil PUBLIC jsoncpp Boost::boost Boost::filesystem Boost::system range-v3)
|
||||
target_include_directories(solutil PUBLIC "${CMAKE_SOURCE_DIR}")
|
||||
add_dependencies(solutil solidity_BuildInfo.h)
|
||||
|
||||
|
@ -108,6 +108,7 @@ mv solidity solc
|
||||
# Fetch jsoncpp dependency
|
||||
mkdir -p ./solc/deps/downloads/ 2>/dev/null || true
|
||||
wget -O ./solc/deps/downloads/jsoncpp-1.9.3.tar.gz https://github.com/open-source-parsers/jsoncpp/archive/1.9.3.tar.gz
|
||||
wget -O ./solc/deps/downloads/range-v3-0.11.0.tar.gz https://github.com/ericniebler/range-v3/archive/0.11.0.tar.gz
|
||||
|
||||
# Determine version
|
||||
cd solc
|
||||
|
Loading…
Reference in New Issue
Block a user