From bb8b60537f1e4a218daccf179710a6d079df6c3f Mon Sep 17 00:00:00 2001 From: Anton Filimonov Date: Sun, 17 Nov 2024 23:12:57 +0100 Subject: [PATCH] chore: bump simd deps, use vectorscan on all platforms, require sse4.2 --- 3rdparty/CMakeLists.txt | 74 ++++++++++++++-------------------------- CMakeLists.txt | 6 ++-- src/regex/CMakeLists.txt | 7 ++-- 3 files changed, 32 insertions(+), 55 deletions(-) diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt index 5bf50e4f..2be86089 100644 --- a/3rdparty/CMakeLists.txt +++ b/3rdparty/CMakeLists.txt @@ -4,8 +4,9 @@ include(CPM) set(_TMP_CPM_USE_LOCAL_PACKAGES ${CPM_USE_LOCAL_PACKAGES}) -cpmaddpackage("gh:simdutf/simdutf@3.2.13") -cpmaddpackage("gh:foonathan/type_safe@0.2.3") +cpmaddpackage("gh:simdutf/simdutf@5.6.2") +cpmaddpackage("gh:foonathan/type_safe@0.2.4") +cpmaddpackage("gh:RoaringBitmap/CRoaring@4.2.1") if(APPLE) cpmaddpackage( @@ -23,19 +24,6 @@ if(APPLE) endif() endif() -cpmaddpackage( - NAME - CRoaring - GITHUB_REPOSITORY - variar/CRoaring - GIT_TAG - 80a8dcf4f683f00cc9be180f8b18de13491b7e27 - EXCLUDE_FROM_ALL - YES - OPTIONS - "ENABLE_ROARING_TESTS OFF" -) - cpmaddpackage( NAME maddy @@ -47,48 +35,38 @@ cpmaddpackage( YES ) -if(KLOGG_USE_HYPERSCAN) - cpmaddpackage( - NAME - hyperscan - GITHUB_REPOSITORY - variar/hyperscan - GIT_TAG - 0931a40e0cf1d7f92189bc546c3491ed5c113f8b - EXCLUDE_FROM_ALL - YES - ) - if(hyperscan_ADDED) - message("Adding alias for hyperscan") - add_library(hyperscan_wrapper INTERFACE) - target_link_libraries(hyperscan_wrapper INTERFACE hs) - target_include_directories(hyperscan_wrapper INTERFACE ${hyperscan_SOURCE_DIR}/src) - else() - add_library(hyperscan_wrapper INTERFACE) - target_link_libraries(hyperscan_wrapper INTERFACE ${HYPERSCAN_LIBRARY}) - target_include_directories(hyperscan_wrapper INTERFACE ${HYPERSCAN_INCLUDE_DIR}) - endif() -elseif(KLOGG_USE_VECTORSCAN) +if(KLOGG_USE_VECTORSCAN) cpmaddpackage( NAME vectorscan GITHUB_REPOSITORY VectorCamp/vectorscan GIT_TAG - b4bba94b1a250603b0b198e0394946e32f6c3f30 + d29730e1cb9daaa66bda63426cdce83505d2c809 EXCLUDE_FROM_ALL YES + OPTIONS + "BUILD_STATIC_LIBS ON" + "BUILD_UNIT OFF" + "BUILD_TOOLS OFF" + "BUILD_EXAMPLES OFF" + "BUILD_BENCHMARKS OFF" + "BUILD_DOC OFF" + "BUILD_CHIMERA OFF" + "BUIlD_AVX2 OFF" + "BUIlD_AVX512 OFF" + "BUIlD_AVX512VBMI OFF" + "FAT_RUNTIME OFF" ) - if(vectorscan_ADDED) - message("Adding alias for vectorscan") - add_library(vectorscan_wrapper INTERFACE) - target_link_libraries(vectorscan_wrapper INTERFACE hs) - target_include_directories(vectorscan_wrapper INTERFACE ${vectorscan_SOURCE_DIR}/src) - else() - add_library(vectorscan_wrapper INTERFACE) - target_link_libraries(vectorscan_wrapper INTERFACE ${VECTORSCAN_LIBRARY}) - target_include_directories(vectorscan_wrapper INTERFACE ${VECTORSCAN_INCLUDE_DIR}) - endif() + + message("Adding alias for vectorscan") + add_library(klogg_vectorscan INTERFACE) + target_link_libraries(klogg_vectorscan INTERFACE hs) + target_include_directories(klogg_vectorscan INTERFACE + ${vectorscan_SOURCE_DIR}/src + ${vectorscan_BINARY_DIR} + ) + endif() cpmaddpackage( diff --git a/CMakeLists.txt b/CMakeLists.txt index 7ecff5a4..663ce6b2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -116,11 +116,13 @@ if(MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") endif(CMAKE_C_FLAGS MATCHES "/W[0-4]") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D __SSE4_1__=1") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /D __SSE4_1__=1 /D __SSE4_2__=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /D __SSE4_1__=1 /D __SSE4_2__=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj ") else() ucm_add_flags(CXX "-fno-sized-deallocation -fno-omit-frame-pointer") - ucm_add_flags(C CXX "-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -mpopcnt") + ucm_add_flags(C CXX "-mmmx -msse -msse2 -msse3 -mssse3 -msse4.1 -msse4.2 -mpopcnt") if(KLOGG_GENERIC_CPU) ucm_add_flags(C CXX "-march=x86-64 -mtune=generic") else() diff --git a/src/regex/CMakeLists.txt b/src/regex/CMakeLists.txt index aa94963d..2e80d83b 100644 --- a/src/regex/CMakeLists.txt +++ b/src/regex/CMakeLists.txt @@ -21,11 +21,8 @@ target_link_libraries( exprtk ) -if(KLOGG_USE_HYPERSCAN) - target_link_libraries(klogg_regex PUBLIC hyperscan_wrapper) - target_compile_definitions(klogg_regex PUBLIC KLOGG_HAS_HS) -elseif(KLOGG_USE_VECTORSCAN) - target_link_libraries(klogg_regex PUBLIC vectorscan_wrapper) +if(KLOGG_USE_VECTORSCAN) + target_link_libraries(klogg_regex PUBLIC klogg_vectorscan) target_compile_definitions(klogg_regex PUBLIC KLOGG_HAS_HS) endif()