add native build option

pull/786/head
Rick V 5 years ago
parent 60cf1be757
commit 6ade591a6e

@ -13,6 +13,7 @@ project(${PROJECT_NAME} C CXX)
option(USE_AVX2 "enable avx2 code" )
option(USE_NETNS "enable networking namespace support. Linux only" )
option(AMD_RYZEN_HACK "hack for AMD Ryzen FPU bug (support FMA3 and FMA4 in FPU, but does not show in CPUID)" )
option(NATIVE_BUILD "optimise for host system and FPU, may not be portable" )
if (NOT MSVC)
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads")
endif()
@ -157,6 +158,11 @@ if(AMD_RYZEN_HACK AND USE_AVX2)
message(WARNING "This option may be removed in a future release. Contact your computer manufacturer for updated ROMs or microcode patches.")
endif(AMD_RYZEN_HACK AND USE_AVX2)
if(NATIVE_BUILD)
message(WARNING "May fail at runtime if the floating-point unit on the target system does not implement required features, some platforms will check this for you")
set(CRYPTO_FLAGS -march=native -mfpmath=sse -mtune=native)
endif()
add_compile_options(${OPTIMIZE_FLAGS} ${CRYPTO_FLAGS})
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)

Loading…
Cancel
Save