2017-11-06 00:11:35 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
|
|
|
|
|
|
if ("${CMAKE_BUILD_TYPE}" STREQUAL "")
|
|
|
|
set(CMAKE_BUILD_TYPE Release)
|
|
|
|
endif()
|
|
|
|
|
2018-03-26 04:47:01 +00:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Release")
|
|
|
|
add_definitions(/DNDEBUG)
|
|
|
|
endif()
|
|
|
|
|
2019-04-15 18:20:50 +00:00
|
|
|
include(CheckSymbolExists)
|
|
|
|
|
2017-11-06 00:11:35 +00:00
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES GNU)
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-strict-aliasing")
|
2018-04-16 08:40:37 +00:00
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast")
|
2017-11-06 00:11:35 +00:00
|
|
|
|
2019-07-01 18:48:51 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-class-memaccess")
|
2018-04-16 08:40:37 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -s")
|
2017-11-06 00:11:35 +00:00
|
|
|
|
2017-11-26 19:23:23 +00:00
|
|
|
if (XMRIG_ARMv8)
|
2019-02-03 19:23:05 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS} -flax-vector-conversions")
|
2017-11-26 19:23:23 +00:00
|
|
|
elseif (XMRIG_ARMv7)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -flax-vector-conversions")
|
2017-11-06 00:11:35 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
2019-04-15 18:20:50 +00:00
|
|
|
|
|
|
|
add_definitions(/DHAVE_ROTR)
|
2017-11-06 00:11:35 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (WIN32)
|
2019-08-02 03:54:00 +00:00
|
|
|
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
|
|
|
else()
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static -Wl,--large-address-aware")
|
|
|
|
endif()
|
2017-11-06 00:11:35 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
add_definitions(/D_GNU_SOURCE)
|
|
|
|
|
|
|
|
if (${CMAKE_VERSION} VERSION_LESS "3.1.0")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
#set(CMAKE_C_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -gdwarf-2")
|
|
|
|
|
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES MSVC)
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL")
|
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Ox /Ot /Oi /MT /GL")
|
|
|
|
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
|
|
|
|
add_definitions(/D_CRT_NONSTDC_NO_WARNINGS)
|
|
|
|
add_definitions(/DNOMINMAX)
|
2019-04-15 18:20:50 +00:00
|
|
|
add_definitions(/DHAVE_ROTR)
|
2017-11-06 00:11:35 +00:00
|
|
|
|
|
|
|
elseif (CMAKE_CXX_COMPILER_ID MATCHES Clang)
|
|
|
|
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall")
|
|
|
|
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
|
|
|
|
2019-07-18 22:03:14 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fexceptions -fno-rtti -Wno-missing-braces")
|
2017-11-06 00:11:35 +00:00
|
|
|
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Ofast -funroll-loops -fmerge-all-constants")
|
|
|
|
|
2017-11-26 19:23:23 +00:00
|
|
|
if (XMRIG_ARMv8)
|
2019-02-03 19:23:05 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARM8_CXX_FLAGS}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARM8_CXX_FLAGS}")
|
2017-11-26 19:23:23 +00:00
|
|
|
elseif (XMRIG_ARMv7)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=${CMAKE_SYSTEM_PROCESSOR}")
|
2017-11-06 00:11:35 +00:00
|
|
|
else()
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -maes")
|
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -maes")
|
2019-04-15 18:20:50 +00:00
|
|
|
|
|
|
|
check_symbol_exists("_rotr" "x86intrin.h" HAVE_ROTR)
|
2019-04-15 19:00:27 +00:00
|
|
|
if (HAVE_ROTR)
|
|
|
|
add_definitions(/DHAVE_ROTR)
|
|
|
|
endif()
|
2017-11-06 00:11:35 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|
2019-06-03 11:40:12 +00:00
|
|
|
|
|
|
|
if (NOT WIN32)
|
|
|
|
check_symbol_exists("__builtin___clear_cache" "stdlib.h" HAVE_BUILTIN_CLEAR_CACHE)
|
|
|
|
if (HAVE_BUILTIN_CLEAR_CACHE)
|
|
|
|
add_definitions(/DHAVE_BUILTIN_CLEAR_CACHE)
|
|
|
|
endif()
|
|
|
|
endif()
|