mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-05 19:26:17 +00:00
d1bd01e189 Merge bitcoin-core/minisketch#98: misc: drop trailing whitespace fe2c88a4fd misc: drop trailing whitespace f74b7e2bc2 Merge sipa/minisketch#75: build: Introduce CMake-based build system 850cc868d5 ci: Add GHA workflow with native Windows job 40d56708c8 doc: Add "Building with CMake" section to `README.md` a0c86c79a7 build: Add CMake-based build system git-subtree-dir: src/minisketch git-subtree-split: d1bd01e189e745cd1828707e0a7004b6a6909650
44 lines
967 B
CMake
44 lines
967 B
CMake
include_guard(GLOBAL)
|
|
|
|
include(CheckCXXSourceCompiles)
|
|
include(CMakePushCheckState)
|
|
cmake_push_check_state(RESET)
|
|
|
|
# Check for clmul instructions support.
|
|
if(NOT CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
|
|
set(CMAKE_REQUIRED_FLAGS "-mpclmul")
|
|
endif()
|
|
check_cxx_source_compiles("
|
|
#include <immintrin.h>
|
|
#include <stdint.h>
|
|
|
|
int main()
|
|
{
|
|
__m128i a = _mm_cvtsi64_si128((uint64_t)7);
|
|
__m128i b = _mm_clmulepi64_si128(a, a, 37);
|
|
__m128i c = _mm_srli_epi64(b, 41);
|
|
__m128i d = _mm_xor_si128(b, c);
|
|
uint64_t e = _mm_cvtsi128_si64(d);
|
|
return e == 0;
|
|
}
|
|
" HAVE_CLMUL
|
|
)
|
|
if(HAVE_CLMUL)
|
|
set(CLMUL_CXXFLAGS ${CMAKE_REQUIRED_FLAGS})
|
|
endif()
|
|
|
|
if(CMAKE_CXX_STANDARD LESS 20)
|
|
# Check for working clz builtins.
|
|
check_cxx_source_compiles("
|
|
int main()
|
|
{
|
|
unsigned a = __builtin_clz(1);
|
|
unsigned long b = __builtin_clzl(1);
|
|
unsigned long long c = __builtin_clzll(1);
|
|
}
|
|
" HAVE_CLZ
|
|
)
|
|
endif()
|
|
|
|
cmake_pop_check_state()
|