Skip to content

Commit

Permalink
chore: bump simd deps, use vectorscan on all platforms, require sse4.2
Browse files Browse the repository at this point in the history
  • Loading branch information
variar committed Nov 17, 2024
1 parent 2a27a67 commit bb8b605
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 55 deletions.
74 changes: 26 additions & 48 deletions 3rdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ include(CPM)

set(_TMP_CPM_USE_LOCAL_PACKAGES ${CPM_USE_LOCAL_PACKAGES})

cpmaddpackage("gh:simdutf/[email protected]")
cpmaddpackage("gh:foonathan/[email protected]")
cpmaddpackage("gh:simdutf/[email protected]")
cpmaddpackage("gh:foonathan/[email protected]")
cpmaddpackage("gh:RoaringBitmap/[email protected]")

if(APPLE)
cpmaddpackage(
Expand All @@ -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
Expand All @@ -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(
Expand Down
6 changes: 4 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
7 changes: 2 additions & 5 deletions src/regex/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit bb8b605

Please sign in to comment.