This is needed specifically for the second signature of
add_custom_command, which appends an operation to an existing target.
This will prevent the cmake warning CMP0175.
Reference: https://cmake.org/cmake/help/latest/policy/CMP0175.html
Problem: Currently Neovim only searches for lpeg.dylib, liblpeg.dylib,
etc. on MacOS, but a normal installation of lpeg will produce lpeg.so
instead. There are explicit workarounds for this by modifying lpeg's
package in Homebrew, and will shortly be another in spack.
Solution: also search for lpeg.so even if that's not the platform
default, because Lua and luarocks use it anyway.
Forcing the build type to be one of the default types was intended to
prevent usage of custom build types which risks unpredictability.
Unfortunately, many distributions patch this check out so they can use
a custom type anyway, making the check moot in the first place. Instead,
allow custom build types but don't try to accomodate them in the code:
we're making the assumption that anyone who wants to use a custom build
type will be able to set any additional necessary flags needed for their
specific system.
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=<path/to/sccache> make ...`
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.
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.
This reverts a large portion of
2c1e8f7e96.
The conclusion from that commit is incorrect: local builds are not
used/updated correctly so much as it's not used at all. Instead the
build will always use `master` branch rather than the current files.
It's a combination of add_custom_target and add_custom_command that does
what most users probably expect should happen.
This also fixes `make clean` removing files tracked by git.
`GIT_REPOSITORY` will cause cmake to rebuild if local dependency
changes, which isn't the case for `URL`.
Also document how to test a different commits of a dependency.
This will reduce friction as developers no longer need to provide a hash
when testing out different commits.
To skip the hash check, set `DEPS_IGNORE_SHA` to `TRUE` in
`cmake.deps/CMakeLists.txt`.
Debugging dependencies is rare so a Debug build type is usually not
needed. In cases where it _is_ needed it is easy to rebuild in Debug
mode. But since Release builds are more common, it makes more sense as a
default.
For Neovim itself we stick with a Debug build as a default, since
rebuilding and debugging is done _much_ more frequently than with
dependencies (which we _mostly_ expect to "just work").
Also remove the CMAKE_BUILD_TYPE variable in the Makefile, since this is
set by default in CMake.
- remove "ran-" prefix from touch files as it's redundant since the
they're already in the directory named `touches`.
- Include `contrib` when formatting with `make formatlua`.
- Use TARGET_FILE generator expression instead of assuming the
executable location.
- reuse logic that determines whether to use lua or luajit.
- add translations to the `nvim` target.
Makefile improvements:
- rename variable `CMAKE_PRG` to `CMAKE` to make it more consistent with
the builtin `MAKE` variable.
- stop propagating flags to generator. Users should use cmake for
non-standard use cases.
- remove `+` prefix from targets. If the user for whatever reason wants
to dry-run a target then they should be able to.
- add EXTERNALPROJECT_OPTIONS variable to main build
- use `REQUIRED` keyword for IWYU.
- remove check_c_compiler_flag checks when `ENABLE_COMPILER_SUGGESTIONS`
is `ON`. If we explicitly enable it then we probably want it to give
an error if it doesn't exist, rather than silently skip it.
- Move dependency interface libraries to their find module and use them
as a pseudo-imported target.
- Remove BUSTED_OUTPUT_TYPE. It's not used and we can reintroduce it
again if something similar is needed.
- Use LINK_OPTIONS intead of LINK_FLAGS when generating the `--version`
output.
The benefits are primarily being able to use FetchContent, which allows
for a more flexible dependency handling. Other various quality-of-life
features such as `-B` and `-S` flags are also included.
This also removes broken `--version` generation as it does not work for
version 3.10 and 3.11 due to the `JOIN` generator expression.
Reference: https://github.com/neovim/neovim/issues/24004
This will ensure that we can pass flags and make adjustments from the
top level cmake file instead of digging through the cmake directory.
More importantly, this will only format files that have been changed.
This has a slightly higher initial cost compared to previous solution as
all files must be initially formatted, but the gained speed up should
more than make up for it quickly.
`make formatlua` is always run due to a quirk of stylua of always changing
modification time of the file regardless if there were any changes. This is not
a major blocker as stylua is very fast.
Ensure bundled libraries and include directories are always searched
first before any others. This will provide a more consistent experience
as the search order of the builtin find_ functions can vary depending on
system. This should make the build process faster when building with
bundled deps as we limit the search to only the .deps directory.
Separating the search between .deps and everything makes debugging
find_-related problems simpler if you need to check how dependencies are
found.
For libraries, we divide the search process into the following order:
1. Only search in .deps directory and only search for static libraries.
2. Only search in .deps directory and search for all libraries.
3. Search everywhere and search for all libraries.
Make an exception for FindLibintl.cmake as changing the search order
seems to break some tests on macos.
Problem:
Some tests fail with $SHELL=fish #6172
Related: https://github.com/neovim/neovim/pull/6176
Solution:
Replace "echo -n" with "printf", because "echo" in sh may be provided
as a shell builtin, which does not accept an "-n" flag to avoid a
trailing newline (e.g. on macos). "printf" is more portable (defined by
POSIX) and it does not output a trailing newline by itself.
Fixes#6172
TODO:
Other test failures may be related to "session leader" issue: https://github.com/neovim/neovim/issues/2354
Checked by running `:terminal ./build/bin/tty-test` from Nvim with
`shell=/bin/fish` (inherited from `$SHELL`) and it indeed complains
about "process does not own the terminal". With `shell=sh` it doesn't complain. And
unsetting `$SHELL` seems to make `nvim` to fall back to `shell=sh`.
FAILED test/functional/terminal/tui_spec.lua @ 1017: TUI paste: terminal mode
test/functional/terminal/tui_spec.lua:1024: Row 1 did not match.
Expected:
|*tty ready |
|*{1: } |
|* |
| |
|{5:^^^^^^^ }|
|{3:-- TERMINAL --} |
|{3:-- TERMINAL --} |
Actual:
|*process does not own the terminal |
|* |
|*[Process exited 2]{1: } |
| |
|{5:^^^^^^^ }|
|{3:-- TERMINAL --} |
|{3:-- TERMINAL --} |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:622: in function '_wait'
test/functional/ui/screen.lua:352: in function 'expect'
test/functional/terminal/tui_spec.lua:1024: in function <test/functional/terminal/tui_spec.lua:1017>
FAILED test/functional/terminal/tui_spec.lua @ 1551: TUI forwards :term palette colors with termguicolors
test/functional/terminal/tui_spec.lua:1567: Row 1 did not match.
Expected:
|*{1:t}ty ready |
| |
|* |
| |
|{2:^^^^^^^ }|
| |
|{3:-- TERMINAL --} |
Actual:
|*{1:p}rocess does not own the terminal |
| |
|*[Process exited 2] |
| |
|{2:^^^^^^^ }|
| |
|{3:-- TERMINAL --} |
To print the expect() call that would assert the current screen state, use
screen:snapshot_util(). In case of non-deterministic failures, use
screen:redraw_debug() to show all intermediate screen states.
stack traceback:
test/functional/ui/screen.lua:622: in function '_wait'
test/functional/ui/screen.lua:352: in function 'expect'
test/functional/terminal/tui_spec.lua:1567: in function <test/functional/terminal/tui_spec.lua:1551>
Fixes#24881
--force-config passed to luarocks' configure script is only taken into
account in case "make install" is used afterwards.
But if "make bootstrap" is used then this flag has no effect. And it can
actually copy an existing config on the system to the new installation.
That existing config can have a different version of Lua set by default.
In which case luarocks will install packages for that version instead of
the one used in tests. And trying to run tests then will fail because of
missing packages.
- simplify lua interpreter search
- fix incorrect variable name in BuildLua.cmake
- build PUC Lua with -O2
- silence non-mandatory find_package search for libuv
- simplify Find modules
- Prefer using the explicitly set CI_BUILD over relying on the
environment variable "CI".
Downloading the necessary files all at once instead of doing dependency
handling with luarocks speeds up installation immensely. We speed up the
process even more by using luv as a replacement for the C modules in the
busted dependencies, which allows us to skip costly compilation times.
Co-authored-by: bfredl <bjorn.linse@gmail.com>
Problem:
`nvim -v` and `:version` prints system vimrc, fallback files, and compilation
info by default, which most people don't care about and just clutters up the
output.
Solution:
Omit extra info unless 'verbose' is set.
This will abort if lint programs are not found, and is meant primarily
for the lint job in CI. Supersedes the REQUIRED argument in
add_glob_target as it's a superior replacement by being a built-in
solution.
Problem:
Nvim version string typically has a "build" component
but vim.version() doesn't report it.
Solution:
Add the "build" field to vim.version().
Closes#23863
Uncrustify is sensitive to version changes, which causes friction for
contributors that doesn't have that exact version. It's also simpler to
download and install the correct version than to have bespoke version
checking.
- Simplify error checking when using execute_process.
- Set BUILD_SHARED_LIBS to OFF when building dependencies.
This is normally not needed, but msgpack interprets an unset
BUILD_SHARED_LIBS to build a shared library, which is the opposite of
the cmake behavior.
- Move function check_lua_module to Util.cmake.
- Remove unnecessary code.
- Make variable naming more consistent
Cmake truncates the full link path to a shared library if it is missing
an SONAME in some undocumented scenarios. This causes builds in some
systems to fail if "lpeg" isn't a library on the system path.
The path of imported libraries aren't modified by cmake, so we can use
that as a workaround until a proper solution for this has been
identified.
Closes https://github.com/neovim/neovim/issues/23395.