Skip to content

Commit 42494f9

Browse files
Merge pull request #106 from contour-terminal/improvement/better-simd-config
Improvement/better simd config
2 parents ba35282 + a7d323e commit 42494f9

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,10 @@ jobs:
115115
dnf install -y curl
116116
PREPARE_ONLY_EMBEDS=OFF SYSDEP_ASSUME_YES=ON ./scripts/install-deps.sh
117117
dnf install -y unicode-ucd
118-
- name: CMake build
119-
run: |
120-
cmake --preset linux-gcc-debug -DLIBUNICODE_UCD_DIR=/usr/share/unicode/ucd
121-
cmake --build --preset linux-gcc-debug -j$(nproc)
118+
- name: configure
119+
run: cmake --preset linux-gcc-debug -DLIBUNICODE_UCD_DIR=/usr/share/unicode/ucd
120+
- name: build
121+
run: cmake --build --preset linux-gcc-debug -j$(nproc)
122122
- name: test
123123
run: |
124124
ctest --preset linux-gcc-debug

CMakeLists.txt

+6-2
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,13 @@ option(LIBUNICODE_TESTING "libunicode: Enables building of unittests for libunic
4646
option(LIBUNICODE_BENCHMARK "libunicode: Enables building of benchmark for libunicode [default: OFF]" OFF)
4747
option(LIBUNICODE_TOOLS "libunicode: Builds CLI tools [default: ${MASTER_PROJECT}]" ${MASTER_PROJECT})
4848
option(LIBUNICODE_BUILD_STATIC "libunicode: provide static library instead of dynamic [default: ${LIBUNICODE_BUILD_STATIC_DEFAULT}]" ${LIBUNICODE_BUILD_STATIC_DEFAULT})
49-
option(LIBUNICODE_USE_INTRINSICS "libunicode: Use SIMD extenstion during text read [default: ON]" ON)
50-
option(LIBUNICODE_USE_STD_SIMD "libunicode: Use std::simd as SIMD extenstion during text read (takes precedence over own intrinsics) [default: ON]" ${LIBUNICODE_USE_INTRINSICS})
5149
option(LIBUNICODE_TABLEGEN_FASTBUILD "libunicode: Use fast table generation (takes more memory in final tables) [default: OFF]" OFF)
5250

51+
if(NOT LIBUNICODE_SIMD_IMPLEMENTATION)
52+
set(LIBUNICODE_SIMD_IMPLEMENTATION "intrinsics" CACHE STRING "libunicode: SIMD implementation to use" FORCE)
53+
set_property(CACHE LIBUNICODE_SIMD_IMPLEMENTATION PROPERTY STRINGS "std" "intrinsics" "none")
54+
endif()
55+
5356
set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Enable testing of the benchmark library." FORCE)
5457
include(ThirdParties)
5558

@@ -107,6 +110,7 @@ message(STATUS "Build benchmark: ${LIBUNICODE_BENCHMARK}")
107110
message(STATUS "Build tools: ${LIBUNICODE_TOOLS}")
108111
message(STATUS "Enable tablegen fast build: ${LIBUNICODE_TABLEGEN_FASTBUILD}")
109112
message(STATUS "Using ccache: ${USING_CCACHE_STRING}")
113+
message(STATUS "SIMD support: ${LIBUNICODE_SIMD_IMPLEMENTATION}")
110114
message(STATUS "Using UCD directory: ${LIBUNICODE_UCD_DIR}")
111115
message(STATUS "Enable clang-tidy: ${ENABLE_TIDY} (${CMAKE_CXX_CLANG_TIDY})")
112116
message(STATUS "------------------------------------------------------------------------------")

src/libunicode/CMakeLists.txt

+2-3
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,9 @@ add_library(unicode ${LIBUNICODE_LIB_MODE}
113113
codepoint_properties_names.cpp
114114
)
115115

116-
if(LIBUNICODE_USE_STD_SIMD)
116+
if(LIBUNICODE_SIMD_IMPLEMENTATION STREQUAL "std")
117117
target_compile_definitions(unicode PRIVATE LIBUNICODE_USE_STD_SIMD)
118-
endif()
119-
if(LIBUNICODE_USE_INTRINSICS)
118+
elseif(LIBUNICODE_SIMD_IMPLEMENTATION STREQUAL "intrinsics")
120119
target_compile_definitions(unicode PRIVATE USE_INTRINSICS)
121120
endif()
122121

0 commit comments

Comments
 (0)