forked from erigontech/silkrpc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
75 lines (59 loc) · 2.51 KB
/
CMakeLists.txt
File metadata and controls
75 lines (59 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#[[
Copyright 2020 The Silkrpc Authors
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
]]
cmake_minimum_required(VERSION 3.16)
# Check that submodules initialization has been done
if(NOT EXISTS ${CMAKE_SOURCE_DIR}/silkworm/.git)
message(FATAL_ERROR "Git submodules not initialized, execute:\n git submodule update --init --recursive")
endif()
# Use default toolchain file if not specified on the command line
if(NOT CMAKE_TOOLCHAIN_FILE)
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/silkworm/cmake/toolchain/cxx20.cmake CACHE FILEPATH "" FORCE)
endif()
include(silkworm/third_party/evmone/cmake/cable/bootstrap.cmake)
include(CableBuildInfo)
include(silkworm/third_party/evmone/cmake/cable/HunterGate.cmake)
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.23.317.tar.gz"
SHA1 "fbdd94b1966d351384e27b02c8d134915b1131d6"
FILEPATH "${CMAKE_SOURCE_DIR}/cmake/Hunter/config.cmake"
)
project(silkrpc)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 10.3.0)
message(FATAL_ERROR "required gcc version >= 10.3.0")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.3.0)
message(FATAL_ERROR "required g++ version >= 10.3.0")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
if(CMAKE_C_COMPILER_VERSION VERSION_LESS 10.0.0)
message(FATAL_ERROR "required clang version >= 10.0.0")
endif()
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 10.0.0)
message(FATAL_ERROR "required clang++ version >= 10.0.0")
endif()
endif()
include(cmake/Hunter/packages.cmake)
# Silkworm
find_package(ethash CONFIG REQUIRED)
find_package(intx CONFIG REQUIRED)
add_subdirectory(silkworm)
# Silkrpc itself
option(SILKRPC_CLANG_COVERAGE "Clang instrumentation for code coverage reports" OFF)
if(SILKRPC_CLANG_COVERAGE)
add_compile_options(-fprofile-instr-generate -fcoverage-mapping -DBUILD_COVERAGE)
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
endif()
add_subdirectory(silkrpc)
add_subdirectory(cmd)
add_subdirectory(examples)