forked from chfast/ethash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
61 lines (46 loc) · 1.95 KB
/
CMakeLists.txt
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
# ethash: C/C++ implementation of Ethash, the Ethereum Proof of Work algorithm.
# Copyright 2018 Pawel Bylica.
# Licensed under the Apache License, Version 2.0. See the LICENSE file.
cmake_minimum_required(VERSION 3.5)
include(cmake/cable/bootstrap.cmake)
include(CableBuildType)
include(CableCompilerSettings)
include(CableToolchains)
include(HunterGate)
include(defaults/HunterCacheServers)
cable_configure_toolchain(DEFAULT cxx11)
if(NOT WIN32)
# Outside of Windows build only Release packages.
set(HUNTER_CONFIGURATION_TYPES Release
CACHE STRING "Build type of the Hunter packages")
endif()
HunterGate(
URL "https://github.com/cpp-pm/hunter/archive/v0.25.7.tar.gz"
SHA1 "99f05ff154c682f7349546d66294d2f69f7193bc"
)
project(ethash)
set(PROJECT_VERSION 0.4.0.dev0)
cable_set_build_type(DEFAULT RelWithDebInfo CONFIGURATION_TYPES Release RelWithDebInfo Debug)
cable_configure_compiler(NO_STACK_PROTECTION)
if(CABLE_COMPILER_GNULIKE)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -Og")
if(NOT CMAKE_CROSSCOMPILING)
# Tune for currently most common CPUs (flag not supported in cross compilation).
add_compile_options(-mtune=generic)
endif()
elseif(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
# For Win32 builds allow allocating more than 2 GB of memory.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
endif()
option(ETHASH_INSTALL_CMAKE_CONFIG "Install CMake configuration scripts for find_package(CONFIG)" ON)
option(ETHASH_FUZZING "Build with fuzzer instrumentation" OFF)
if(ETHASH_FUZZING)
set(CMAKE_EXE_LINKER_FLAGS "-fsanitize=fuzzer-no-link ${CMAKE_EXE_LINKER_FLAGS}")
add_compile_options(-fno-omit-frame-pointer -fsanitize=fuzzer,undefined,integer -fno-sanitize-recover=all)
endif()
add_subdirectory(lib/ethash)
option(ETHASH_BUILD_TESTS "Build unit tests" ON)
if(ETHASH_BUILD_TESTS)
add_subdirectory(test)
endif()