Merge pull request #121 from crypto-ape/master_mingw
CMake cleanup & MinGW support
This commit is contained in:
commit
966e9ea64e
9 changed files with 1282 additions and 1296 deletions
147
CMakeLists.txt
147
CMakeLists.txt
|
|
@ -1,8 +1,8 @@
|
|||
#
|
||||
# Defines fc library target.
|
||||
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.2 FATAL_ERROR )
|
||||
PROJECT( fc )
|
||||
CMAKE_MINIMUM_REQUIRED( VERSION 3.1 )
|
||||
|
||||
set( CMAKE_CXX_STANDARD 14 )
|
||||
SET( CMAKE_CXX_STANDARD_REQUIRED ON )
|
||||
|
|
@ -25,7 +25,8 @@ INCLUDE( VersionMacros )
|
|||
INCLUDE( SetupTargetMacros )
|
||||
INCLUDE(GetGitRevisionDescription)
|
||||
INCLUDE(CheckLibraryExists)
|
||||
INCLUDE(CheckLibcxxAtomic)
|
||||
|
||||
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/Legacy)
|
||||
|
||||
get_git_head_revision(GIT_REFSPEC FC_GIT_REVISION_SHA)
|
||||
get_git_unix_timestamp(FC_GIT_REVISION_UNIX_TIMESTAMP)
|
||||
|
|
@ -41,15 +42,13 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|||
set(platformBitness 64)
|
||||
endif()
|
||||
|
||||
SET (ORIGINAL_LIB_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
|
||||
SET(BOOST_COMPONENTS)
|
||||
LIST(APPEND BOOST_COMPONENTS thread date_time filesystem system program_options chrono unit_test_framework context iostreams regex)
|
||||
LIST(APPEND BOOST_COMPONENTS coroutine thread date_time filesystem system program_options chrono unit_test_framework context iostreams regex)
|
||||
# boost::endian is also required, but FindBoost can't handle header-only libs
|
||||
SET( Boost_USE_STATIC_LIBS ON CACHE STRING "ON or OFF" )
|
||||
|
||||
# Configure secp256k1-zkp
|
||||
if ( MSVC )
|
||||
if ( WIN32 )
|
||||
# autoconf won't work here, hard code the defines
|
||||
set( SECP256K1_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp" )
|
||||
|
||||
|
|
@ -65,18 +64,9 @@ if ( MSVC )
|
|||
USE_SCALAR_8X32
|
||||
USE_SCALAR_INV_BUILTIN )
|
||||
set_target_properties( secp256k1 PROPERTIES COMPILE_DEFINITIONS "${SECP256K1_BUILD_DEFINES}" LINKER_LANGUAGE C )
|
||||
else ( MSVC )
|
||||
else ( WIN32 )
|
||||
include(ExternalProject)
|
||||
if ( MINGW )
|
||||
ExternalProject_Add( project_secp256k1
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
|
||||
CONFIGURE_COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp/configure --prefix=${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp --with-bignum=no --host=x86_64-w64-mingw32
|
||||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND true
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp/src/project_secp256k1-build/.libs/libsecp256k1.a
|
||||
)
|
||||
else ( MINGW )
|
||||
|
||||
ExternalProject_Add( project_secp256k1
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
|
||||
|
|
@ -85,7 +75,7 @@ else ( MSVC )
|
|||
INSTALL_COMMAND true
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/vendor/secp256k1-zkp/src/project_secp256k1-build/.libs/libsecp256k1.a
|
||||
)
|
||||
endif ( MINGW )
|
||||
|
||||
ExternalProject_Add_Step(project_secp256k1 autogen
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp/autogen.sh
|
||||
|
|
@ -99,25 +89,13 @@ else ( MSVC )
|
|||
set_property(TARGET secp256k1 PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/secp256k1-zkp/include)
|
||||
add_dependencies(secp256k1 project_secp256k1)
|
||||
install( FILES ${binary_dir}/.libs/libsecp256k1${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION lib/cryptonomex )
|
||||
endif ( MSVC )
|
||||
endif ( WIN32 )
|
||||
# End configure secp256k1-zkp
|
||||
|
||||
# Configure editline
|
||||
if ( MSVC )
|
||||
# # autoconf won't work here, hard code the defines
|
||||
# set( EDITLINE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/vendor/editline" )
|
||||
#
|
||||
# file( GLOB EDITLINE_SOURCES "${EDITLINE_DIR}/src/editline.c" )
|
||||
# add_library( editline ${EDITLINE_SOURCES} )
|
||||
#
|
||||
# target_include_directories( editline PRIVATE "${EDITLINE_DIR}" PUBLIC "${EDITLINE_DIR}/include" )
|
||||
#
|
||||
# set_target_properties( editline PROPERTIES COMPILE_DEFINITIONS LINKER_LANGUAGE C )
|
||||
else ( MSVC )
|
||||
if ( NOT WIN32 )
|
||||
include(ExternalProject)
|
||||
if ( MINGW )
|
||||
# Editline is not avalible in MINGW
|
||||
else ( MINGW )
|
||||
|
||||
ExternalProject_Add( project_editline
|
||||
PREFIX ${CMAKE_CURRENT_BINARY_DIR}/vendor/editline
|
||||
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/vendor/editline
|
||||
|
|
@ -125,7 +103,8 @@ else ( MSVC )
|
|||
BUILD_COMMAND make
|
||||
INSTALL_COMMAND true
|
||||
BUILD_BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/vendor/editline/src/project_editline-build/src/.libs/libeditline.a
|
||||
)
|
||||
)
|
||||
|
||||
ExternalProject_Add_Step(project_editline autogen
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/vendor/editline
|
||||
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/vendor/editline/autogen.sh
|
||||
|
|
@ -137,8 +116,7 @@ else ( MSVC )
|
|||
set_property(TARGET editline PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${CMAKE_CURRENT_SOURCE_DIR}/vendor/editline/include)
|
||||
add_dependencies(editline project_editline)
|
||||
install( FILES ${binary_dir}/src/.libs/libeditline${CMAKE_STATIC_LIBRARY_SUFFIX} DESTINATION lib/cryptonomex )
|
||||
endif ( MINGW )
|
||||
endif ( MSVC )
|
||||
endif ( NOT WIN32 )
|
||||
# End configure editline
|
||||
|
||||
IF( WIN32 )
|
||||
|
|
@ -147,42 +125,30 @@ IF( WIN32 )
|
|||
set( RPCRT4 rpcrt4 )
|
||||
|
||||
#boost
|
||||
SET(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
# set(Boost_USE_DEBUG_PYTHON ON)
|
||||
if ($ENV{BOOST_ROOT})
|
||||
SET(BOOST_ROOT $ENV{BOOST_ROOT})
|
||||
endif()
|
||||
|
||||
set(Boost_USE_DEBUG_PYTHON ON)
|
||||
set(Boost_USE_MULTITHREADED ON)
|
||||
set(BOOST_ALL_DYN_LINK OFF) # force dynamic linking for all libraries
|
||||
|
||||
FIND_PACKAGE(Boost 1.53 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
# For Boost 1.53 on windows, coroutine was not in BOOST_LIBRARYDIR and do not need it to build, but if boost versin >= 1.54, find coroutine otherwise will cause link errors
|
||||
IF(NOT "${Boost_VERSION}" MATCHES "1.53(.*)")
|
||||
SET(BOOST_LIBRARIES_TEMP ${Boost_LIBRARIES})
|
||||
FIND_PACKAGE(Boost 1.54 REQUIRED COMPONENTS coroutine)
|
||||
LIST(APPEND BOOST_COMPONENTS coroutine)
|
||||
SET(Boost_LIBRARIES ${BOOST_LIBRARIES_TEMP} ${Boost_LIBRARIES})
|
||||
ENDIF()
|
||||
LIST(APPEND PLATFORM_SPECIFIC_LIBS ws2_32 crypt32 mswsock userenv)
|
||||
|
||||
LIST(APPEND PLATFORM_SPECIFIC_LIBS wsock32.lib ws2_32.lib userenv.lib)
|
||||
# iphlpapi.lib
|
||||
|
||||
ELSE(WIN32)
|
||||
MESSAGE(STATUS "Configuring fc to build on Unix/Apple")
|
||||
|
||||
LIST(APPEND BOOST_COMPONENTS coroutine)
|
||||
|
||||
FIND_PACKAGE(Boost 1.53 REQUIRED COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so")
|
||||
|
||||
IF(NOT APPLE)
|
||||
# Linux or other unix
|
||||
SET(rt_library rt )
|
||||
SET(pthread_library pthread)
|
||||
ENDIF(NOT APPLE)
|
||||
ENDIF(WIN32)
|
||||
|
||||
FIND_PACKAGE(Boost CONFIG COMPONENTS ${BOOST_COMPONENTS})
|
||||
|
||||
IF(NOT WIN32)
|
||||
MESSAGE(STATUS "Configuring fc to build on Unix/Apple")
|
||||
|
||||
IF(NOT "$ENV{OPENSSL_ROOT_DIR}" STREQUAL "")
|
||||
if(NOT APPLE)
|
||||
SET(rt_library rt)
|
||||
endif(NOT APPLE)
|
||||
ENDIF(NOT WIN32)
|
||||
|
||||
IF($ENV{OPENSSL_ROOT_DIR})
|
||||
set(OPENSSL_ROOT_DIR $ENV{OPENSSL_ROOT_DIR} )
|
||||
set(OPENSSL_INCLUDE_DIR ${OPENSSL_ROOT_DIR}/include)
|
||||
message(STATUS "Setting up OpenSSL root and include vars to ${OPENSSL_ROOT_DIR}, ${OPENSSL_INCLUDE_DIR}")
|
||||
|
|
@ -194,8 +160,6 @@ ENDIF( LIBCXX_HAVE_CXX_ATOMICS_WITH_LIB )
|
|||
|
||||
find_package(OpenSSL REQUIRED)
|
||||
|
||||
set( CMAKE_FIND_LIBRARY_SUFFIXES ${ORIGINAL_LIB_SUFFIXES} )
|
||||
|
||||
option( UNITY_BUILD OFF )
|
||||
|
||||
set( fc_sources
|
||||
|
|
@ -284,12 +248,11 @@ setup_library( fc SOURCES ${sources} LIBRARY_TYPE STATIC )
|
|||
install( DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/" DESTINATION include )
|
||||
|
||||
# begin editline stuff
|
||||
if(NOT (MSVC OR MINGW))
|
||||
target_compile_definitions (fc PRIVATE HAVE_EDITLINE)
|
||||
set(editline_libraries editline)
|
||||
endif(NOT (MSVC OR MINGW))
|
||||
if(WIN32)
|
||||
target_compile_definitions( fc PRIVATE _CRT_NONSTDC_NO_DEPRECATE )
|
||||
elseif(WIN32)
|
||||
target_compile_definitions (fc PRIVATE HAVE_EDITLINE)
|
||||
set(editline_libraries editline)
|
||||
endif(WIN32)
|
||||
# end editline stuff
|
||||
|
||||
|
|
@ -341,6 +304,7 @@ ENDIF(APPLE)
|
|||
|
||||
if( ZLIB_FOUND )
|
||||
MESSAGE( STATUS "zlib found" )
|
||||
target_include_directories(fc PUBLIC ${ZLIB_INCLUDE_DIRS})
|
||||
add_definitions( -DHAS_ZLIB )
|
||||
else()
|
||||
MESSAGE( STATUS "zlib not found" )
|
||||
|
|
@ -384,9 +348,11 @@ target_link_libraries( fc PUBLIC ${LINK_USR_LOCAL_LIB} ${OPENSSL_LIBRARIES} ${Z
|
|||
${PLATFORM_SPECIFIC_LIBS} ${RPCRT4} ${CMAKE_DL_LIBS} ${rt_library}
|
||||
${editline_libraries} secp256k1 ${CMAKE_REQUIRED_LIBRARIES} )
|
||||
|
||||
if(MSVC)
|
||||
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
|
||||
endif(MSVC)
|
||||
if(WIN32 AND MSVC)
|
||||
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES COMPILE_FLAGS "/bigobj" )
|
||||
elseif(WIN32 AND MINGW)
|
||||
set_source_files_properties( src/network/http/websocket.cpp PROPERTIES LINK_FLAGS "-mbig-obj" )
|
||||
endif()
|
||||
|
||||
|
||||
IF(NOT Boost_UNIT_TEST_FRAMEWORK_LIBRARY MATCHES "\\.(a|lib)$")
|
||||
|
|
@ -401,18 +367,10 @@ include_directories( vendor/websocketpp )
|
|||
|
||||
add_subdirectory(tests)
|
||||
|
||||
if(WIN32)
|
||||
if(MSVC)
|
||||
# add addtional import library on windows platform
|
||||
target_link_libraries( fc PUBLIC crypt32.lib)
|
||||
|
||||
# now generate a list of the DLLs we're using to use during the install process
|
||||
include (ParseLibraryList)
|
||||
PARSE_LIBRARY_LIST(${Boost_LIBRARIES}
|
||||
FOUND parseOk
|
||||
DEBUG Boost_LIBRARIES_DEBUG
|
||||
OPT Boost_LIBRARIES_RELEASE
|
||||
GENERAL Boost_LIBRARIES_GENERAL)
|
||||
|
||||
#Variable will hold list of .pdb files generated for libraries the 'fc' module is linked to
|
||||
set(INTERFACE_LINK_PDB_RELEASE)
|
||||
|
||||
|
|
@ -481,31 +439,8 @@ if(WIN32)
|
|||
set_property(TARGET fc PROPERTY SHARED_LIBRARIES_DEBUG ${SHARED_LIBRARIES_DEBUG})
|
||||
set_property(TARGET fc PROPERTY SHARED_LIBRARIES_RELEASE ${SHARED_LIBRARIES_RELEASE})
|
||||
|
||||
endif(WIN32)
|
||||
endif(MSVC)
|
||||
|
||||
SET(OPENSSL_CONF_TARGET )
|
||||
IF(DEFINED CMAKE_RUNTIME_OUTPUT_DIRECTORY)
|
||||
SET (OPENSSL_CONF_TARGET ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||
ELSE()
|
||||
SET (OPENSSL_CONF_TARGET ${CMAKE_CURRENT_BINARY_DIR})
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
IF("${OPENSSL_ROOT_DIR}" STREQUAL "")
|
||||
get_filename_component(OPENSSL_ROOT_DIR "${OPENSSL_INCLUDE_DIR}/.." REALPATH)
|
||||
ENDIF()
|
||||
IF("${OPENSSL_CONF_SOURCE}" STREQUAL "")
|
||||
SET(OPENSSL_CONF_SOURCE "${OPENSSL_ROOT_DIR}/ssl/openssl.cnf")
|
||||
IF(MINGW)
|
||||
SET(OPENSSL_CONF_SOURCE "${OPENSSL_ROOT_DIR}/openssl.cnf")
|
||||
ENDIF(MINGW)
|
||||
ENDIF()
|
||||
SET(POST_BUILD_STEP_COMMANDS ${POST_BUILD_STEP_COMMANDS}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENSSL_CONF_SOURCE}" "${OPENSSL_CONF_TARGET}/openssl.cnf")
|
||||
ENDIF(WIN32)
|
||||
|
||||
ADD_CUSTOM_COMMAND(TARGET fc POST_BUILD ${POST_BUILD_STEP_COMMANDS}
|
||||
COMMENT "Copying OpenSSL/ssl/openssl.cnf into target directory."
|
||||
)
|
||||
INCLUDE(CheckLibcxxAtomic)
|
||||
|
||||
MESSAGE(STATUS "Finished fc module configuration...")
|
||||
|
|
|
|||
18
CMakeModules/Boost/BoostConfig.cmake
Normal file
18
CMakeModules/Boost/BoostConfig.cmake
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# This overrides `find_package(Boost ... CONFIG ... )` calls
|
||||
# - calls the CMake's built-in `FindBoost.cmake` and adds `pthread` library dependency
|
||||
|
||||
MESSAGE(STATUS "Using custom FindBoost config")
|
||||
|
||||
find_package(Boost 1.58 REQUIRED COMPONENTS ${Boost_FIND_COMPONENTS})
|
||||
|
||||
# Inject `pthread` dependency to Boost if needed
|
||||
if (UNIX AND NOT CYGWIN)
|
||||
list(FIND Boost_FIND_COMPONENTS thread _using_boost_thread)
|
||||
if (_using_boost_thread GREATER -1)
|
||||
find_library(BOOST_THREAD_LIBRARY NAMES pthread DOC "The threading library used by boost-thread")
|
||||
if (BOOST_THREAD_LIBRARY)
|
||||
MESSAGE(STATUS "Adding Boost thread lib dependency: ${BOOST_THREAD_LIBRARY}")
|
||||
list(APPEND Boost_LIBRARIES ${BOOST_THREAD_LIBRARY})
|
||||
endif ()
|
||||
endif ()
|
||||
endif ()
|
||||
|
|
@ -18,11 +18,15 @@ function(check_cxx_atomics varname)
|
|||
if (CMAKE_C_FLAGS MATCHES -fsanitize-coverage OR CMAKE_CXX_FLAGS MATCHES -fsanitize-coverage)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -fno-sanitize-coverage=edge,trace-cmp,indirect-calls,8bit-counters")
|
||||
endif()
|
||||
|
||||
set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${Boost_INCLUDE_DIRS})
|
||||
|
||||
check_cxx_source_compiles("
|
||||
#include <cstdint>
|
||||
#include <boost/lockfree/queue.hpp>
|
||||
|
||||
boost::lockfree::queue<uint32_t*> q;
|
||||
boost::lockfree::queue<uint32_t*,boost::lockfree::capacity<5>> q;
|
||||
int main(int, char**) {
|
||||
uint32_t* a;
|
||||
uint32_t* b;
|
||||
|
|
@ -31,6 +35,7 @@ int main(int, char**) {
|
|||
}
|
||||
" ${varname})
|
||||
set(CMAKE_REQUIRED_FLAGS ${OLD_CMAKE_REQUIRED_FLAGS})
|
||||
set(CMAKE_REQUIRED_INCLUDES ${OLD_CMAKE_REQUIRED_INCLUDES})
|
||||
endfunction(check_cxx_atomics)
|
||||
|
||||
# Perform the check for 64bit atomics without libatomic.
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
27
CMakeModules/Legacy/CMakeLists.txt
Normal file
27
CMakeModules/Legacy/CMakeLists.txt
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
# If you are running recent enough version of CMake you shall consider updating/removing these lines ...
|
||||
MESSAGE(STATUS "Configuring build scripts for older CMake versions")
|
||||
|
||||
# This patches your current boost searching routine so that `pthread` library is included if needed
|
||||
# - this is here to fix some older CMake + Boost configurations
|
||||
set(Boost_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../Boost" PARENT_SCOPE)
|
||||
|
||||
if (APPLE OR USE_LEGACY_FIND_BOOST)
|
||||
MESSAGE(STATUS "Configuring for custom FindBoost.cmake")
|
||||
# Custom FindBoost.cmake
|
||||
# - overrides `find_package( Boost )` functionality
|
||||
# - it's a modified https://github.com/Kitware/CMake/blob/363825cd55595b7de62fcf610836f6156a9f1a31/Modules/FindBoost.cmake
|
||||
# - adds additional Boost search path
|
||||
# - adds pthread as an dependency if needed
|
||||
######
|
||||
# This is using an old version of FindBoost.cmake irregardless of your CMake version
|
||||
# - this will be removed in future release
|
||||
# - improves Boost library search in some Apple OS configrations
|
||||
# - this can be fixed with properly setting BOOST_LIBRARYDIR
|
||||
#####
|
||||
|
||||
MESSAGE(DEPRECATION "Custom FindBoost.cmake will be deprecated in some future release. If you are using some of the affected configurations try setting the BOOST_LIBRARYDIR variable.")
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/Boost")
|
||||
|
||||
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} PARENT_SCOPE)
|
||||
endif ()
|
||||
|
|
@ -155,7 +155,7 @@ namespace fc
|
|||
|
||||
#ifdef __APPLE__
|
||||
void to_variant( size_t s, variant& v, uint32_t max_depth = 1 );
|
||||
#elif !defined(_MSC_VER)
|
||||
#elif !defined(_WIN32)
|
||||
void to_variant( long long int s, variant& v, uint32_t max_depth = 1 );
|
||||
void to_variant( unsigned long long int s, variant& v, uint32_t max_depth = 1 );
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -37,9 +37,10 @@
|
|||
#include <boost/endian/buffers.hpp>
|
||||
|
||||
#if defined(__SSE4_2__) && defined(__x86_64__)
|
||||
#include <nmmintrin.h>
|
||||
#include <nmmintrin.h>
|
||||
#define _mm_crc32_u64_impl _mm_crc32_u64
|
||||
#else
|
||||
uint64_t _mm_crc32_u64(uint64_t a, uint64_t b );
|
||||
uint64_t _mm_crc32_u64_impl(uint64_t a, uint64_t b );
|
||||
#endif
|
||||
|
||||
namespace fc {
|
||||
|
|
@ -556,9 +557,9 @@ static void CityHashCrc256Long(const char *s, size_t len,
|
|||
g += e; \
|
||||
e += z; \
|
||||
g += x; \
|
||||
z = _mm_crc32_u64(z, b + g); \
|
||||
y = _mm_crc32_u64(y, e + h); \
|
||||
x = _mm_crc32_u64(x, f + a); \
|
||||
z = _mm_crc32_u64_impl(z, b + g); \
|
||||
y = _mm_crc32_u64_impl(y, e + h); \
|
||||
x = _mm_crc32_u64_impl(x, f + a); \
|
||||
e = Rotate(e, r); \
|
||||
c += e; \
|
||||
s += 40
|
||||
|
|
|
|||
|
|
@ -604,7 +604,7 @@ static const uint32_t crc_c[256] = {
|
|||
#if !defined __SSE4_2__ || (defined __SSE4_2__ && !defined __x86_64__)
|
||||
|
||||
|
||||
uint64_t _mm_crc32_u64(uint64_t a, uint64_t b )
|
||||
uint64_t _mm_crc32_u64_impl(uint64_t a, uint64_t b )
|
||||
{
|
||||
// Squelch warning about unusued variable crc_c
|
||||
(void)(crc_c);
|
||||
|
|
@ -619,7 +619,7 @@ int main( int argc, char** argv )
|
|||
{
|
||||
uint64_t f = 0x1234;
|
||||
uint64_t a = 0x5678;
|
||||
uint32_t f1 = _mm_crc32_u64(f, a);
|
||||
uint32_t f1 = _mm_crc32_u64_impl(f, a);
|
||||
uint32_t f4 = crc32cSlicingBy8(f, (unsigned char*)&a, sizeof(a));
|
||||
std::cout<<std::hex<<f1<<"\n"<<f2<<"\n"<<f3<<"\n"<<f4<<"\n";
|
||||
return 0;
|
||||
|
|
|
|||
|
|
@ -684,7 +684,7 @@ void from_variant( const variant& var, uint128_t& vo, uint32_t max_depth )
|
|||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
#elif !defined(_MSC_VER)
|
||||
#elif !defined(_WIN32)
|
||||
void to_variant( long long int s, variant& v, uint32_t max_depth ) { v = variant( int64_t(s) ); }
|
||||
void to_variant( unsigned long long int s, variant& v, uint32_t max_depth ) { v = variant( uint64_t(s)); }
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in a new issue