From f09f5c45facc597bb3f70b7821412641bf31a592 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Tue, 28 May 2024 11:03:49 +0200 Subject: build: reuse code for deps.txt for both deps and main build --- cmake/Deps.cmake | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'cmake') diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index 413e3a08a9..398d9564cd 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -58,6 +58,32 @@ if(CMAKE_OSX_SYSROOT) set(DEPS_C_COMPILER "${DEPS_C_COMPILER} -isysroot${CMAKE_OSX_SYSROOT}") endif() +get_filename_component(rootdir ${PROJECT_SOURCE_DIR} NAME) +if(${rootdir} MATCHES "cmake.deps") + set(depsfile ${PROJECT_SOURCE_DIR}/deps.txt) +else() + set(depsfile ${PROJECT_SOURCE_DIR}/cmake.deps/deps.txt) +endif() + +set_directory_properties(PROPERTIES + EP_PREFIX "${DEPS_BUILD_DIR}" + CMAKE_CONFIGURE_DEPENDS ${depsfile}) + +file(READ ${depsfile} DEPENDENCIES) +STRING(REGEX REPLACE "\n" ";" DEPENDENCIES "${DEPENDENCIES}") +foreach(dep ${DEPENDENCIES}) + STRING(REGEX REPLACE " " ";" dep "${dep}") + list(GET dep 0 name) + list(GET dep 1 value) + if(NOT ${name}) + # _URL variables must NOT be set when USE_EXISTING_SRC_DIR is set, + # otherwise ExternalProject will try to re-download the sources. + if(NOT USE_EXISTING_SRC_DIR) + set(${name} ${value}) + endif() + endif() +endforeach() + function(get_externalproject_options name DEPS_IGNORE_SHA) string(TOUPPER ${name} name_allcaps) set(url ${${name_allcaps}_URL}) -- cgit From 32e16cb0b6b046ba45d3e14c0fdb0383ad8bee1e Mon Sep 17 00:00:00 2001 From: dundargoc Date: Wed, 12 Jun 2024 17:04:58 +0200 Subject: 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. --- cmake/FindUTF8proc.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cmake/FindUTF8proc.cmake (limited to 'cmake') 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") -- cgit From 1247684ae14e83c5b742be390de8dee00fd4e241 Mon Sep 17 00:00:00 2001 From: bfredl Date: Tue, 2 Jul 2024 13:47:04 +0200 Subject: build(deps): remove msgpack-c dependency --- cmake/FindMsgpack.cmake | 24 ------------------------ 1 file changed, 24 deletions(-) delete mode 100644 cmake/FindMsgpack.cmake (limited to 'cmake') diff --git a/cmake/FindMsgpack.cmake b/cmake/FindMsgpack.cmake deleted file mode 100644 index 9ef18122ab..0000000000 --- a/cmake/FindMsgpack.cmake +++ /dev/null @@ -1,24 +0,0 @@ -find_path2(MSGPACK_INCLUDE_DIR msgpack/version_master.h) - -if(MSGPACK_INCLUDE_DIR) - file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h) - string(REGEX REPLACE ".*MSGPACK_VERSION_MAJOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MAJOR "${msgpack_version_h}") - string(REGEX REPLACE ".*MSGPACK_VERSION_MINOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MINOR "${msgpack_version_h}") - string(REGEX REPLACE ".*MSGPACK_VERSION_REVISION +([0-9]+).*" "\\1" MSGPACK_VERSION_REVISION "${msgpack_version_h}") - set(MSGPACK_VERSION_STRING "${MSGPACK_VERSION_MAJOR}.${MSGPACK_VERSION_MINOR}.${MSGPACK_VERSION_REVISION}") -else() - set(MSGPACK_VERSION_STRING) -endif() - -find_library2(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c - NAMES_PER_DIR) - -mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY) - -find_package_handle_standard_args(Msgpack - REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR - VERSION_VAR MSGPACK_VERSION_STRING) - -add_library(msgpack INTERFACE) -target_include_directories(msgpack SYSTEM BEFORE INTERFACE ${MSGPACK_INCLUDE_DIR}) -target_link_libraries(msgpack INTERFACE ${MSGPACK_LIBRARY}) -- cgit From fa79a8ad6deefeea81c1959d69aa4c8b2d993f99 Mon Sep 17 00:00:00 2001 From: Christian Clason Date: Thu, 8 Aug 2024 12:28:47 +0200 Subject: build(deps): vendor libvterm at v0.3.3 Problem: Adding support for modern Nvim features (reflow, OSC 8, full utf8/emoji support) requires coupling libvterm to Nvim internals (e.g., utf8proc). Solution: Vendor libvterm at v0.3.3. --- cmake/FindLibvterm.cmake | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 cmake/FindLibvterm.cmake (limited to 'cmake') diff --git a/cmake/FindLibvterm.cmake b/cmake/FindLibvterm.cmake deleted file mode 100644 index 68c2646d47..0000000000 --- a/cmake/FindLibvterm.cmake +++ /dev/null @@ -1,31 +0,0 @@ -find_path2(LIBVTERM_INCLUDE_DIR vterm.h) -find_library2(LIBVTERM_LIBRARY vterm) - -if(LIBVTERM_INCLUDE_DIR AND EXISTS "${LIBVTERM_INCLUDE_DIR}/vterm.h") - file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MAJOR REGEX "#define VTERM_VERSION_MAJOR") - string(REGEX MATCH "[0-9]+" VTERM_VERSION_MAJOR ${VTERM_VERSION_MAJOR}) - - file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_MINOR REGEX "#define VTERM_VERSION_MINOR") - string(REGEX MATCH "[0-9]+" VTERM_VERSION_MINOR ${VTERM_VERSION_MINOR}) - - file(STRINGS ${LIBVTERM_INCLUDE_DIR}/vterm.h VTERM_VERSION_PATCH REGEX "#define VTERM_VERSION_PATCH") - - # The following is needed to give a coherent error for versions 0.3.2 and - # smaller. - if(VTERM_VERSION_PATCH) - string(REGEX MATCH "[0-9]+" VTERM_VERSION_PATCH ${VTERM_VERSION_PATCH}) - string(PREPEND VTERM_VERSION_PATCH ".") - endif() - - set(VTERM_VERSION ${VTERM_VERSION_MAJOR}.${VTERM_VERSION_MINOR}${VTERM_VERSION_PATCH}) -endif() - -find_package_handle_standard_args(Libvterm - REQUIRED_VARS LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY - VERSION_VAR VTERM_VERSION) - -add_library(libvterm INTERFACE) -target_include_directories(libvterm SYSTEM BEFORE INTERFACE ${LIBVTERM_INCLUDE_DIR}) -target_link_libraries(libvterm INTERFACE ${LIBVTERM_LIBRARY}) - -mark_as_advanced(LIBVTERM_INCLUDE_DIR LIBVTERM_LIBRARY) -- cgit From 688b961d13bd54a14836f08c3ded3121d3fb15a0 Mon Sep 17 00:00:00 2001 From: Lewis Russell Date: Fri, 19 Apr 2024 16:04:57 +0100 Subject: feat(treesitter): add support for wasm parsers Problem: Installing treesitter parser is hard (harder than climbing to heaven). Solution: Add optional support for wasm parsers with `wasmtime`. Notes: * Needs to be enabled by setting `ENABLE_WASMTIME` for tree-sitter and Neovim. Build with `make CMAKE_EXTRA_FLAGS=-DENABLE_WASMTIME=ON DEPS_CMAKE_FLAGS=-DENABLE_WASMTIME=ON` * Adds optional Rust (obviously) and C11 dependencies. * Wasmtime comes with a lot of features that can negatively affect Neovim performance due to library and symbol table size. Make sure to build with minimal features and full LTO. * To reduce re-compilation times, install `sccache` and build with `RUSTC_WRAPPER= make ...` --- cmake/FindWasmtime.cmake | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 cmake/FindWasmtime.cmake (limited to 'cmake') diff --git a/cmake/FindWasmtime.cmake b/cmake/FindWasmtime.cmake new file mode 100644 index 0000000000..e6315748b4 --- /dev/null +++ b/cmake/FindWasmtime.cmake @@ -0,0 +1,22 @@ +find_path2(WASMTIME_INCLUDE_DIR wasmtime.h) +find_library2(WASMTIME_LIBRARY wasmtime) + +if(WASMTIME_INCLUDE_DIR AND EXISTS "${WASMTIME_INCLUDE_DIR}/wasmtime.h") + file(STRINGS ${WASMTIME_INCLUDE_DIR}/wasmtime.h WASMTIME_VERSION REGEX "#define WASMTIME_VERSION") + string(REGEX MATCH "[0-9]+\.[0-9]\.[0-9]" WASMTIME_VERSION ${WASMTIME_VERSION}) +endif() + +find_package_handle_standard_args(Wasmtime + REQUIRED_VARS WASMTIME_INCLUDE_DIR WASMTIME_LIBRARY + VERSION_VAR WASMTIME_VERSION) + +add_library(wasmtime INTERFACE) +target_include_directories(wasmtime SYSTEM BEFORE INTERFACE ${WASMTIME_INCLUDE_DIR}) +target_link_libraries(wasmtime INTERFACE ${WASMTIME_LIBRARY}) + +if(MSVC) + target_compile_options(wasmtime INTERFACE -DWASM_API_EXTERN= -DWASI_API_EXTERN=) + target_link_libraries(wasmtime INTERFACE ws2_32 advapi32 userenv ntdll shell32 ole32 bcrypt) +endif() + +mark_as_advanced(WASMTIME_INCLUDE_DIR WASMTIME_LIBRARY) -- cgit From 327110ff8c5965eaae92f363f06b04a4986b6ef7 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sun, 22 Sep 2024 17:00:38 +0200 Subject: build(cmake): remove unnecessary policy code Policy CMP0092 is by default on for minimum cmake versions above 3.15. --- cmake/Deps.cmake | 5 ----- 1 file changed, 5 deletions(-) (limited to 'cmake') diff --git a/cmake/Deps.cmake b/cmake/Deps.cmake index 398d9564cd..519826654f 100644 --- a/cmake/Deps.cmake +++ b/cmake/Deps.cmake @@ -18,11 +18,6 @@ if(APPLE) list(APPEND DEPS_CMAKE_ARGS -D CMAKE_FIND_FRAMEWORK=${CMAKE_FIND_FRAMEWORK}) endif() -# Can be removed once minimum version is at least 3.15 -if(POLICY CMP0092) - list(APPEND DEPS_CMAKE_ARGS -D CMAKE_POLICY_DEFAULT_CMP0092=NEW) -endif() - find_program(CACHE_PRG NAMES ccache sccache) if(CACHE_PRG) set(CMAKE_C_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env CCACHE_SLOPPINESS=pch_defines,time_macros ${CACHE_PRG}) -- cgit