aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-06-12 17:04:58 +0200
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-06-28 19:47:39 +0200
commit32e16cb0b6b046ba45d3e14c0fdb0383ad8bee1e (patch)
treed5d4af25bf0bbc19bcdbb66e2d0e79b9102ef26f
parent46187117c9464dd6c09eae8e47bb279d72a01038 (diff)
downloadrneovim-32e16cb0b6b046ba45d3e14c0fdb0383ad8bee1e.tar.gz
rneovim-32e16cb0b6b046ba45d3e14c0fdb0383ad8bee1e.tar.bz2
rneovim-32e16cb0b6b046ba45d3e14c0fdb0383ad8bee1e.zip
build: add utf8proc as dependency
utf8proc contains all the data which is currently in unicode_tables.generated.h internally, but in quite a different format. Ideally unicode_tables.generated.h should be removed as well so we rely solely on utf8proc. We want to avoid a situation where the possibility of unicode mismatch occurs, e.g a distro using both unicode 12 and unicode 13.
-rw-r--r--cmake.deps/CMakeLists.txt5
-rw-r--r--cmake.deps/CMakePresets.json3
-rw-r--r--cmake.deps/cmake/BuildUTF8proc.cmake5
-rw-r--r--cmake.deps/deps.txt3
-rw-r--r--cmake/FindUTF8proc.cmake12
-rw-r--r--src/nvim/CMakeLists.txt4
6 files changed, 30 insertions, 2 deletions
diff --git a/cmake.deps/CMakeLists.txt b/cmake.deps/CMakeLists.txt
index 5b1f149dd7..3c4a28f9ce 100644
--- a/cmake.deps/CMakeLists.txt
+++ b/cmake.deps/CMakeLists.txt
@@ -37,6 +37,7 @@ option(USE_BUNDLED_MSGPACK "Use the bundled msgpack." ${USE_BUNDLED})
option(USE_BUNDLED_TS "Use the bundled treesitter runtime." ${USE_BUNDLED})
option(USE_BUNDLED_TS_PARSERS "Use the bundled treesitter parsers." ${USE_BUNDLED})
option(USE_BUNDLED_UNIBILIUM "Use the bundled unibilium." ${USE_BUNDLED})
+option(USE_BUNDLED_UTF8PROC "Use the bundled utf8proc library." ${USE_BUNDLED})
if(USE_BUNDLED AND MSVC)
option(USE_BUNDLED_GETTEXT "Use the bundled version of gettext." ON)
option(USE_BUNDLED_LIBICONV "Use the bundled version of libiconv." ON)
@@ -140,6 +141,10 @@ if(USE_BUNDLED_TS)
include(BuildTreesitter)
endif()
+if(USE_BUNDLED_UTF8PROC)
+ include(BuildUTF8proc)
+endif()
+
if(WIN32)
include(GetBinaryDeps)
diff --git a/cmake.deps/CMakePresets.json b/cmake.deps/CMakePresets.json
index f399dad217..7d9f473581 100644
--- a/cmake.deps/CMakePresets.json
+++ b/cmake.deps/CMakePresets.json
@@ -17,7 +17,8 @@
"cacheVariables": {
"USE_BUNDLED":"OFF",
"USE_BUNDLED_LIBVTERM":"ON",
- "USE_BUNDLED_TS":"ON"
+ "USE_BUNDLED_TS":"ON",
+ "USE_BUNDLED_UTF8PROC":"ON"
},
"inherits": ["base"]
}
diff --git a/cmake.deps/cmake/BuildUTF8proc.cmake b/cmake.deps/cmake/BuildUTF8proc.cmake
new file mode 100644
index 0000000000..9445e615f0
--- /dev/null
+++ b/cmake.deps/cmake/BuildUTF8proc.cmake
@@ -0,0 +1,5 @@
+get_externalproject_options(utf8proc ${DEPS_IGNORE_SHA})
+ExternalProject_Add(utf8proc
+ DOWNLOAD_DIR ${DEPS_DOWNLOAD_DIR}/utf8proc
+ CMAKE_ARGS ${DEPS_CMAKE_ARGS}
+ ${EXTERNALPROJECT_OPTIONS})
diff --git a/cmake.deps/deps.txt b/cmake.deps/deps.txt
index 356bfd92d4..5d728bc8ad 100644
--- a/cmake.deps/deps.txt
+++ b/cmake.deps/deps.txt
@@ -41,6 +41,9 @@ GETTEXT_SHA256 66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c
LIBICONV_URL https://github.com/neovim/deps/raw/b9bf36eb31f27e8136d907da38fa23518927737e/opt/libiconv-1.17.tar.gz
LIBICONV_SHA256 8f74213b56238c85a50a5329f77e06198771e70dd9a739779f4c02f65d971313
+UTF8PROC_URL https://github.com/JuliaStrings/utf8proc/archive/v2.9.0.tar.gz
+UTF8PROC_SHA256 18c1626e9fc5a2e192311e36b3010bfc698078f692888940f1fa150547abb0c1
+
TREESITTER_C_URL https://github.com/tree-sitter/tree-sitter-c/archive/v0.21.3.tar.gz
TREESITTER_C_SHA256 75a3780df6114cd37496761c4a7c9fd900c78bee3a2707f590d78c0ca3a24368
TREESITTER_LUA_URL https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/v0.1.0.tar.gz
diff --git a/cmake/FindUTF8proc.cmake b/cmake/FindUTF8proc.cmake
new file mode 100644
index 0000000000..2183f35d34
--- /dev/null
+++ b/cmake/FindUTF8proc.cmake
@@ -0,0 +1,12 @@
+find_path2(UTF8PROC_INCLUDE_DIR utf8proc.h)
+find_library2(UTF8PROC_LIBRARY NAMES utf8proc utf8proc_static)
+find_package_handle_standard_args(UTF8proc DEFAULT_MSG
+ UTF8PROC_LIBRARY UTF8PROC_INCLUDE_DIR)
+mark_as_advanced(UTF8PROC_LIBRARY UTF8PROC_INCLUDE_DIR)
+
+add_library(utf8proc INTERFACE)
+target_include_directories(utf8proc SYSTEM BEFORE INTERFACE ${UTF8PROC_INCLUDE_DIR})
+target_link_libraries(utf8proc INTERFACE ${UTF8PROC_LIBRARY})
+
+#TODO(dundargoc): this is a hack that should ideally be hardcoded into the utf8proc project via configure_command
+target_compile_definitions(utf8proc INTERFACE "UTF8PROC_STATIC")
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 937cfaaa31..950e4d54a0 100644
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -35,6 +35,7 @@ find_package(Lpeg REQUIRED)
find_package(Msgpack 1.0.0 REQUIRED)
find_package(Treesitter 0.22.6 REQUIRED)
find_package(Unibilium 2.0 REQUIRED)
+find_package(UTF8proc REQUIRED)
target_link_libraries(main_lib INTERFACE
iconv
@@ -42,7 +43,8 @@ target_link_libraries(main_lib INTERFACE
lpeg
msgpack
treesitter
- unibilium)
+ unibilium
+ utf8proc)
target_link_libraries(nlua0 PUBLIC lpeg)
if(ENABLE_LIBINTL)