|
|
|
@ -8,7 +8,7 @@ option(USE_LIBABYSS "enable libabyss" )
|
|
|
|
|
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(STATIC_LINK "link statically against compiler runtime, standard library and pthreads")
|
|
|
|
|
option(STATIC_LINK_RUNTIME "link statically against compiler runtime, standard library and pthreads")
|
|
|
|
|
option(NON_PC_TARGET "non-pc target build: iphone, andriod, embedded non-i386 SBC, etc" )
|
|
|
|
|
option(SHADOW "use shadow testing framework. linux only" )
|
|
|
|
|
option(ASAN "use address sanitiser, if your system has it" )
|
|
|
|
@ -32,15 +32,17 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
|
|
|
|
|
message( FATAL_ERROR "shadow-framework is Linux only" )
|
|
|
|
|
endif(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Linux" AND SHADOW)
|
|
|
|
|
|
|
|
|
|
if (STATIC_LINK AND SHADOW)
|
|
|
|
|
# might be redundant. Waiting on new 2U blade to spin up new
|
|
|
|
|
# lunix box -rick
|
|
|
|
|
if (STATIC_LINK_RUNTIME AND SHADOW)
|
|
|
|
|
message(FATAL_ERROR "the shadow-framework build cannot be linked statically!")
|
|
|
|
|
endif(STATIC_LINK AND SHADOW)
|
|
|
|
|
endif(STATIC_LINK_RUNTIME AND SHADOW)
|
|
|
|
|
|
|
|
|
|
if (WIN32 AND NOT STATIC_LINK)
|
|
|
|
|
if (WIN32 AND NOT STATIC_LINK_RUNTIME)
|
|
|
|
|
message("must ship compiler runtime libraries with this build: libwinpthread-1.dll, libgcc_s_dw2-1.dll, and libstdc++-6.dll")
|
|
|
|
|
message("for release builds, turn on STATIC_LINK in cmake options")
|
|
|
|
|
#set(STATIC_LINK ON)
|
|
|
|
|
endif(WIN32 AND NOT STATIC_LINK)
|
|
|
|
|
message("for release builds, turn on STATIC_LINK_RUNTIME in cmake options")
|
|
|
|
|
#set(STATIC_LINK_RUNTIME ON)
|
|
|
|
|
endif(WIN32 AND NOT STATIC_LINK_RUNTIME)
|
|
|
|
|
|
|
|
|
|
if (NOT WIN32)
|
|
|
|
|
add_compile_options(-fPIC)
|
|
|
|
@ -117,23 +119,18 @@ if(AMD_RYZEN_HACK AND USE_AVX2)
|
|
|
|
|
set(CRYPTO_FLAGS -march=native -mfpmath=sse -mavx -mavx2 -mfma)
|
|
|
|
|
endif(AMD_RYZEN_HACK AND USE_AVX2)
|
|
|
|
|
|
|
|
|
|
# Probably safe to remove
|
|
|
|
|
#if(WITH_SHARED)
|
|
|
|
|
# set(CRYPTO_FLAGS ${CRYPTO_FLAGS} -fPIC)
|
|
|
|
|
#endif()
|
|
|
|
|
|
|
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
|
|
|
|
|
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
|
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
|
|
|
|
|
if(STATIC_LINK)
|
|
|
|
|
if(STATIC_LINK_RUNTIME)
|
|
|
|
|
add_compile_options(-static)
|
|
|
|
|
if(USING_CLANG)
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
|
|
|
|
|
else()
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libstdc++ -static-libgcc -static -Wl,--whole-archive -lpthread -Wl,--no-whole-archive" )
|
|
|
|
|
endif(USING_CLANG)
|
|
|
|
|
endif(STATIC_LINK)
|
|
|
|
|
endif(STATIC_LINK_RUNTIME)
|
|
|
|
|
|
|
|
|
|
if(USE_NETNS)
|
|
|
|
|
add_definitions(-DNETNS=1)
|
|
|
|
|