Commit Graph

279 Commits

Author SHA1 Message Date
Christian Clason
07a6bc2be3
build(deps): bump libuv to HEAD - 62c2374a8 (#22166) 2023-02-08 14:37:04 +01:00
dundargoc
4d2c1004e9
build: prefer -D <variable>=<value> over -D<variable>=<value> (#22164)
This makes it easier to see that -D is referring to the entire
"<variable>=<value>", rather than only <variable>. It also help syntax
highlighters highlight built-in variables.
2023-02-08 11:00:16 +01:00
dundargoc
d38dfdca58
build: remove duplicate INTERFACE keyword (#22106) 2023-02-07 21:37:16 +01:00
dundargoc
f9826e1dff
build: stop relying on CMAKE_BUILD_TYPE to determine the build type (#22051)
Any logic involving CMAKE_BUILD_TYPE is automatically broken as it won't
work with multi-config generators. The only exception is if we
explicitly check whether the current generator is single-config as well.
Instead, use generator expressions or cmake variables that allows to set
options for certain build types only such as
INTERPROCEDURAL_OPTIMIZATION_<CONFIG>.

Opt to generate all headers with optimization level O2 with no debug
information for all build types as that is the simplest way to make it
behave the same for all generators.
2023-02-03 00:00:15 +01:00
bfredl
13aa23b62a refactor(tests): run unittests using main nvim binary in interpreter mode
This allows us to get rid of the separate "nvim-test" target
2023-01-31 19:28:26 +01:00
dundargoc
38365fa2ef
build: fix dependencies in find modules (#22017)
Find modules should only link to libraries defined in the find module,
and not the main project. This helps the find modules be more self-contained and easier to understand.
2023-01-27 14:16:31 +01:00
dundargoc
d85ed00a8c
build: find unibilium without relying on libfindmacros (#22015)
This will remove the warning about the find module not providing a
version.
2023-01-27 11:53:32 +01:00
dundargoc
843c9025ae
build: check if libvterm version meets requirement (#22010)
The vterm.h file only specifies major and minor version, but not patch,
meaning that requiring a specific patch number isn't currently possible.
2023-01-26 21:35:06 +01:00
dundargoc
4c5c6ca800
build: various cmake fixes (#21902)
* build: various cmake refactors and simplifications

- Add STATUS keyword to message to ensure messages are shown in the
  correct order.
- Remove DEPS_CXX_COMPILER as we don't rely on C++ for any of our
  dependencies.
- Simplify how msgpack and luv configure options are constructed.
- Rely on the default installation for luv instead of manually passing
  configure, build and install commands.
- Simplify return code conditional.

* build: remove CMAKE_OSX_ARCHITECTURES_ALT_SEP workaround

CMAKE_OSX_ARCHITECTURES_ALT_SEP was defined as a workaround to prevent
the shell from interpreting `;`, which CMake uses as a list separator.
However, the same thing can be achieved by instead passing
CMAKE_OSX_ARCHITECTURES as a cache variable instead, which is a more
idiomatic way of achieving the same thing.

* build: define CMAKE_BUILD_TYPE before adding it to BUILD_TYPE_STRING

The problem with the current setup is that CMAKE_BUILD_TYPE is defined
after BUILD_TYPE_STRING. BUILD_TYPE_STRING will then be empty on the
first run, meaning that dependencies are built without a build type.
However, since CMAKE_BUILD_TYPE is a cache variable its value will
persist in subsequent runs. On the second run BUILD_TYPE_STRING will
have the correct value, but it's a different value from the ones the
dependencies were built with. This will force some dependencies to be
built again.

Fixes https://github.com/neovim/neovim/issues/21672.
2023-01-20 23:48:46 +01:00
Enan Ajmain
7f7b83baef
build(Windows): fix redoing version generation (#21880)
Problem: On Windows, neovim's version is generated every time nvim is
built, even if code hasn't been changed.  That is because version
generation is done based on a hash matching of a file and the content of
the file.  And in Windows they don't match, because of the DOS
line-endings.

Solution: Write the file containing nvim version with UNIX line-endings.
2023-01-18 11:48:01 +01:00
dundargoc
69c71c4ab4
build: exclude tui/terminfo_defs.h from lintc-clint (#21822)
clint takes around 5-10 seconds to lint tui/terminfo_defs.h. For CI this
is negligible, but it's annoying for local development as touching
terminfo_defs.h will skyrocket lint times. Furthermore, we have no
reason to touch or modify terminfo_defs.h as it's a generated file, so
linting it shouldn't be necessary. This should speed up "make lint" by
the same amount, so around 5-10 seconds.
2023-01-15 19:30:17 +01:00
dundargoc
9220755302
build: remove clint error suppression #21782
Fix remaining clint errors and remove error suppression completely.

Rename the lint targets to align with the established naming convention:

- lintc-clint lints with clint.py.
- lintc-uncrustify lints with uncrustify.
- lintc runs both targets.

lintc is also provided as a make target for convenience.

After this change we can remove these files:
https://github.com/neovim/doc/tree/gh-pages/reports/clint
https://github.com/neovim/doc/blob/main/ci/clint-errors.sh
2023-01-13 15:48:10 -08:00
dundargoc
438b4361cc
build: use modern cmake (#21589)
Replace old-school cmake with the so-called "Modern CMake", meaning
preferring using targets and properties over directory settings and
variables. This allows greater flexibility, robustness and clarity over
how the code works.

The following deprecated commands will be replaced with their modern
alternatives that operates on a specific target, rather than all targets
in the current directory:

- add_compile_options -> target_compile_options
- include_directories -> target_include_directories
- link_libraries -> target_link_libraries
- add_definitions -> target_compile_definitions

There are mainly four main targets that we currently use: nvim, libnvim,
nvim-test (used by unittests) and ${texe} (used by
check-single-includes). The goal is to explicitly define the
dependencies of each target fully, rather than having everything be
dependent on everything else.
2023-01-10 18:49:57 +01:00
Jan Palus
a3f01d32cb
build: restrict git describe to top level source directory (#20993)
fix version determination when building neovim from release tarball
extracted within another git repository
2022-12-02 13:45:37 +01:00
dundargoc
01ff681f57
Merge pull request #20858 from dundargoc/build/lintsh
build: add more shell scripts to the `lintsh` target
2022-11-05 22:11:22 +01:00
dundargoc
aeb87f8b4a build: add EXCLUDE option to add_glob_target
EXCLUDE filters out all elements containing regex, meaning it works on
both files and directories.

Also rename add_glob_targets to add_glob_target since only one target is
being created.
2022-11-01 18:34:14 +01:00
dundargoc
45c8679493 build: give example on complex regexes
This is just to allow the reader to get a quick understanding without
necessarily needing to know all the regex intricasies.
2022-10-21 11:57:10 +02:00
dundargoc
e33995e936
fix(build): duplicate version string "v0.8.0-v0.8.0" #20578
- Prevent duplicate version strings such as v0.8.0-v0.8.0.
- Change the format for git releases from v0.9.0-dev-67-g625ba79be to
  v0.9.0-dev-67+g625ba79be.

Nvim versions are now:
release                    : v0.9.0
prerelease without git info: v0.9.0-dev
prerelease with git info   : v0.9.0-dev-67+g625ba79be
2022-10-20 04:03:41 -07:00
dundargoc
5046b4b4ad
ci: add cirrus to isCI function to skip tests (#20526)
The environment variable CIRRUS_CI is manually passed to RunTests.cmake
as it doesn't get passed when using cmake script mode.
2022-10-17 17:16:31 +02:00
dundargoc
913651d1f1 build: remove unnecessary translation-related code
The commands run in cmake script mode (-P) can simply be run in the main
cmake run instead.
2022-10-02 12:39:20 +02:00
dundargoc
06addcfaa9 build: remove unused variable CMAKE_C_COMPILER_ARG1
It was set in file cmake/i386-linux-gnu.toolchain.cmake which has been
removed since we don't use Travis anymore.
2022-10-02 12:39:20 +02:00
dundargoc
600136cfb6
revert: "build: remove unnecessary policy related code" #20289
This partially reverts commit 42aeb5c5b1.

Setting cmake policies is normally not required as
cmake_minimum_required automatically sets these. One exception is cmake
script mode (-P) since it automatically resets all policy changes.

Closes: https://github.com/neovim/neovim/issues/20286
2022-09-23 07:16:17 -07:00
dundargoc
2a1c65b330
build: ensure version generation always succeeds (#19515)
Add --always flag to `git describe` so version generation succeeds if
current directory is in a git repo. If not in git repo, fall back to a
default version in the format vx.y.z-dev
2022-09-10 14:37:11 +02:00
dundargoc
42aeb5c5b1 build: remove unnecessary policy related code
Having cmake version 3.10 as the required minimum version ensures these
are set to new by default.
2022-09-08 14:15:13 +02:00
dundargoc
6e3a69b4cf
build: consistently set build type regardless of generator or platform #19760
Change the default build type to always be Debug, and allow only four
predefined build types: Debug, Release, RelWithDebInfo and MinRelSize.
Furthermore, flags meant for single-configuration generator (make,
ninja) will not be used for multi-configuration generators (visual
studio, Xcode), and flags meant for multi-configuration generators will
not be used for single-configuration generators.

This will allow Debug builds to be built with MSVC which requires that
all dependencies are also built with the Debug build type to avoid
runtime library mismatch.

The correct way to specify build type (for example Release) for
single-configuration generators (Make and Ninja) is to run

cmake -B build -D CMAKE_BUILD_TYPE=Release
cmake --build build

while for multi-configuration generators (Visual Studio, Xcode and Ninja
Multi-Config) is to run

cmake -B build
cmake --build build --config Release

Passing CMAKE_BUILD_TYPE for multi-config generators will now not only
not be used, but also generate a warning for the user.

Co-authored-by: dundargoc <gocundar@gmail.com>
2022-09-06 07:52:39 -07:00
Lewis Russell
e23c5fda0a
build libuv cmake (#19632)
Co-authored-by: Daniel Hahler <git@thequod.de>
2022-08-12 16:59:40 +01:00
Dundar Goc
d3bfc03c5d build: remove InstallClintErrors.cmake
Replace its functionality by copying the entire directory where the
reports are instead.
2022-08-03 09:52:05 +02:00
Dundar Goc
ba3742ed0d build: remove unused file i386-linux-gnu.toolchain.cmake
It was used in .travis.yml which has been removed.
2022-08-03 09:52:05 +02:00
Dundar Goc
6e2c6114f9 build: replace deprecated cmake features with their modern alternatives
- Use DIRECTORY instead of PATH in get_filename_component
- Use COMPILE_OPTIONS instead of COMPILE_FLAGS. COMPILE_FLAGS is treated
  as a single string while COMPILE_OPTIONS is a list, meaning that cmake
  will take care of any escaping and quoting automatically.
2022-08-03 09:52:05 +02:00
dundargoc
8ce7e7409f
build: add formatting targets for c and lua files (#19488)
The targets will only format files that have been changed in current
branch compared to the master branch. This includes unstaged, staged and
committed files.

Add following make and cmake targets:
formatc   - format changed c files
formatlua - format changed lua files
format    - run formatc and formatlua

Remove scripts/uncrustify.sh as this deprecates it.
2022-08-02 12:32:57 +02:00
Dundar Goc
46bf1ec791 build: fix version generation to its previous behavior
This will change the version format from

v0.8.0-dev-nightly-12-g1a07044c1

to

v0.8.0-dev-698-ga5920e98f

Closes https://github.com/neovim/neovim/issues/19499
2022-07-26 11:22:31 +02:00
dundargoc
e12035fc0c
build(lint): check uncrustify version #19468
This to prevent the user from accidentally using the wrong uncrustify
version.
2022-07-25 06:18:49 -07:00
kylo252
790f8b0e16
fix(build): non-git ("tarball") build fails #19448
Problem:
Build fails without git or .git/.
ref #19289

Solution:
Fix the version generation logic.

Test cases:
If `git` is missing:
    -- Using NVIM_VERSION_MEDIUM: v0.8.0-dev
If `.git/` is missing:
    -- Git tag extraction failed:
       fatal: not a git repository (or any of the parent directories): .git
    -- Using NVIM_VERSION_MEDIUM: v0.8.0-dev
If `git describe` fails
    -- Git tag extraction failed:
       fatal: ...
    -- Using NVIM_VERSION_MEDIUM: v0.8.0-dev

Co-authored-by: Justin M. Keyes <justinkz@gmail.com>
2022-07-22 07:10:24 -07:00
Luis Felipe Dominguez Vega
75ad050919
fix(build): fails if git is missing #19366
Generate empty file if git is missing.
2022-07-14 15:25:28 -07:00
kylo252
912dbbdd77
build: gracefully handle error in git-version #19289
- only update git-version if both of these conditions are met:
    - `git` command succeeds
    - `versiondef_git.h` would change (SHA1-diff)
- else print a status/warning message

also move version generation out of Lua into cmake.
2022-07-14 00:12:27 -07:00
dundargoc
37af46bb4c
feat(build): add_glob_target runs only on changed files #19070
The general idea is that add_glob_targets creates a "touch file", a
dummy file that acts as a dependency in order to check which files are
outdated since the last time the target was run.

Remove RunUncrustify.cmake as it's no longer necessary. It was initially
introduced to silence its noisy output. The per-file targets will
suppress the noisy output from uncrustify, except for the very first
run.

Also remove DefCmdTarget.cmake since add_glob_target already
incorporates its functionality.
2022-06-30 05:10:05 -07:00
Carlo Cabrera
be40ba68a8
build(cmake): fix static libintl test on macOS
If `libintl` is a static library on macOS, we also need to explicitly
link with `libiconv` and the `CoreFoundation` framework. Otherwise, our
`HAVE_WORKING_LIBINTL` test erroneously fails.

Closes #19127
Closes #19138
2022-06-29 02:19:42 +08:00
Justin M. Keyes
a9cb0b8a5a
fix(tests): remove misleading $TEST_PATH segment #19050
Problem:
RunTests.cmake adds $TEST_PATH to $TMPDIR with the implication that it
gives more isolation. But this is misleading because $TEST_PATH is only
defined once. Full test runs use the same $TMPDIR for all tests.

This was likely added with the intention of invoking RunTests.cmake
once-per-testfile from a wrapper than does the isolation/orchestration.
But even so, Nvim's vim_maketempdir() / vim_mktempdir() _already_
creates a unique tempdir per session.

Solution:
Don't append $TEST_PATH to $TMPDIR. Avoids confusion and makes the path
shorter.
2022-06-23 16:15:55 -07:00
Dundar Goc
ae7a4ad3d7 build: remove FindLua.cmake since it's already built into cmake
FindLua.cmake is a copy from the cmake repo:
0419ecbcad/Modules/FindLua.cmake.
It's a cmake module, meaning it's already shipped with cmake by default.
There have been two changes done to our version of FindLua.cmake.

The first change is that

include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake)

was changed to

include(FindPackageHandleStandardArgs.cmake)

This change is required only because we have imported FindLua.cmake
module but not FindPackageHandleStandardArgs module. Had FindLua been
called as a module as intended then this file would not need changing.

The second change is that support for Lua 5.4 is added. However, support
for any version of Lua except for 5.1 is disabled since
e322b5c864.

Because these changes from the upstream FindLua.cmake is unnecessary I
believe we can and should use the builtin FindLua.cmake instead of our
own.
2022-06-19 18:34:28 +02:00
Dundar Goc
636a309981 build(cmake): simplify def_cmd_target function
Instead of appending to a command output, append to an existing target
instead. The primary benefit is intermediary ...-cmd targets aren't
needed, we can instead append commands to the relevant target directly.
2022-06-19 18:34:28 +02:00
Dundar Goc
cd1b2998d3 build(cmake): simplify and speed up the uninstall target
More specifically, replace exec_program with file(REMOVE ...) so that
the uninstall target is run during the build stage instead of the
configure stage, significantly speeding up the target.

The code snippet that was removed is taken from the cmake FAQ
https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake.
However, this uses undocumented features such as IMMEDIATE when calling
configure_file, which is an artifact from cmake 2.x (it's so old it's
difficult to find information on it). Similarly, this particular code
snippet has been around for a long time and originated from the cmake
mailing lists. Based on this I believe the in-file was a workaround for
the limitations of cmake back then and that it's not required anymore.
2022-06-19 18:34:28 +02:00
Justin M. Keyes
dd8b6094c0
build(lint): fix lintuncrustify #18945
Problem:
lintuncrustify doesn't actually do anything.

Solution:
- Fix the parameters.
- Fail correctly on nonzero result.

followup to #18940
2022-06-12 18:49:38 -07:00
Justin M. Keyes
f90174c98c
build(lint): fix luacheck not found #18940
Problem:
Since 6d57bb89c1 #18543, luacheck is not found on some systems when
running the "lintlua" target.

Solution:
- Move the find_program() to the top-level CMakeLists.txt
- Define a def_cmd_target() function with fewer assumptions than the old
  lint() function.
- Move "lintuncrustify" to src/nvim/CMakeLists.txt so it can reuse the
  $LINT_NVIM_SOURCES already defined there.
- Make the lint targets _fatal_ by default. There is little reason for
  the "lint" umbrella target defined in Makefile to exist if it's going
  to ignore the absence of the actual linters.
- For now, keep the uncrustify call in a separate cmake script so that
  it can be silenced (too noisy).
2022-06-12 15:08:01 -07:00
dundargoc
6d57bb89c1
build: add a cmake target for all used linters #18543
* build: move the logic for linters to cmake
Cmake is our source of truth. We should have as much of our build
process there as possible so everyone can make use of it.

* build: remove redundant check for ninja generator
The minimum cmake version as of writing this is 3.10, which has ninja
support.
2022-06-09 08:09:24 -07:00
Justin M. Keyes
4d9e2247c9
refactor(log): simplify log_path_init #18898
Problem:
Since 22b52dd462 #11501, log_path_init is called in log_init, so it is
now called at a deterministic time. So the "just in time" complexity of
log_path_init is no longer needed.

Solution:
Remove logic intended to try to "heal" partial initialization.
2022-06-08 08:47:34 -07:00
Dundar Goc
a4c0c07043 revert: "ci: remove mingw job #18580"
This partially reverts commit f8af81445b.

The mingw parts of cmake was removed to see if it was still used
(ref: https://github.com/neovim/neovim/pull/18580). It turns out it is,
so this will fix that.

Closes: https://github.com/neovim/neovim/issues/18597
2022-05-17 17:07:45 +02:00
dundargoc
f8af81445b
ci: remove mingw job #18580
Unnecessary CI builds increase the change of spurious failures, which are costly
noise. Of course, we should fix all legitimate bugs, but we also cannot
micro-manage every platform, so there needs to be a clear motivation for the CI
builds that we maintain.

Reasons against maintaining a mingw CI job:
1. The windows mingw build is slow.
2. Failures:
    - https://github.com/neovim/neovim/issues/18494
    - https://github.com/neovim/neovim/issues/18495
3. The mingw artifact is 10x bigger than the windows MSVC artifact:
   https://github.com/neovim/neovim/issues/10560
4. Our releases publish the MSVC (not mingw) artifact for Windows users:
   https://github.com/neovim/neovim/releases
5. Non-MSVCRT has limitations documented by libuv: http://docs.libuv.org/en/v1.x/process.html
   > On Windows file descriptors greater than 2 are available to the child process only if the child processes uses the MSVCRT runtime.

Closes https://github.com/neovim/neovim/issues/18551
2022-05-15 15:59:58 -07:00
erw7
5f3018fa1a
refactor(terminal)!: drop winpty, require Windows 10 #18253
Problem:
winpty is only needed for Windows 8.1. Removing it reduces our build and code
complexity.

Solution:
- Remove winpty.
- Require Windows 10.

closes #18252
2022-04-26 21:17:06 -07:00
zeertzjq
1495c4d166 ci: show failed message on Windows 2022-03-03 08:16:31 +08:00
Dundar Göc
82c5a02050 ci: skip tests that fail on windows 2022-02-20 10:22:39 +01:00
James McCoy
267ec67fab
test: allow excluding functional/unit tests using TEST_FILTER_OUT
Although this can already be done using `BUSTED_ARGS`, it complements
our existing shortcut of `TEST_FILTER.`

[skip ci]
2021-12-18 12:55:09 -05:00
Jakub Łuczyński
6b0a2e6996 build(install): rescan GLOB files on rebuild 2021-10-18 11:44:15 +02:00
Javier Lopez
33e79237bc build(tests): isolate the user environment XDG_DATA_DIRS #16003
Problem:
Some tests were not passing on my machine, specifically in
`test/functional/api/vim_spec.lua` the two tests under
`describe('nvim_get_runtime_file...`

Solution:
Unset `XDG_DATA_DIRS` in the test runner.
Note: Window CI failed if we set it to the same value as `XDG_DATA_HOME`.
2021-10-12 20:12:11 -07:00
James McCoy
f446ab3aa3
fix(build): call find_package(Threads) before using its variables 2021-09-21 06:56:59 -04:00
James McCoy
2435cf77d1
build: add ${CMAKE_THREAD_LIBS_INIT} to LIBUV_LIBRARIES
This is a workaround for not yet having fully correct Find* cmake
modules for static builds.

https://github.com/Tronic/cmake-modules/issues/3#issuecomment-624469020
2021-09-20 21:19:52 -04:00
Justin M. Keyes
7b822d4b4b
Merge branch 'master' into histfile 2021-09-10 07:05:11 -07:00
Jun T
c7ccb26260 do not write into user's ~/.bash_history 2021-09-10 18:21:29 +09:00
James McCoy
8d93223f83
test: use $TEST_TIMEOUT to specify timeout 2021-09-09 20:49:26 -04:00
Justin M. Keyes
5e5a329ea2
test: timeout at 20 minutes #15597
Set a maximum test run-time of 20 minutes to:
- fail faster
- avoid wasting CI resources
- set a bound on the test time (if tests take longer than 20 minutes we
  need to invest in parallelizing them...)

Timeout looks like:

    -- Tests exited non-zero: Process terminated due to timeout
    -- No output to stderr.
    CMake Error at /…/neovim/cmake/RunTests.cmake:86
    (message):
      functional tests failed with error: Process terminated due to timeout
2021-09-08 07:21:28 -07:00
Gregory Anders
f8eae29d39 build: prioritize statically built libluv in search
When libluv is built statically it appends an '_a' suffix to the library
name. This affects CMake's ability to find the bundled version of libluv
(which is built statically) when there is a dynamic version of the
library also built on the system, which does not have the '_a' suffix.

Prioritize searching for 'libluv_a' first before falling back to
'libluv'. This will ensure the bundled version of libluv is always found
first before any system versions of libluv. In cases where we are not
using bundled libraries, CMake will still safely fall through to finding
'libluv' since package managers do not typically provide static system
libraries.
2021-08-14 06:53:52 -06:00
Christian Clason
3de777d259
chore(deps): bump LibLUV to 1.40.0-0 (#14997)
Adds several threading, async, and gc fixes and allows building with older gcc (4.x). Minimum required version remains 1.30.1.
2021-07-07 08:24:08 +02:00
brian.orwe
84f10a7970 Add uninstall target for make and others 2021-03-16 15:33:39 +03:00
James McCoy
1451b14873
Align naming of FindTreeSitter cmake file and variables
`find_package(Foo ...)` expects to find a file FindFoo.cmake and the
resulting variables to be named `Foo_...`.  If those don't all match up,
then the detection does not work properly.

Closes #13262
2020-11-09 15:15:03 -05:00
Thomas Vigouroux
3eb241d831
bundle: move tree-sitter as a bundled dep
fixup! bundle: move tree-sitter as a bundled dep

fixup! bundle: move tree-sitter as a bundled dep
2020-11-03 10:39:35 +01:00
Michel Alexandre Salim
a50cf35bda
build/FindLua.cmake: allow Lua 5.4 #12820
Lua 5.4 is out, and will be shipped with Fedora 33.
2020-08-31 22:06:59 -07:00
Thomas Vigouroux
e10f9151dc treesitter: remove utf8proc dependency 2020-04-18 09:21:03 +02:00
erw7
4d0dfb8f75 build/MSVC: fix gettext multibyte issue #11774
Problem:  On Windows with the MSVC build, gettext-translation
          "Questa è già la" displays as "Questa <e8> gi<e0> la".
Solution: Fix iconv detection iconv when building gettext.
          So HAVE_ICONV is correctly defined when building nvim.

* fix gettext mb chars on MSVC
* fix libintl detection failure on MSVC

fixes #11749
2020-01-28 00:56:26 -08:00
Daniel Hahler
b18b84df5e
build: run git-describe for dev version during build (#11117)
This avoids invoking CMake after a new commit, which might take 15s on
some systems.

Skipped on CMake < 3.2.0 (missing BYPRODUCTS support).

Co-Authored-By: Justin M. Keyes <justinkz@gmail.com>
2019-09-30 00:10:29 +02:00
Daniel Hahler
0a2a1e241f
cmake: use LibFindMacros for utf8proc (#11114)
Also update doc.
2019-09-29 04:44:02 +02:00
Björn Linse
b871100be7 Create BuildUtf8proc.cmake and FindUtf8proc.cmake
Using advanced search and replace technology
2019-09-28 14:31:03 +02:00
Daniel Hahler
81b19df5f2
cmake/GetCompileFlags: include CMAKE_C_COMPILER_ARG1 (#11091)
This is used internally (e.g. on Travis) for 32-bit builds (`-m32`).
2019-09-25 00:09:23 +02:00
Daniel Hahler
16b64c339e build: rename CMake find modules for LibFindMacros #10928
We are using "LIBFOO" prefixes for `LIBFOO_INCLUDE_DIRS` etc, and
therefore need to use this for the PREFIX with LibFindMacros also, so
that `"${${PREFIX}_FIND_VERSION}"` gets handled there properly.

The alternative would be to either manually handle/set the upper/mixed case
variants of those variable additionally, which is not as easy.

Keeping the existing names is useful for packagers.

Before this the version requirements with
`find_package(Unibilium 2.0 REQUIRED)` was not handled (a49cf5126), and
it prepares for using a required version with libvterm
(initially/wrongly ported in 1896c72a5).
2019-09-06 14:39:41 -07:00
Daniel Hahler
8db62ac57d
build: cmake: GetCompileFlags: include CMAKE_C_FLAGS (#10957)
Calls `GetCompileFlags` from `src/nvim` directory, to include
`--coverage` (and any others).
2019-09-06 20:36:05 +02:00
Daniel Hahler
28219534eb get_compile_flags: also look at target properties 2019-08-15 19:42:46 +02:00
Daniel Hahler
90e44ecf11
build: link libraries by full path (for luv.so) (#10661)
Use "luv" as imported library to work around "-lluv" being used due to
missing SONAME.

Fixes https://github.com/neovim/neovim/issues/10407.
Ref: https://gitlab.kitware.com/cmake/cmake/issues/19578
Ref: https://github.com/NixOS/nixpkgs/issues/64400#issuecomment-516557253
2019-08-12 18:22:02 +02:00
Daniel Hahler
1896c72a54
build: port FindLibVterm to LibFindMacros (#10395) 2019-08-08 06:39:18 +02:00
Daniel Hahler
6ebe476675
build: clean up / remove X_USE_STATIC (#10713)
This was discouraged (as an option) in 5b5d353151 [1], not enabled/used by
default, and not working according to the comment in local.mk.example.

Taken out of https://github.com/neovim/neovim/pull/10395.

1: https://github.com/neovim/neovim/pull/2465
2019-08-07 22:19:55 +02:00
Daniel Hahler
a49cf51269
build: require unibilium>=2.0 (#10681)
* build: require unibilium>=2.0

This also ports FindUnibilium to LibFindMacros, which was planned
anyway, and makes the version check easier.

With an older Unibilium our fallback code in `terminfo_from_builtin`
will not work (because it assumes the new data structures from 2.0.0 [1]),
and nvim would crash later because of `ut` being NUL.

1: 42f3cdd284
2019-08-03 15:20:28 +02:00
Daniel Hahler
431cf56e2f
ci: RunTests: ensure that the logfile gets displayed (#10597)
This is meant to help with test failures where e.g. `busted` itself might
crash or get killed.

Ref: https://github.com/neovim/neovim/issues/10182#issuecomment-514450069
2019-07-24 18:12:55 +02:00
erw7
6614543316 test: Force $TEST_FILE to relative path [ci skip] #10535
- Always force TEST_PATH to a relative path.
- Eliminate rel_test_path. (The code simplification is worth the extra
  subdirectory below Xtest_tmpdir/.)
2019-07-19 13:51:18 +02:00
Daniel Hahler
34c6e5beaf
tests: move "busted" dir to "test" (#10518)
* tests: move "busted" dir to "test"

It is used for outputHandlers only, and clearly belongs to the tests.
Use the full module name with the `-o` option to `busted` then for
clarity.

* luacheck

* test/busted/outputHandlers/TAP.lua: use/extend upstream
2019-07-16 22:02:50 +02:00
Daniel Hahler
eb2509aef9 build: fix GetCompileFlags for CMake #10444
Ref: https://github.com/neovim/neovim/pull/10363#issuecomment-508916959
2019-07-07 13:01:38 +02:00
Daniel Hahler
0d82aaf586
build: FindLibIntl: fix warning about CMP0075 (#10427)
* build: FindLibIntl: fix warning about CMP0075

The common pattern elsewhere to set this only during the check, and here
it was not unset, resulting in a warning later (on Alpine 3.10):

    -- Found Iconv
    -- Looking for pthread.h
    CMake Warning (dev) at /usr/share/cmake/Modules/CheckIncludeFile.cmake:80 (message):
      Policy CMP0075 is not set: Include file check macros honor
      CMAKE_REQUIRED_LIBRARIES.  Run "cmake --help-policy CMP0075" for policy
      details.  Use the cmake_policy command to set the policy and suppress this
      warning.

      CMAKE_REQUIRED_LIBRARIES is set to:

        /usr/lib/libintl.so

      For compatibility with CMake 3.11 and below this check is ignoring it.
    Call Stack (most recent call first):
      /usr/share/cmake/Modules/FindThreads.cmake:105 (CHECK_INCLUDE_FILE)
      CMakeLists.txt:482 (find_package)
    This warning is for project developers.  Use -Wno-dev to suppress it.

    -- Looking for pthread.h - found

* build: remove lists / REMOVE_ITEM around check_c_source_compiles
2019-07-05 12:19:13 +02:00
Daniel Hahler
5835398152
Merge pull request #10414 from blueyed/luacheck
Improve luacheck integration, fix more issues.
2019-07-04 15:21:44 +02:00
Daniel Hahler
f668f0afb2
build: FindLuaJit: handle luajit-2.1 include path suffix (#10418) 2019-07-04 15:19:25 +02:00
Daniel Hahler
32361a1245 Improve luacheck setup [skip appveyor]
- Move .luacheckrc to root, add read_globals=vim
- Simplify lualint target, run it on all lua files
- Lint preload.lua, but ignore W211
- Remove testlint target, included in lualint (and lint)
- Clean up .luacheckrc
2019-07-04 12:29:54 +02:00
Daniel Hahler
740fb337dd
build: fix warning with passively available libintl (#10380)
Since 0364f51 it would display a warning.
2019-07-01 03:32:52 +02:00
Daniel Hahler
0364f517bb
build: update cmake/LibFindMacros.cmake (#10355)
Source: d6b5e94625/LibFindMacros.cmake
2019-06-30 01:12:38 +02:00
Daniel Hahler
9875372607
build: FindLibLUV: use PkgConfig (#10359)
Apparently forgotten in c83926cd0.

- Also LIMIT_SEARCH was never used.
- Also add LIBLUV_DEFINITIONS, as used with other Find modules.
2019-06-29 21:49:49 +02:00
Daniel Hahler
c207095445
build: CMake: do not set CMP0059 to old (#10363)
Keeps using add_definitions for compatibility with older CMake.

Newer CMake (3.12) would have `add_compile_definitions`, but it is not
required, since `add_defitions` was meant to be used for
compile/preprocessor definitions initially anyway.

Ref: https://github.com/neovim/neovim/pull/4389
2019-06-29 20:37:48 +02:00
Daniel Hahler
39ba35b38d cmake/RunTests.cmake: fix TEST_TAG/TEST_FILTER [ci skip] #10371
Followup to f1f9a2f97.
The mentioned example there did not work after all, likely due to
changing quoting during PR review.
2019-06-29 19:15:48 +02:00
Daniel Hahler
6765bbc651
build: CMake: remove usage of USE_BUNDLED_X in main project (#10354)
The variables are not meant to be defined there really, but only with
the third-party project.

Using them, e.g. with the following, would actually result in libvterm
not being found then:

    make CMAKE_EXTRA_FLAGS="-DUSE_BUNDLED_LIBVTERM=ON" \
      DEPS_CMAKE_FLAGS="-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LIBVTERM=ON"

In https://github.com/neovim/neovim/pull/6357 they were renamed to
`USE_BUNDLED_X` from `X_USE_BUNDLED`, but the above reasoning applies
to the old names, too.

Internally `CMAKE_PREFIX_PATH` is used to add the built/bundled third
party packages for `find_package`, so there is no reason to e.g. query
the values via `load_cache` for example from the third-party project.
2019-06-28 02:02:19 +02:00
Daniel Hahler
35b959c600
CMakeLists: remove/cleanup passing of CMAKE_SYSTEM_NAME (#10351)
Just set it from `${CMAKE_HOST_SYSTEM_NAME}` directly, instead of passing it
from the main CMake file (CMAKE_SYSTEM_NAME defaults to it, but is empty
in script mode).

Initially added in 9ce81f7b2, but then even used with unrelated commands
(that do not use RunTests.cmake, e.g. 221f6fffa).
2019-06-27 20:14:00 +02:00
Daniel Hahler
93297cfc6f
tests: busted: do not use "--lua" (#10303)
The feature is very rudimentary [1], and causes problems when not using
bundled deps, where it might then fail to find `busted.runner` due to
this.

E.g. with "-DUSE_BUNDLED=OFF -DUSE_BUNDLED_LUAROCKS=ON":
`.deps/usr/bin/busted` contains `exec '/usr/bin/luajit' -e …`, i.e. it
run luajit with adjusted lpath etc.
But using `--lua /usr/bin/luajit` then causes this `busted` wrapper to
be replaced with just `/usr/bin/luajit`, i.e. it is missing the adjusted
lpath then.

1: 9eb6c9cf93
2019-06-24 08:47:02 +02:00
Daniel Hahler
f1f9a2f97b
tests: improve RunTests.cmake (#10239)
- allow for passing in BUSTED_ARGS via env
- quote values of TEST_TAG/TEST_FILTER

  Previously TEST_FILTER="'foo bar'" was required.

This allows for:

    make functionaltest TEST_FILE=test/functional/terminal/tui_spec.lua \
      BUSTED_ARGS="--no-keep-going --shuffle" \
      TEST_FILTER="TUI background color handles"

* RunTests.cmake: BUILD_DIR for Xtest files, isolated TMPDIR

Assume relative path for given TEST_PATH.
2019-06-22 06:44:52 +02:00
Daniel Hahler
aa090f9801
cmake: fix usage of find_package_handle_standard_args (#10288)
The package argument is case sensitive, which is important to handle
X_FIND_REQUIRED properly, i.e. error out early if it is not found:

    CMake Error at /usr/share/cmake-3.14/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
      Could NOT find Unibilium (missing: UNIBILIUM_LIBRARY UNIBILIUM_INCLUDE_DIR)

Otherwise it would continue until:

    CMake Error: The following variables are used in this project, but they
    are set to NOTFOUND.
    Please set them or make sure they are set and tested correctly in the
    CMake files:
    UNIBILIUM_INCLUDE_DIR (ADVANCED)

Quickly checked via `rg 'find_package_handle_standard|find_package.*REQUIRED' -I | sort`.

Ref: https://gitlab.kitware.com/cmake/cmake/issues/19413
2019-06-21 03:48:46 +02:00
Daniel Hahler
b98b1168d8 ci: Travis: remove obsolete cmake file
Added in f65614fb1, forgot to be removed in 55682710a.
2019-06-17 02:00:58 +02:00
George Zhao
c83926cd0a lua: introduce vim.loop (expose libuv event-loop) #10123
Co-authored-by: Andrey Popp <8mayday@gmail.com>

closes #9546
closes #10084
2019-06-10 14:13:18 +02:00
James McCoy
c2343180d7
Remove support for using jemalloc instead of the system allocator
There was never any investigation done to determine whether using
jemalloc was actually a net benefit for nvim.  It has been a portability
limitation and adds another factor to consider when triaging issues.
2019-01-19 18:09:52 -05:00
Justin M. Keyes
6b3fa0689c build: remove cmake/GenerateHelptags.cmake.in
This file wasn't used since e1cc0fe996.  That may have been
accidental, but it's not needed anymore anyway.  Also the "Workaround
for hanging" is no longer relevant.
2019-01-04 02:25:17 +01:00