Skip to content

Commit

Permalink
Merge pull request #106 from contour-terminal/improvement/better-simd…
Browse files Browse the repository at this point in the history
…-config

Improvement/better simd config
  • Loading branch information
christianparpart authored Sep 28, 2024
2 parents ba35282 + a7d323e commit 42494f9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ jobs:
dnf install -y curl
PREPARE_ONLY_EMBEDS=OFF SYSDEP_ASSUME_YES=ON ./scripts/install-deps.sh
dnf install -y unicode-ucd
- name: CMake build
run: |
cmake --preset linux-gcc-debug -DLIBUNICODE_UCD_DIR=/usr/share/unicode/ucd
cmake --build --preset linux-gcc-debug -j$(nproc)
- name: configure
run: cmake --preset linux-gcc-debug -DLIBUNICODE_UCD_DIR=/usr/share/unicode/ucd
- name: build
run: cmake --build --preset linux-gcc-debug -j$(nproc)
- name: test
run: |
ctest --preset linux-gcc-debug
8 changes: 6 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,13 @@ option(LIBUNICODE_TESTING "libunicode: Enables building of unittests for libunic
option(LIBUNICODE_BENCHMARK "libunicode: Enables building of benchmark for libunicode [default: OFF]" OFF)
option(LIBUNICODE_TOOLS "libunicode: Builds CLI tools [default: ${MASTER_PROJECT}]" ${MASTER_PROJECT})
option(LIBUNICODE_BUILD_STATIC "libunicode: provide static library instead of dynamic [default: ${LIBUNICODE_BUILD_STATIC_DEFAULT}]" ${LIBUNICODE_BUILD_STATIC_DEFAULT})
option(LIBUNICODE_USE_INTRINSICS "libunicode: Use SIMD extenstion during text read [default: ON]" ON)
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})
option(LIBUNICODE_TABLEGEN_FASTBUILD "libunicode: Use fast table generation (takes more memory in final tables) [default: OFF]" OFF)

if(NOT LIBUNICODE_SIMD_IMPLEMENTATION)
set(LIBUNICODE_SIMD_IMPLEMENTATION "intrinsics" CACHE STRING "libunicode: SIMD implementation to use" FORCE)
set_property(CACHE LIBUNICODE_SIMD_IMPLEMENTATION PROPERTY STRINGS "std" "intrinsics" "none")
endif()

set(BENCHMARK_ENABLE_TESTING OFF CACHE BOOL "Enable testing of the benchmark library." FORCE)
include(ThirdParties)

Expand Down Expand Up @@ -107,6 +110,7 @@ message(STATUS "Build benchmark: ${LIBUNICODE_BENCHMARK}")
message(STATUS "Build tools: ${LIBUNICODE_TOOLS}")
message(STATUS "Enable tablegen fast build: ${LIBUNICODE_TABLEGEN_FASTBUILD}")
message(STATUS "Using ccache: ${USING_CCACHE_STRING}")
message(STATUS "SIMD support: ${LIBUNICODE_SIMD_IMPLEMENTATION}")
message(STATUS "Using UCD directory: ${LIBUNICODE_UCD_DIR}")
message(STATUS "Enable clang-tidy: ${ENABLE_TIDY} (${CMAKE_CXX_CLANG_TIDY})")
message(STATUS "------------------------------------------------------------------------------")
Expand Down
5 changes: 2 additions & 3 deletions src/libunicode/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,9 @@ add_library(unicode ${LIBUNICODE_LIB_MODE}
codepoint_properties_names.cpp
)

if(LIBUNICODE_USE_STD_SIMD)
if(LIBUNICODE_SIMD_IMPLEMENTATION STREQUAL "std")
target_compile_definitions(unicode PRIVATE LIBUNICODE_USE_STD_SIMD)
endif()
if(LIBUNICODE_USE_INTRINSICS)
elseif(LIBUNICODE_SIMD_IMPLEMENTATION STREQUAL "intrinsics")
target_compile_definitions(unicode PRIVATE USE_INTRINSICS)
endif()

Expand Down

0 comments on commit 42494f9

Please sign in to comment.