-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
72 lines (60 loc) · 2.45 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
62
63
64
65
66
67
68
69
70
71
72
# We need 3.8 for set(CMAKE_CXX_STANDARD 17)
cmake_minimum_required(VERSION 3.8)
project(violetminer LANGUAGES CXX)
option(ENABLE_NVIDIA "Enable Nvidia support" ON)
if (ENABLE_NVIDIA)
enable_language(CUDA)
add_definitions(-DNVIDIA_ENABLED)
else()
message(STATUS "NVIDIA support disabled!")
endif()
# Assert our compiler is good
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
# GCC 7.0 or higher
if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7)
message(FATAL_ERROR "GCC/G++ 7.0 or greater is required to compile. Please check the README.md for detailed compilation instructions.")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
# Clang 6.0 or higher
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 6)
message(FATAL_ERROR "Clang 6.0 or greater is required to compile. Please check the README.md for detailed compilation instructions.")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Visual Studio 15 2017 or higher
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 19.10)
message(FATAL_ERROR "MSVC 19.10 or greater is required to compile (Latest Visual Studio 15 2017 should suffice). Please check the README.md for detailed compilation instructions.")
endif()
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
else()
message(WARNING "You are using an unsupported compiler. The compilation is likely to fail. God speed.")
endif()
# Enable c++17
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Pop binaries in the root build folder, not nested
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}")
# Set optimization on by default
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
set(FORCE_ARCH "" CACHE STRING "Force the architecture to the specific string")
# Add custom modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/src/Argon2/src/Intrinsics")
# Use the TargetArch module to figure out what arch we're compiling for
include(TargetArch)
target_architecture(ARCH)
if("${ARCH}" STREQUAL "x86_64")
add_definitions(-DX86_OPTIMIZATIONS)
elseif("${ARCH}" STREQUAL "armv8")
add_definitions(-DARM_OPTIMIZATIONS)
add_definitions(-DARMV8_OPTIMIZATIONS)
elseif("${ARCH}" STREQUAL "armv7")
add_definitions(-DARM_OPTIMIZATIONS)
add_definitions(-DARMV7_OPTIMIZATIONS)
elseif("${ARCH}" STREQUAL "arm")
add_definitions(-DARM_OPTIMIZATIONS)
else()
add_definitions(-DNO_OPTIMIZATIONS)
endif()
add_subdirectory(src)