Commit Graph

204 Commits

Author SHA1 Message Date
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
Justin M. Keyes
221f6fffad runtime/lua/vim/compat.lua
ref #9280
Introduce the `vim.compat` module, to help environments with system Lua
5.2+ run the build/tests. Include the module implicitly in all tests.

ref #8677
legacy `vim` module:
    beep
    buffer
    command
    dict
    eval
    firstline
    lastline
    line
    list
    open
    type
    window
2018-12-20 11:57:30 +01:00
Justin M. Keyes
f95e0ae926
build: adjust some messages (#9087) 2018-10-06 18:45:34 +02:00
Justin M. Keyes
1cc3b32f4c build/test: skip empty TEST_TAG, TEST_FILTER
- Empty "--tags=", "--filter=" prevents TEST_FILE from running.
- Fix another bug: TEST_FILTER overwrote TEST_TAG.
2018-06-16 02:12:35 +02:00
b-r-o-c-k
d87e5d7016 build/msvc: Add libiconv to bundled dependencies 2018-06-09 20:50:02 -05:00
Justin M. Keyes
420379330e cmake/FindLibIntl.cmake: handle passive case explicitly
If check_c_source_compiles() succeeded (HAVE_WORKING_LIBINTL is set)
then the result of find_xxx() doesn't matter. This happens on systems
(linux+glibc) where libintl is available passively.

This allows `find_package(LibIntl REQUIRED)` to work and will still
correctly fail (REQUIRED) on systems lacking libintl.
2018-06-06 00:58:57 +02:00
erw7
d337965e09 Change to not use library prefix on MSVC 2018-05-23 22:12:37 +09:00
b-r-o-c-k
be67d926c5 build/msvc: Add libintl to bundled dependencies (#8163) 2018-03-24 17:58:32 +01:00
b-r-o-c-k
d99f8feea3 build/msvc: Fix name of import library 2018-02-28 19:37:58 -06:00
Daniel Hahler
ef0a07c073 cmake/LuaHelpers.cmake: check_lua_module: use 'lua -l'
It only shortens the traceback a bit for when a module is not found
though, only removing the "(command line):1: in main chunk" (with
lua5.2).
2018-02-22 01:22:26 +01:00
Daniel Hahler
8851903434 cmake/LuaHelpers.cmake: check_lua_module: display errors
This helps to figure out what the problem is, e.g. in my case I have
lua51-mpack installed to be used with luajit, but it is broken (missing
libmpack).

With this patch you get:

    -- Checking Lua interpreter /usr/bin/luajit
    /usr/bin/luajit: error loading module 'mpack' from file '/usr/lib/lua/5.1/mpack.so':
            libmpack.so.0: cannot open shared object file: No such file or directory
    stack traceback:
            [C]: at 0x55fcf0166fb0
            [C]: in function 'require'
            (command line):1: in main chunk
            [C]: at 0x55fcf01188a0
    -- [/usr/bin/luajit] The 'mpack' lua package is required for building Neovim
    -- Checking Lua interpreter /usr/bin/lua5.1
    /usr/bin/lua5.1: error loading module 'mpack' from file '/usr/lib/lua/5.1/mpack.so':
            libmpack.so.0: cannot open shared object file: No such file or directory
    stack traceback:
            [C]: ?
            [C]: in function 'require'
            (command line):1: in main chunk
            [C]: ?
    -- [/usr/bin/lua5.1] The 'mpack' lua package is required for building Neovim
    -- Checking Lua interpreter /usr/bin/lua5.2
    /usr/bin/lua5.2: (command line):1: module 'mpack' not found:
            no field package.preload['mpack']
            no file '/usr/share/lua/5.2/mpack.lua'
            no file '/usr/share/lua/5.2/mpack/init.lua'
            no file '/usr/lib/lua/5.2/mpack.lua'
            no file '/usr/lib/lua/5.2/mpack/init.lua'
            no file './mpack.lua'
            no file '/usr/lib/lua/5.2/mpack.so'
            no file '/usr/lib/lua/5.2/loadall.so'
            no file './mpack.so'
    stack traceback:
            [C]: in function 'require'
            (command line):1: in main chunk
            [C]: in ?
    -- [/usr/bin/lua5.2] The 'mpack' lua package is required for building Neovim
    -- Checking Lua interpreter /usr/bin/lua
    /usr/bin/lua: (command line):1: module 'mpack' not found:
            no field package.preload['mpack']
            no file '/usr/share/lua/5.3/mpack.lua'
            no file '/usr/share/lua/5.3/mpack/init.lua'
            no file '/usr/lib/lua/5.3/mpack.lua'
            no file '/usr/lib/lua/5.3/mpack/init.lua'
            no file './mpack.lua'
            no file './mpack/init.lua'
            no file '/usr/lib/lua/5.3/mpack.so'
            no file '/usr/lib/lua/5.3/loadall.so'
            no file './mpack.so'
    stack traceback:
            [C]: in function 'require'
            (command line):1: in main chunk
            [C]: in ?
    -- [/usr/bin/lua] The 'mpack' lua package is required for building Neovim
    CMake Error at CMakeLists.txt:459 (message):
      A suitable Lua interpreter was not found.

While this makes it more verbose for the expected error case ("module
'mpack' not found"), the behavior before this patch hides too much.
This is the old output:

    -- Checking Lua interpreter /usr/bin/luajit
    -- [/usr/bin/luajit] The 'mpack' lua package is required for building Neovim
    -- Checking Lua interpreter /usr/bin/lua5.1
    -- [/usr/bin/lua5.1] The 'mpack' lua package is required for building Neovim
    -- Checking Lua interpreter /usr/bin/lua5.2
    -- [/usr/bin/lua5.2] The 'mpack' lua package is required for building Neovim
    -- Checking Lua interpreter /usr/bin/lua
    -- [/usr/bin/lua] The 'mpack' lua package is required for building Neovim
    CMake Error at CMakeLists.txt:459 (message):
      A suitable Lua interpreter was not found.

This is for when the whole configuration runs (i.e. after `make
distclean`), afterwards only one Lua interpreter gets checked only.
2018-02-22 01:22:19 +01:00
Justin M. Keyes
674cb2afde cmake/GetCompileFlags: remove duplicate include dirs
Reduces noise in :version message.
2018-02-14 09:57:58 +01:00
Matthieu Coudron
6a826fce91 busted: explicit LUA_PATH to test scripts (#7864)
in case LUA_PATH does not contain `./?.lua`, busted can not load lua test scripts.
(for instance on nixos). Thus we make it explicit.
2018-01-20 14:43:16 +01:00
Franklin Mathieu
3ce97879d0 cmake,bsd: Fix mandir to saner defaults. (#7417)
closes #7239

The old behaviour was to set CMAKE_INSTALL_MANDIR to /usr/local/man
when MANPREFIX wasn't defined. This caused mismatching installation
paths when the installation prefix wasn't /usr/local.

This fix explicitely checks that the prefix is /usr/local to change
the value of CMAKE_INSTALL_MANDIR, and uses the default behaviour
otherwise, as /usr/local is the exception rather than the norm
(as per man hier(7)).
2017-10-21 02:36:26 +02:00
James McCoy
235fda5f86 Stub ngettext when libintl isn't available
This should have been included in #6547 as part of vim-patch:7.4.2152.

Closes #7352
2017-10-03 14:54:50 -04:00
Ryan Prichard
7f22a27a10 win: integrate winpty (WIP)
Handling of process exit is still broken.  It detects the moment when the
child process exits, then quickly stops polling for process output.  It
should continue polling for output until the agent has scraped all of the
process' output.  This problem is easy to notice by running a command like
"dir && exit", but even typing "exit<ENTER>" can manifest the problem --
the "t" might not appear.

winpty's Cygwin adapter handles shutdown by waiting for the agent to close
the CONOUT pipe, which it does after it has scraped the child's last
output.  AFAIK, neovim doesn't do anything interesting when winpty closes
the CONOUT pipe.
2017-08-16 09:13:43 +02:00
Justin M. Keyes
5c08c8c009 test: force LC_ALL=en_US.UTF-8
Tests that check localized error messages need a stable locale, else
errors like this occur:

    [  FAILED  ] 2 tests, listed below:
    [  FAILED  ] ...npack/file/vim/neovim/test/functional/eval/null_spec.lua @ 29: NULL list is accepted as an empty list by writefile()
    ...npack/file/vim/neovim/test/functional/eval/null_spec.lua:30: Expected objects to be the same.
    Passed in:
    (string) '
    E484: Cannot open file Xtest-functional-viml-null'
    Expected:
    (string) '
    E484: Can't open file Xtest-functional-viml-null'

    stack traceback:
            ...npack/file/vim/neovim/test/functional/eval/null_spec.lua:30: in function <...npack/file/vim/neovim/test/functional/eval/null_spec.lua:29>

    [  FAILED  ] ...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua @ 81: :write errors out correctly
    ...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua:97: Expected objects to be the same.
    Passed in:
    (string) 'Vim(write):E510: Cannot make backup file (add ! to override)'
    Expected:
    (string) 'Vim(write):E510: Can't make backup file (add ! to override)'

    stack traceback:
            ...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua:97: in function <...k/file/vim/neovim/test/functional/ex_cmds/write_spec.lua:81>

     10 SKIPPED TESTS
     2 FAILED TESTS
    -- Output to stderr:
    2017/07/29 00:41:32 ERROR 31133/open_log_file:170: Logging to stderr, failed to open $NVIM_LOG_FILE: Xtest-startup-xdg-logpath/nvim/log
    2017/07/29 00:41:32 WARN  31133/call_set_error:815: RPC: ch 1 was closed by the client

    CMake Error at /home/shlomif/Download/unpack/file/vim/neovim/cmake/RunTests.cmake:50 (message):
      Running functional tests failed with error: 1.

    FAILED: CMakeFiles/functionaltest
    cd /home/shlomif/Download/unpack/file/vim/neovim/build && /usr/bin/cmake -DBUSTED_PRG=/home/shlomif/Download/unpack/file/vim/neovim/.deps/usr/bin/busted -DLUA_PRG=/home/shlomif/Download/unpack/file/vim/neovim/.deps/usr/bin/luajit -DNVIM_PRG=/home/shlomif/Download/unpack/file/vim/neovim/build/bin/nvim -DWORKING_DIR=/home/shlomif/Download/unpack/file/vim/neovim -DBUSTED_OUTPUT_TYPE=nvim -DTEST_DIR=/home/shlomif/Download/unpack/file/vim/neovim/test -DBUILD_DIR=/home/shlomif/Download/unpack/file/vim/neovim/build -DTEST_TYPE=functional -DSYSTEM_NAME=Linux -P /home/shlomif/Download/unpack/file/vim/neovim/cmake/RunTests.cmake
    ninja: build stopped: subcommand failed.
    Makefile:102: recipe for target 'functionaltest' failed
    make: *** [functionaltest] Error 1
2017-07-29 14:21:58 +02:00
James McCoy
35fad15c89 Prefer the static jemalloc library by default on OSX
When neovim is dynamically linked against jemalloc on OSX, users are
hitting the deadlock described in jemalloc/jemalloc#895.
2017-07-07 14:33:54 -04:00
Justin M. Keyes
f34befe74c Merge #6789 from ZyX-I/lua-path
lua: Add paths from &runtimepath to package.path and package.cpath
2017-06-27 02:29:15 +02:00
Justin M. Keyes
a49c92fc5b test: Set $NVIM_LOG_FILE to test-local path
- Do not delete it: may need to inspect it after tests finished.
- Avoids writing to stderr in cases where the test-local $XDG_DATA_HOME
  was not created yet.
2017-06-07 00:27:26 +02:00
Justin M. Keyes
a84926763f install: bsd: install manpages to /usr/local/man
https://svnweb.freebsd.org/ports/head/editors/neovim/Makefile?revision=428479&view=markup#l28

Closes #6771
2017-05-27 21:42:10 +02:00
ZyX
58f6ef50a8 ci: Also lint lua code in src/nvim/lua 2017-05-25 16:50:06 +03:00
ZyX
5b84c21182 cmake: Rename RunTestsLint to RunLuacheck 2017-05-25 16:34:04 +03:00
ZyX
09f849b600 Merge branch 'master' into luaviml'/lua 2017-05-08 15:43:45 +03:00
Edd Barrett
53b38251bb build: OpenBSD: libuv does not use KVM, do not link to it. (#6663) 2017-05-03 20:16:06 +02:00
ZyX
3ea2063e07 cmake: Add FindLua.cmake
Copied from CMake v3.8.0-707-g0419ecb, modified one include() line.
2017-04-10 23:10:55 +03:00
Nikolai Aleksandrovich Pavlov
3a6b8c28c8 cmake: Use archive instead of downloading *.json files (#6482) 2017-04-09 03:28:48 +02:00
ZyX
c61858a997 cmake: Replace RunLint.cmake with code in src/nvim/CMakeLists.txt
This also removes LINT_FILE environment variable, other then that functionality 
is kept. It is expected that developers needing partial linting will use `make 
lint`, touching interesting file before (if not done already by writing to 
them).
2017-03-31 16:04:18 +03:00
ZyX
24fd125893 cmake: Allow failing to download small suppress files 2017-03-31 16:04:18 +03:00
ZyX
8204eaea7f cmake: Make Download.cmake check for errors
Copying from third-party/cmake/DownloadAndExtractFile.cmake.
2017-03-31 16:04:17 +03:00
ZyX
030c0588a0 cmake: Add clint target to build Makefile
Allows linting only modified files and linting multiple files in
parallel. In the current state is rather slow because errors.json is
a 6 MiB file and needs to be reparsed each time.

Results on my system (6-core):

    # In build dir, actually parallel
    make -j5 clint  241.24s user 8.39s system 334% cpu 1:14.74 total
    # In root, one process
    make -j5 clint  60.69s user 0.37s system 93% cpu 1:05.19 total

In both cases download time included.

That is not well for travis (though I would keep travis as-is because
new variant will fail before checking all files), but already good
enough for regular development: total times are nearly identical and
this is the *full* build, further `make -C build clint` will check only
modified files.
2017-03-31 16:04:17 +03:00
Justin M. Keyes
1ea9ebf112 test: Use workspace-local temp directory.
Closes #6291
2017-03-30 02:55:00 +02:00
Daniel Hahler
b60e5c85ad cmake: USE_BUNDLED_X instead of X_USE_BUNDLED (#6357) 2017-03-25 23:02:20 +01:00
Justin M. Keyes
30826cb2d6 build: oldtest target: TEST_FILE, NVIM_PRG (#6098)
- Add support for TEST_FILE to the `oldtest` target, for consistency
  with the busted/lua tests.
  Caveat: with the busted/lua tests TEST_FILE takes a full path, whereas
  for `oldtest` it must be "test_foo.res".
- Add support for NVIM_PRG, again so that all test-related targets are
  consistent.
- Use consistent name for NVIM_PRG. But still need to support NVIM_PROG
  for QuickBuild CI.

Note: The `oldtest` target is driven by the top-level Makefile, because
it requires a TTY. CMake 3.2 added a USES_TERMINAL flag to
add_custom_target(). But we support CMake 2.8...

    add_custom_target(oldtest
      COMMAND make clean
      COMMAND make NVIM_PRG=$<TARGET_FILE:nvim> $ENV{MAKEOVERRIDES}
      DEPENDS nvim
      WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/testdir"
      USES_TERMINAL true
    )
2017-02-12 01:02:54 +01:00
Justin M. Keyes
bbfdb84ae1 build: Do not force busted into front of $PATH
This was a workaround from long ago, but it doesn't seem to be needed
anymore. And it breaks the $PATH on the Windows build (AppVeyor CI).

After this change python3 (and 2) is correctly detected on AppVeyor CI.

References #5946
2017-02-04 11:07:49 +01:00
John Szakmeister
53eddb881c build: prevent in-tree builds for the time being, as it's not supported 2016-10-11 20:20:31 -04:00
Rui Abreu Ferreira
9ce81f7b2b functionaltest: Create lua helper for os.tmpname()
In Windows Lua's os.tmpname() returns relative paths starting with \s,
prepend them with $TEMP to generate a valid path.

In OS X os.tmpname() returns paths in '/tmp' but they should be in
'/private/tmp'. We cannot use os_name() for platform detection because
some tests use tempname() before nvim is spawned, instead use one of the
following:

1. Set SYSTEM_NAME environment variable before calling the tests, it
   is set from CMAKE_SYSTEM_NAME(i.e. uname -s or 'Windows')
2. Call uname -s
3. Assume windows
2016-08-31 11:32:28 +01:00
Tommy Allen
966f1abd8b tests: Set env variables in RunTests.cmake
- NVIM_RPLUGIN_MANIFEST
- XDG_CONFIG_HOME
- XDG_DATA_HOME
2016-08-17 16:22:21 -04:00
Rui Abreu Ferreira
db7fdcd0ba MSVC: Build third-party dependencies as release DLLs
Using /MT was causing issues when building luarocks, revert it, use the
dynammic runtime and generate release DLLs for the dependencies.
Some refactoring was required because for linking cmake looks for the
import libraries (.lib) but on runtime executables we need the .dll files
to be in the same folder.

The DLLs are placed in the bin/ folder in order for nvim.exe to run
during the build and tests. The install target installs the DLLs with
the nvim binary - uses GetPrerequisites to find runtime DLLs.

Some minor issues that required adjustments:
- [MSVC] FindMsgpack.cmake now looks for msgpack_import.lib instead of
  msgpack.lib
- The lua-client fails to find libuv.lib, instead it looks for uv.lib,
  added second copy of the file to the install command.
- [MSVC] CMAKE_BUILD_TYPE affects the output paths, default to Release.

Part of these changes are credited to @jasonwilliams200OK who fixed the
third-party recipes to consistently use the same build type.
2016-08-07 21:57:28 +01:00
Josh Triplett
fc98d2d96d Pass busted the path to the detected Lua interpreter
Otherwise, busted may run a different interpreter than the one we
detected, without the capabilities we expect.  (For instance, we might
have detected the luajit interpreter, but busted might run the lua
interpreter, without the ffi module.)
2016-07-13 00:37:50 -07:00
Rui Abreu Ferreira
d5c89b1896 cmake: Allow building without Luajit
By default Neovim searched a Luajit instalation and linked against
the luajit library.

In practice Neovim only requires luajit to run the unit tests. All other
targets only require lua and the correct lua modules. This commit:

1. Remove the strict dependency on Luajit
2. Makes the unittest target depend on the lua 'ffi' module.
   If the module is not available the target is not enabled
   and a message is displayed.
2016-05-19 17:55:19 +01:00
KillTheMule
360d0513d1 Satisfy testlint.
For that, make luatest ignore the preload.lua files.
2016-04-28 19:30:17 +02:00
Björn Linse
5c1597cad1 cmake: allow linting a specific file
For instance to only lint "edit.c"
make lint LINT_FILE="src/nvim/edit.c"
2016-02-25 11:31:34 +01:00
James McCoy
1d1574e0ac cmake: Use find_package(Msgpack)'s version in pkg_search_module
Avoid duplicating information by using the Msgpack_FIND_VERSION variable
exported by find_package() inside FindMsgpack's pkg_search_module call.
2016-02-05 21:23:19 -05:00
James McCoy
79e7c03f91 cmake: msgpack: Check all lib names per directory
By default, find_library() searches all directories for one possible
name and then looks for the next name.  To make sure we're building
against the same headers and libraries, look for all names in a
directory before moving to the next one.
2016-02-05 19:46:53 -05:00
James McCoy
2be51f5e85 cmake: msgpack: Add more thorough version check
In 33bc332, version constraints were added to pkg_search_module(), but
that only affects the set of directories searched by
find_library()/find_path().

Once the header directory is found, parse the version from
version_master.h so it can be checked by the find_package() call in the
root CMakeLists.txt.
2016-02-05 19:46:53 -05:00
James McCoy
33bc33274a cmake: msgpack: Ensure at least version 1.0 is found
Neovim's code relies on functionality introduced in msgpack-c 1.0.0
(at least MSGPACK_OBJECT_FLOAT enum value), so enforce that minimum
version.
2016-01-28 09:01:05 -05:00
James McCoy
feb70192a8 cmake: Search for both libmsgpackc and libmsgpack #4075
libmsgpack was the old C++ library provided by msgpack-c.  The C library
is libmsgpackc.

The C++ support became header-only, but there was a bug
(msgpack/msgpack-c#395) wherein using msgpack-c's CMake build system
would only install libmsgpack instead of libmsgpackc.

Searching for both libraries, but preferring libmsgpackc, allows for
building against older msgpack-c releases and prepares for the upcoming
msgpack-c release which fixes the aforementioned issues.

Signed-off-by: James McCoy <jamessan@jamessan.com>
2016-01-22 23:03:14 +01:00
Rui Abreu Ferreira
655f1b7513 MinGW: Add libluajit-5.1 lib name to FindLuaJit 2015-12-02 23:07:22 -05:00
Rui Abreu Ferreira
f22dfeb00d cmake: Don't use check_library_exists for Win32 API libraries
When building for X86 the CMake check_library_exists always fails to find
functions from the Win32 API due to name mangling conventions. The convention
for API functions is __stdcall and the CMake test code assumes __cdecl. Since
these are libraries from the Windows API we can simply link against the
libraries without checking for the functions.
2015-11-29 23:48:01 -05:00
Marco Hinz
818f926eb0 Tests: add luacheck for linting tests
Source: https://github.com/mpeterv/luacheck
Docs:   http://luacheck.readthedocs.org/en/0.12.0/index.html

Run via "make testlint".
2015-11-23 13:57:21 +01:00
Michael Reed
2fbcc9ab76 Be more explicit about the lack of X11 integration
I don't want anyone getting the idea that the `-X` flag they might have
used has anything to do with why the `+` is working for them
2015-11-10 20:10:55 -05:00
Florian Walch
90909e9362 CMake: Force use of project directory to look for Git data.
Before this change, building Neovim would recursively search parent
directories for a .git directory. If Neovim was downloaded as a tarball
(i.e. without a .git directory), but placed in a subdirectory of
a Git repository, this caused a CMake error. Such a situation could
occur when packaging Neovim, for example.

Unfortunately, the previous attempt in #3317 did not fix this problem.
2015-11-01 16:19:52 +01:00
Rui Abreu Ferreira
b50cc42eb7 Windows: Link against libraries libuv needs on Windows. 2015-09-09 17:44:22 -04:00
Rui Abreu Ferreira
73db02b99c MSCV: FindLibUV: fix libname. #3261 2015-08-31 03:18:04 -04:00
Rui Abreu Ferreira
d00d37b486 Windows: FindLuaJit: fix libname. #3262 2015-08-31 03:16:35 -04:00
ZyX
57eaefbb23 ci: Use error suppression in place of ignored files list. #3185
Fixes #3174
2015-08-20 23:40:15 -04:00
Florian Walch
d2eb4a9346 Travis: Refactor CI files, use container infrastructure.
* Split build steps to utilize the Travis build lifecycle.
 * Move shell code from `.travis.yml` into Bash files in `.ci/`,
   one file for each step of the Travis build lifecycle.
 * Use configuration variables in `.travis.yml` to change
   build behavior (e.g. build 32-bit with `BUILD_32BIT=ON`).
 * Keep all configuration in environment variables in
   `.travis.yml`. In scripts, concatenate environment variables
   according to configuration to change to different behavior.
 * Add GCC 5 builds for Linux.
 * Use Travis's caching feature [1] for third-party dependencies
   and pip packages.
 * Allow failures MSan, as the errors it reports have to be
   fixed first.

Valgrind is still disabled, but can be enabled by setting
`env: VALGRIND=ON` for a job in `.travis.yml`.

[1] http://docs.travis-ci.com/user/caching
2015-07-08 07:42:16 -03:00
Michael Reed
3c2fa1767b cmake: Make make lint less verbose
It unnecessarily complicates spotting linter errors, as they're usually
surrounded by a bunch of lines saying "Done processing ... ".
2015-06-27 15:21:09 -04:00
Thomas Anderson
9995f15a98 CMake: Fix helptags generation when prefix is not /usr. #2741 2015-06-09 01:12:08 -04:00
Florian Walch
6609a545ad CMake: Workaround for hanging helptags generation. #2801
Piping input into nvim causes the helptags generation to hang. For
example, the following does not work:

    yes | nvim -c "helptags ."

The helptags are generated during installation with a command similar
to the one above, using CMake's execute_process to call nvim.
As execute_process does not use an intermediate shell, the following
will cause the installation to hang:

    yes | make install

pacaur, an Arch Linux package helper, uses a similar command to
install packages [1], and thus can currently not be used to install
Neovim.

This commit adds a workaround to GenerateHelptags.cmake to circumvent
this problem.

[1] 22c00a3d05/pacaur (L825)
2015-06-06 14:29:33 +03:00
Michael Reed
aa1d9a1807 Build: Use GNUInstallDirs, install man pages #2649
For now, only install man pages matching "nvim*.1": we don't want to
install xxd.1 as it might conflict with that of a user's Vim
installation.

closes #1826

Reviewed-by: Florian Walch <florian@fwalch.com>
Helped-by: John Szakmeister <john@szakmeister.net>
2015-05-17 14:57:43 -04:00
Rui Abreu Ferreira
f65614fb1c Travis: Add Mingw third-party builds
- Build third-party/ in Travis using mingw
- Import mingw-w64 cmake toolchain
2015-05-15 17:55:02 +03:00
Florian Walch
2446b997c6 CMake: Remove duplicate PkgConfig lookups. 2015-04-29 22:26:55 +03:00
Florian Walch
07d4142a18 CMake: Refer to Unibilium instead of LibUnibilium. 2015-04-29 22:26:55 +03:00
Thiago de Arruda
0487ea9f64 build: Improve GenerateHelptags.cmake failure message
Some errors during helptags can be caused by duplicate/wrong tags after
documentation cleanup. Suggest the removal of the "doc" directory.
2015-04-13 12:29:54 -03:00
Thiago de Arruda
8a1a9b9558 deps: Add jemalloc as an optional dependency
Jemalloc will be used if the cmake option `USE_JEMALLOC` is enabled(which is the
default). To avoid trouble with clang's ASAN, it is disabled by default if the
`SANITIZE` option is enabled.

Since jemalloc has thread cache for small objects, it fills the gap created by
removing klib memory pools.

The `xstrdup` funciton(memory.c) had to be reimplemented on top of `xmalloc` to
make it work with a custom allocator.
2015-04-13 08:22:59 -03:00
Thiago de Arruda
1ee7ca7bc0 test: Improve functional test debuggability and efficiency
- Read TEST_TAG/TEST_FILTER env vars from cmake/RunTests.cmake. Setting these
  environment variables will pass --tags/--filter to busted, which can used to
  filter which tests are executed.
- Remove calls to nvim msgpack-rpc API outside tests. This removes the
  requirement of having a static `clear` call in test/functional/helpers.lua
- Use the new busted command-line option "--lazy" to ensure the setup/teardown
  hooks are only executed when a suite runs at least one test.

Now its possible to run/debug a single test like this:

```sh
TEST_FILTER='some test string' make test
```

Which will only run tests containing "some test string" in the title.
Another option is:

```sh
TEST_TAG=some-tag make test
```

After putting #some-tag into the test title. This also improves debugging
experience because there will be no unnecessary gdbserver instances whe GDB=1 is
passed.
2015-03-24 12:46:15 -03:00
John Szakmeister
afae3e25d5 build: add support for running the tests in junit format
This requires a couple of extra modules that are not installed by
default, and it requires capturing stdout of the tests--otherwise CMake
output is intermixed with the XML output of busted.
2015-03-21 09:47:49 -04:00
John Szakmeister
d8ef23849a tests: prevent busted from reloading the ffi module and others
It turns out that Busted started cleaning the environment in 2.0rc5 as a
result of Olivine-Labs/busted#62.  This, in turn, caused the ffi module
to be reloaded for each spec file, and LuaJIT doesn't appreciate it.
The net effect is an assertion error in LuaJIT.

By using the --helper feature of Busted, we can pre-load some modules
ahead of Busted and prevent it from reloading them--making LuaJIT happy
again.
2015-03-01 15:25:39 -05:00
Thiago de Arruda
81a346553c deps: Add libvterm to the project dependencies
libvterm is a terminal emulation library with abstract display. It will be used
to implement builtin terminal emulation into Nvim.
2015-02-28 10:41:53 -03:00
John Szakmeister
e077f4ee99 build: filter off libuv from PC_LIBUV_LIBRARIES
Otherwise, the -rdynamic that is being passed on the command line will
require a dynamic link, even though we often want a static one.
2015-02-24 14:01:25 -05:00
Thiago de Arruda
9e75b2e18b deps: Remove libtickit as a project dependency
Also update libtermkey version and fix the pkg-config search scripts.
2015-02-11 12:40:50 -03:00
Florian Walch
281cd3856c CMake: Hide stderr output for successful test runs.
Fixes #1301.
2015-02-06 13:39:23 +01:00
Florian Walch
e21f6e754d Linting: Integrate into CMake, enable by default. 2014-12-24 00:32:26 -05:00
John Szakmeister
cf1939aab3 build: only manipulate out if getting the timestamp was successful
This fixes an issue seen in #1548, though the real problem is something
different.
2014-12-03 04:56:50 -05:00