2017-12-27 11:30:23 -07:00
|
|
|
# CMAKE REFERENCE
|
|
|
|
# intro: https://codingnest.com/basic-cmake/
|
|
|
|
# best practices (3.0+): https://gist.github.com/mbinna/c61dbb39bca0e4fb7d1f73b0d66a4fd1
|
|
|
|
|
2021-10-19 19:19:33 -07:00
|
|
|
# Version should match the tested CMAKE_URL in .github/workflows/ci.yml.
|
|
|
|
cmake_minimum_required(VERSION 3.10)
|
2018-06-15 05:33:07 -07:00
|
|
|
project(nvim C)
|
2014-01-31 06:39:15 -07:00
|
|
|
|
2019-10-01 18:44:57 -07:00
|
|
|
if(POLICY CMP0065)
|
|
|
|
cmake_policy(SET CMP0065 NEW)
|
|
|
|
endif()
|
|
|
|
if(POLICY CMP0060)
|
|
|
|
cmake_policy(SET CMP0060 NEW)
|
|
|
|
endif()
|
|
|
|
|
2014-02-24 13:54:45 -07:00
|
|
|
# Point CMake at any custom modules we may ship
|
2014-11-10 17:26:01 -07:00
|
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
|
2014-02-24 13:54:45 -07:00
|
|
|
|
2016-10-11 15:35:02 -07:00
|
|
|
# We don't support building in-tree.
|
|
|
|
include(PreventInTreeBuilds)
|
|
|
|
|
2018-06-17 05:54:39 -07:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
2014-03-03 08:09:06 -07:00
|
|
|
# Prefer our bundled versions of dependencies.
|
2018-03-11 05:15:42 -07:00
|
|
|
if(DEFINED ENV{DEPS_BUILD_DIR})
|
2021-06-13 11:03:47 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
|
|
|
# pkg-config 29.2 has a bug on OpenBSD which causes it to drop any paths that
|
|
|
|
# *contain* system include paths. To avoid this, we prefix what would be
|
|
|
|
# "/usr/include" as "/_usr/include".
|
|
|
|
# This check is also performed in the third-party/CMakeLists.txt and in the
|
|
|
|
# else clause following here.
|
|
|
|
# https://github.com/neovim/neovim/pull/14745#issuecomment-860201794
|
|
|
|
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/_usr" CACHE PATH "Path prefix for finding dependencies")
|
|
|
|
else()
|
|
|
|
set(DEPS_PREFIX "$ENV{DEPS_BUILD_DIR}/usr" CACHE PATH "Path prefix for finding dependencies")
|
|
|
|
endif()
|
2018-03-11 05:15:42 -07:00
|
|
|
else()
|
2021-06-13 11:03:47 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME MATCHES "OpenBSD")
|
|
|
|
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/_usr" CACHE PATH "Path prefix for finding dependencies")
|
|
|
|
else()
|
|
|
|
set(DEPS_PREFIX "${CMAKE_CURRENT_SOURCE_DIR}/.deps/usr" CACHE PATH "Path prefix for finding dependencies")
|
|
|
|
endif()
|
2018-06-10 07:57:12 -07:00
|
|
|
# When running from within CLion or Visual Studio,
|
|
|
|
# build bundled dependencies automatically.
|
|
|
|
if(NOT EXISTS ${DEPS_PREFIX}
|
|
|
|
AND (DEFINED ENV{CLION_IDE}
|
|
|
|
OR DEFINED ENV{VisualStudioEdition}))
|
|
|
|
message(STATUS "Building dependencies...")
|
|
|
|
set(DEPS_BUILD_DIR ${PROJECT_BINARY_DIR}/.deps)
|
|
|
|
file(MAKE_DIRECTORY ${DEPS_BUILD_DIR})
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} -G ${CMAKE_GENERATOR}
|
|
|
|
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
|
|
|
|
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
|
|
|
|
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER}
|
|
|
|
-DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
|
|
|
|
-DCMAKE_C_FLAGS_DEBUG=${CMAKE_C_FLAGS_DEBUG}
|
|
|
|
-DCMAKE_C_FLAGS_MINSIZEREL=${CMAKE_C_FLAGS_MINSIZEREL}
|
|
|
|
-DCMAKE_C_FLAGS_RELWITHDEBINFO=${CMAKE_C_FLAGS_RELWITHDEBINFO}
|
|
|
|
-DCMAKE_C_FLAGS_RELEASE=${CMAKE_C_FLAGS_RELEASE}
|
|
|
|
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
|
|
|
|
${PROJECT_SOURCE_DIR}/third-party
|
|
|
|
WORKING_DIRECTORY ${DEPS_BUILD_DIR})
|
|
|
|
execute_process(
|
|
|
|
COMMAND ${CMAKE_COMMAND} --build ${DEPS_BUILD_DIR}
|
|
|
|
--config ${CMAKE_BUILD_TYPE})
|
|
|
|
set(DEPS_PREFIX ${DEPS_BUILD_DIR}/usr)
|
|
|
|
endif()
|
2018-03-11 05:15:42 -07:00
|
|
|
endif()
|
2018-06-10 07:57:12 -07:00
|
|
|
|
2015-04-18 16:20:26 -07:00
|
|
|
if(CMAKE_CROSSCOMPILING AND NOT UNIX)
|
|
|
|
list(INSERT CMAKE_FIND_ROOT_PATH 0 ${DEPS_PREFIX})
|
|
|
|
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX}/../host/bin)
|
|
|
|
else()
|
|
|
|
list(INSERT CMAKE_PREFIX_PATH 0 ${DEPS_PREFIX})
|
|
|
|
set(ENV{PKG_CONFIG_PATH} "$ENV{PKG_CONFIG_PATH}:${DEPS_PREFIX}/lib/pkgconfig")
|
|
|
|
endif()
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2015-08-27 00:56:46 -07:00
|
|
|
# used for check_c_compiler_flag
|
|
|
|
include(CheckCCompilerFlag)
|
|
|
|
|
2014-11-08 14:16:39 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
# CMake tries to treat /sw and /opt/local as extension of the system path, but
|
|
|
|
# that doesn't really work out very well. Once you have a dependency that
|
|
|
|
# resides there and have to add it as an include directory, then any other
|
|
|
|
# dependency that could be satisfied from there must be--otherwise you can end
|
|
|
|
# up with conflicting versions. So, let's make them more of a priority having
|
|
|
|
# them be included as one of the first places to look for dependencies.
|
|
|
|
list(APPEND CMAKE_PREFIX_PATH /sw /opt/local)
|
|
|
|
|
|
|
|
# Work around some old, broken detection by CMake for knowing when to use the
|
|
|
|
# isystem flag. Apple's compilers have supported this for quite some time
|
|
|
|
# now.
|
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
|
|
|
|
endif()
|
2017-01-17 08:32:41 -07:00
|
|
|
endif()
|
2015-03-26 20:30:45 -07:00
|
|
|
|
2017-01-17 08:32:41 -07:00
|
|
|
if(WIN32 OR CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
2021-02-23 21:54:12 -07:00
|
|
|
# Ignore case when comparing filenames on Windows and Mac.
|
|
|
|
set(CASE_INSENSITIVE_FILENAME TRUE)
|
2017-01-17 08:32:41 -07:00
|
|
|
# Enable fixing case-insensitive filenames for Windows and Mac.
|
2015-03-26 20:30:45 -07:00
|
|
|
set(USE_FNAME_CASE TRUE)
|
2014-11-08 14:16:39 -07:00
|
|
|
endif()
|
|
|
|
|
2018-06-01 11:17:24 -07:00
|
|
|
option(ENABLE_LIBINTL "enable libintl" ON)
|
2018-06-06 18:39:17 -07:00
|
|
|
option(ENABLE_LIBICONV "enable libiconv" ON)
|
2018-07-22 18:22:14 -07:00
|
|
|
if (MINGW)
|
|
|
|
# Disable LTO by default as it may not compile
|
|
|
|
# See https://github.com/Alexpux/MINGW-packages/issues/3516
|
|
|
|
# and https://github.com/neovim/neovim/pull/8654#issuecomment-402316672
|
|
|
|
option(ENABLE_LTO "enable link time optimization" OFF)
|
|
|
|
else()
|
|
|
|
option(ENABLE_LTO "enable link time optimization" ON)
|
|
|
|
endif()
|
2018-06-01 11:17:24 -07:00
|
|
|
|
2019-02-15 13:18:16 -07:00
|
|
|
message(STATUS "CMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX}")
|
|
|
|
|
|
|
|
# Build type.
|
2014-11-09 05:52:15 -07:00
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
2019-02-15 13:18:16 -07:00
|
|
|
message(STATUS "CMAKE_BUILD_TYPE not specified, default is 'Debug'")
|
2018-10-06 09:45:34 -07:00
|
|
|
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build" FORCE)
|
2019-02-15 13:18:16 -07:00
|
|
|
else()
|
|
|
|
message(STATUS "CMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}")
|
|
|
|
endif()
|
|
|
|
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
|
|
set(DEBUG 1)
|
|
|
|
else()
|
|
|
|
set(DEBUG 0)
|
2014-11-09 05:52:15 -07:00
|
|
|
endif()
|
2015-12-19 20:58:47 -07:00
|
|
|
# Set available build types for CMake GUIs.
|
2019-02-15 13:18:16 -07:00
|
|
|
# Other build types can still be set by -DCMAKE_BUILD_TYPE=...
|
2015-12-19 20:58:47 -07:00
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY
|
2017-06-29 00:29:40 -07:00
|
|
|
STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
|
2015-12-19 20:58:47 -07:00
|
|
|
|
2015-12-13 10:29:02 -07:00
|
|
|
# If not in a git repo (e.g., a tarball) these tokens define the complete
|
2016-10-26 06:20:00 -07:00
|
|
|
# version string, else they are combined with the result of `git describe`.
|
2014-10-04 15:32:47 -07:00
|
|
|
set(NVIM_VERSION_MAJOR 0)
|
2021-07-02 09:12:11 -07:00
|
|
|
set(NVIM_VERSION_MINOR 6)
|
2021-12-31 10:04:21 -07:00
|
|
|
set(NVIM_VERSION_PATCH 2)
|
|
|
|
set(NVIM_VERSION_PRERELEASE "-dev") # for package maintainers
|
2015-09-28 03:17:19 -07:00
|
|
|
|
2016-10-26 06:20:00 -07:00
|
|
|
# API level
|
2021-07-02 09:12:11 -07:00
|
|
|
set(NVIM_API_LEVEL 8) # Bump this after any API change.
|
2016-10-26 06:20:00 -07:00
|
|
|
set(NVIM_API_LEVEL_COMPAT 0) # Adjust this after a _breaking_ API change.
|
NVIM 0.6.0
BREAKING CHANGES
* 32-bit windows builds are no longer provided.
* **build deps**: use libuv 1.42.0 upstream for WIN32 (#15889) (f6c0a37), closes #15889
* removes Windows 7 support
* removes support for mouse and alternate buffers in TUI for Windows 8 and 8.1
* **lsp/diagnostic:** highlight groups and signs for LSP diagnostics renamed (e.g. `LspDiagnosticsDefaultWarning` to `DiagnosticWarn`) (a5bbb93)
* **diagnostic:** make DiagnosticChanged a first class autocmd (#16098) (150a592), closes #16098
* `au User LspDiagnosticsChanged` autocommands are not supported. Use the new first-class DiagnosticChanged event instead.
* **lua**: `register_keystroke_callback` => `on_key` (#15460) (69fe427)
* **note**: this breaking change was included in 0.5.1
FEATURES
* **:source, nvim_exec:** defer script item creation until s:var access (da9b0ab)
* **:source, nvim_exec:** support script-local variables (d4ed51e), closes #13143 #11507
* **lua:** add trimempty optional parameter to vim.split (5fa26e2)
* **lua:** add vim.str_utf_{start,end} (#16129) (2230b57)
* **lua:** add vim.str_utf_pos function (d752cbc)
* **lsp:** aggregate code actions from all clients (#15121) (c36df20)
* **api:** add lua C bindings for xdiff (#14536) (3d3c0c6)
* **api:** evaluate statusline string #16020 (9086938)
* **api:** named marks set, get, delete #15346 (49fdc62)
* **api:** nvim_get_chan_info: include "argv" for jobs #15537 (0603eba), closes #15440
* **api:** win_viewport also sends line_count #15613 (086631c)
* **api:** support :terminal input callback in lua (9e41e82)
* **ci:** add backport PR action (#14766) (6cc456d)
* **decorations:** allow more than one stacked highlight in a virt_text (1495d36)
* **decorations:** support virtual lines (392c658) (8d7816c)
* **diagnostic:** move vim.lsp.diagnostic to vim.diagostic and support other sources (a5bbb93)
* **diagnostic:** add 'prefix' option to open_float (#16321) (3c74ba4)
* **diagnostic:** add option to include diagnostic source (d43151e)
* **diagnostic:** allow 'prefix' option to return highlight (cc48837)
* **diagnostic:** allow customized diagnostic messages (#15742) (d999c96)
* **diagnostic:** match(), tolist(), fromlist() #15704 (e61ea77)
* **diagnostic:** update jumplist on goto_next/prev (#15942) (b55944e)
* **diagnostic:** use `scope = 'line'` by default for `open_float()` (#16456) (217f9f8), closes #16453
* **diagnostic:** support severity_sort (32c0631)
* **checkhealth:** provide function for command line completion (8b43b07)
* **f_chansend:** support Blob data argument (7e9ea08)
* **job:** add parameter to close stdin (eb7f24b)
* **keywordprg:** use :terminal for external commands #15398 (a90513c), closes #2995 #2761
* **lsp:** add 'focus' option to open_floating_preview (#16465) (fff8827)
* **lsp:** add a registry for client side code action commands (6c03601)
* **lsp:** add client command support to codelens (#15820) (19a77cd)
* **lsp:** add codeAction/resolve support (#15818) (ec4731d)
* **lsp:** add exit_timeout flag (#16070) (80456cf)
* **lsp:** add formatexpr (#16186) (52fa1d2)
* **lsp:** add lsp healthcheck (e268026)
* **lsp:** add per-client commands (#16101) (519d8de)
* **lsp:** add tagfunc (#16103) (f940e7a)
* **lsp:** add warning message for large log size (e6777a7)
* **lsp:** allow configuring zindex for floating windows (#15086) (c487a73)
* **lsp:** allow diagnostics to be disabled for a buffer (#15134) (1aeb945)
* **lsp:** allow root_dir to be nil (#15430) (ff0833c)
* **lsp:** highlight active parameter in signature help (#15018) (af26371)
* **lsp:** improve vim.lsp.util.apply_text_edits (#15561) (41cfba6)
* **lsp:** include original request params in handler ctx (187579f)
* **lsp:** jump to diagnostics by position (#14795) (ea39ff5)
* **lsp:** Make line diagnostics display prettier (e43dbfd)
* **lsp:** make list handlers configurable (#15199) (3e00d4f)
* **lsp:** support textDocument/prepareRename (#15514) (c1f573f)
* **lsp:** use uv_spawn to check if server executable (#16430) (1a60580)
* **lsp:** use vim.ui.select() in codelenses (#16004) (e7ea54a)
* **lsp:** utilize textEdit.range for startbyte in omnifunc (#15957) (e9d6f7c)
* **lua:** add lua-cjson as vendored dependency (8decc9f)
* **lua:** add vim.mpack for msgpack support in lua (eaf661d)
* **lua:** allow passing handles to vim.b/w/t (6c5e7bd)
* **lua:** convert binary string with NULs to Blob (de9df82)
* **lua:** document support of packages with v:lua syntax (9dd371b)
* **lua:** enable stack traces in error output (#16228) (03b805a)
* **lua:** expose lua-cjson as vim.json (30fed27)
* **lua:** make vim.mpack support vim.NIL and vim.empty_dict() (0f59666)
* **match:** allow hl group to be defined after :match command (fca52f5)
* **msgpack:** convert Blobs to BIN strings (af6f454)
* **health:** support lua healthchecks (9249dcd), closes #15632
* **shada:** restore Blob globals properly (ef729fb)
* **terminal:** TermClose: set exit code in v:event.status #15406 (50b30de), closes #4713
* **treesitter:** add next, prev sibling method (1400841)
* **treesitter:** allow to set highlight priority for queries (242608e)
* **ui:** add `opt.kind` to `vim.ui.select` (#15838) (7ae86c1)
* **ui:** add vim.ui.input and use in lsp rename (#15959) (16d4af6)
* **ui:** add vim.ui.select and use in code actions (#15771) (63fde08)
* **vim script:** support calling v:lua as a method (b2994e3)
CHANGES
* **defaults:** auto-create backup dir (4600193)
* **defaults:** inccommand=nosplit #15395 (7215d35)
* **defaults:** set undo points in <C-U> and <C-W> (#15400) (2cb8db3)
* **defaults:** limit syntax cost on CmdwinEnter #15401 (622a36b), closes #6289 #6399
* **defaults:** map CTRL-L to search highlights, update diffs #15385 (0aa8128)
* **defaults:** map Y to y$ #13268 (5a111c1), closes #416 #6289
* **defaults:** remove 'options' from viewoptions #15397 (3954537), closes #6289
* **defaults:** set hidden (f6c72b7)
* **defaults:** set nojoinspaces (d417e67)
* **defaults:** switchbuf=uselast #15394 (4ba7495)
* **runtime:** add packages as `"/pack/*/start/*"` patterns to &rtp (9df7e02)
* **startup:** load builtin plugins with --clean #15893 (c7a63f3), closes #15605
* **terminal:** set cursorlineopt=number in terminal mode (#15493) (c61a386)
* **window:** skip non-focusable floats for :windo (#15378) (e8631cb)
PERFORMANCE IMPROVEMENTS
* **api:** avoid spurious allocations when converting small objects (705e8f1)
* **highlight:** use a hashtable for highlight group names (bb4b4d7)
* **lua:** optimize vim.deep_equal #15236 (4b452d4)
* **lua:** don't use regexes inside lua require'mod' (ea2023f), closes #15147 #15497
* **lsp:** improve json deserialization performance (#15854) (912a6e5)
* **map:** reduce double pointer indirection to single pointer indirection (9e651a9)
* **treesitter:** avoid string lookup of highlight name in hot loop (2460f0a)
FIXES
* **:source, nvim_exec:** handle Vimscript line continuations #14809 (6188926), closes #14807
* **:source:** copy curbuf lines to memory before sourcing #15111 (afdc9e6)
* allow str_utfindex second argument to be an explicit nil (#16448) (512ec46)
* **api:** fix crash after set_option_value_for() #15390 (8b0e6cc), closes #14097 #13577
* **api:** fix nvim_buf_set_extmark (2338345)
* **autocmd:** fix conditions in block_autocmds, unblock_autocmds #15372 (29712ae), closes #6279
* **buffer_updates:** cleanup test behavior (54b2c68)
* **buffer_updates:** handle :delete of the very last line in buffer (8335e26)
* **buffer_updates:** handle :sort of already sorted buffer (ef687d3)
* **buffer_updates:** make `lockmarks` not affect extmarks and buffer updates. fixes #12861 (7d171b1)
* **bufupdates:** send correct updates for visual paste (1423146)
* **build:** add an env var to re-enable the colors (5087347)
* **build:** call find_package(Threads) before using its variables (f446ab3)
* **build:** export symbols on Windows (aa644b7)
* **build:** fix build failure in MinGW (0503e17)
* **build:** make vendored libmpack and libmpack-lua build properly (2a08aef)
* **channel:** throw error if sending to internal channel w/o terminal (3b89fee)
* **checkhealth:** duplicate checks if module name has "-" #15935 (a36c6e5)
* **checkhealth:** mitigate issues with duplicate healthchecks #15919 (acd5e83), closes #15259
* **ci:** disable broken test on openbsd on all CI due to resource constraints (a3e2636)
* **ci:** re-run GHA for ready_for_review events (#15377) (c6ef956)
* **decorations:** crash when :bdelete (extmark_free_all) after clear_namespace (cd353aa), closes #15212
* **defaults:** "syntax sync maxlines=1" on CmdwinEnter #15552 (5f8518b), closes #15401
* **defaults:** do not map Y in visual-mode #15387 (54726e8), closes #13268
* **diagnostic:** allow floats to be focusable (#16093) (427bac6)
* **diagnostic:** change default severity_sort order (938ed45)
* **diagnostic:** clamp line numbers in setqflist and setloclist (5b0d8f8)
* **diagnostic:** correctly handle folder level diagnostics (f87779a)
* **diagnostic:** deepcopy diagnostics before clamping line numbers (2abc799)
* **diagnostic:** do not focus floats in goto functions (#16433) (b5b025f)
* **diagnostic:** don't clamp line numbers in setqflist (0341c68)
* **diagnostic:** don't return nil when callers expect a table (#15765) (057606e)
* **diagnostic:** don't use nil col if missing from qflist (#16357) (5e46f64)
* **diagnostic:** error on invalid severity value (#15965) (d5dd0aa)
* **diagnostic:** fix navigation with diagnostics placed past end of line (34bb5fa)
* **diagnostic:** fix option resolution in open_float (#16229) (fd34784)
* **diagnostic:** fix wrong data type in setqflist() (3fd1450)
* **diagnostic:** get line count per buffer when clamping (c59f200)
* **diagnostic:** handle an unknown or missing client (#16242) (1fdbd29)
* **diagnostic:** handle diagnostics placed past the end of line (#16095) (a2994c8)
* **diagnostic:** make set() go through cache when calling show() (d93f47d)
* **diagnostic:** only update decorations for loaded buffers (#15715) (924e8e4)
* **diagnostic:** preserve fields from LSP diagnostics via user_data (#15735) (17b7968)
* **diagnostic:** remove useless highlight links (#15683) (c13242c), closes #15585
* disable clipboard when test registers (dd63d93)
* **docgen:** add tagfunc.lua (0746f00)
* **doc:** various fixes #15604 (4eb1ebb)
* **eval:** add the vimscript-1 feature to has() (18b32fc)
* **eval:** checking for a non-empty string is too strict (#15987) (1dbbaf8)
* **eval:** fix has('wsl') #16153 (16d06fa), closes #12642 #16143
* **eval:** fixup for empty modifier in fnamemodify (#16368) (a7ad509), closes #16367
* **extmark:** fix missing virt_lines when using id param of set_extmark (995dbd2)
* **extmarks:** splice extmarks on nv_Undo #15920 (e069361)
* **fileio:** replace characters over INT_MAX with U+FFFD (#16354) (a2e5c2f), closes #11877
* **float:** fix potential heap corruption in win_redr_border (de670f3)
* **float:** redraw if w_border_adj changed (7ff1bc1)
* **heath/provider.vim:** using list as string #16007 (5365f24), closes #15988
* **highlight:** remove syncolor.vim, always include syntax colors (9afa0d2), closes #15176 #12573 #15205
* **inccommand:** ignore trailing commands only for *previewed* command #15638 (1f8c91b), closes #8796 #7494
* include ci/ in exported tarball (d6f03aa), closes #15856
* **input:** never reinterpret unmapped ALT- chrods in Terminal mode (#16222) (5ce35ab)
* **input:** resolve isolated (non-ALT/META) mappings #13109 (c4857b6), closes #13042 #13086 #15869
* **jobwait:** always drain process event queues #15402 (3c081d0), closes #15349
* **lsp_spec:** tests depended on previous session (069d1de)
* **lsp:** accept file URIs without a hostname (a2c2a08)
* **lsp:** add done flag to messages returned in util.get_progress_messages() (#15985) (45fa70a)
* **lsp:** add placeholder cancel function (#16189) (4da0351)
* **lsp:** add textDocument/prepareRename to capability map (#15961) (fcc11d5), closes #15899
* **lsp:** adjust legacy show diagnostic functions to use correct scope (#16106) (dc6c9fe)
* **lsp:** allow diagnostic.clear to accept nil bufnr (#15137) (4ed2d4f)
* **lsp:** avoid duplicates in client attached buffers (#16099) (c5525f2)
* **lsp:** avoid serializing boolean as key (#15810) (96614f8)
* **lsp:** change rpc start notify level to warn (#16467) (04c7b55)
* **lsp:** change signature of buf_highlight_references (#16345) (eb3d591)
* **lsp:** correctly parse LSP snippets #15579 (516775e), closes #15522
* **lsp:** default to UTF-16 in make_position_params (2e3a474)
* **lsp:** do not index nil client in progress (#16262) (8f31b21)
* **lsp:** do not invoke handlers for unsupported methods (#15926) (d288daa)
* **lsp:** don't update active_clients on exit_timeout (#16192) (98f5782)
* **lsp:** enable additional capabilities (#15470) (5d63354)
* **lsp:** ensure buffers are re-attached on rename (#16266) (ee3a58d)
* **lsp:** Ensure users get feedback on references/symbols errors or empty results (256570a)
* **lsp:** expose ContentModified error code to callbacks (#15262) (3f09732)
* **lsp:** fix cursor row after textEdits (#16038) (bd2f61c)
* **lsp:** gracefully handle nil workspaceFolders (#16284) (0ecc58c)
* **lsp:** guard textDocument/codeAction command logic #15769 (433bda4)
* **lsp:** improve symbols_to_items performance (#16197) (5ad15c9)
* **lsp:** Include client name in handler error messages (#15227) (24f2b9e)
* **lsp:** pass bufnr for async formatting (#15084) (c31bc6e)
* **lsp:** persist diagnostic config for clients (bcc9ba5)
* **lsp:** prevent double <text> for cached plaintext markup (910967e)
* **lsp:** restore diagnostics extmarks on buffer changes (#15011) (77b33e4)
* **lsp:** rewrite incremental sync (#16252) (2ecf0a4)
* **lsp:** send buffer contents joined on fileformat-specific linebreak (#16334) (134a638)
* **lsp:** send textDocument/didChange for each buffer (#16431) (3451121)
* **lsp:** support duplicate params in signature help (#15032) (9132b76)
* **lsp:** update lsp-handler signature in call_hierarchy (#15738) (8164adc)
* **lsp:** update workspace/applyEdit handler signature (#15573) (3f526fe)
* **lua:** fix vim.deepcopy for metatables & cycled tables (#16435) (eb876a0)
* **lua:** preserve argument lists which are not lists (6896d22)
* **man.vim:** ensure buftype=nofile after :tag or :stag #15675 (29bc648), closes #15650
* **man.vim:** filetype=man is too eager #15488 (2548a9e), closes #15487 #15487
* **mouse:** fix mouse drag positions on multigrid #12667 (0dcfd0e), closes #15091
* **mouse:** correct dragged position in composed layout (810da1a)
* **multigrid:** mouse events crash neovim (28ac6c0)
* **nvim_open_win:** crash if autocmds delete buffer/window #15549 (0c06da1), closes #15548
* **options:** using :set fillchars should clear local value (7528bce)
* prevent K_EVENT from stopping Select mode CTRL-O #15688 (5f144ef)
* **provider:** compare versions as number, not string (python 3.10 support) #15937 (e16adbf), closes #14586
* **screen:** make display_tick monotonic up to 2^64. fixes #16152 (9e88c9c)
* **screen:** missing search highlights when redrawing from timer #15380 (db695cc), closes #13074 #14064
* **shared:** do not treat empty tables as list in deep extend (#15094) (526fc60)
* **sign:** reset auto sign column with minimum in float win minimal style (c8f57f6)
* **startup:** init.lua: set $MYVIMRC to absolute path #15748 (c76cddf)
* **termdebug:** replace mapset with nvim_set_keymap (#15699) (4d7dcbe)
* **termdebug:** replace term_getline with getbufline #15598 (11289ad)
* **terminal:** close without ! if the job is stopped (55defa1), closes #4683
* **terminal:** free terminal if close_buffer() closes a closed terminal (#16264) (14def4d)
* **test/dumplog:** tostring(rv) before formatting as string (ddaa0cc)
* **tests:** use isolated XDG_DATA_HOME in startup tests (8e663e2)
* **treesitter:** do not map hl_group when no mapping is set (f489d98)
* **treesitter:** run predicates more often in iter_matches (458f2aa)
* **tui:** extend smglr ignores to smglp and smgrp (#16239) (3ba800f)
* **tui:** remove obsolete $NVIM detection #15791 (4414584), closes #12937 #11390
* **tutor:** formatting, layout #15098 (c52ec8f), closes #15088
* **ui:** use nowait for q mapping in floating window (#16427) (c132144)
* **v:lua:** fix emsg when calling v:lua directly (da9005a)
* **vim-patch.sh:** run nvim with -u NONE -n #16179 (97ae0ab)
* **vim.opt:** vimL map string values not trimmed (#14982) (4906156)
* **window:** win_close from other tabpage #15454 (90b2da1), closes #15313
* **windowing:** positioning of relative floats (9065730)
2021-11-30 10:13:35 -07:00
|
|
|
set(NVIM_API_PRERELEASE false)
|
api: Nvim version, API level #5386
The API level is disconnected from the NVIM version. The API metadata
holds the current API level, and the lowest backwards-compatible level
supported by this instance.
Release 0.1.6 will be the first release reporting the Nvim version and
API level.
metadata['version'] = {
major: 0,
minor: 1,
patch: 6,
prerelease: true,
api_level: 1,
api_compatible: 0,
}
The API level may remain unchanged across Neovim releases if the API has
not changed.
When changing the API the CMake variable NVIM_API_PRERELEASE is set to
true, and NVIM_API_CURRENT/NVIM_API_COMPATIBILITY are incremented
accordingly.
The functional tests check the API table against fixtures of past
versions of Neovim. It compares all the functions in the old table with
the new one, it does ignore some metadata attributes that do not alter
the function signature or were removed since 0.1.5. Currently the only
fixture is 0.mpack, generated from Neovim 0.1.5 with nvim --api-info.
2016-09-25 10:46:37 -07:00
|
|
|
|
2014-11-09 05:52:15 -07:00
|
|
|
set(NVIM_VERSION_BUILD_TYPE "${CMAKE_BUILD_TYPE}")
|
|
|
|
# NVIM_VERSION_CFLAGS set further below.
|
2014-01-31 06:39:15 -07:00
|
|
|
|
|
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
|
|
|
|
2019-02-15 13:18:16 -07:00
|
|
|
# Log level (MIN_LOG_LEVEL in log.h)
|
|
|
|
if("${MIN_LOG_LEVEL}" MATCHES "^$")
|
2019-12-02 09:12:51 -07:00
|
|
|
# Minimize logging for release-type builds.
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Release"
|
|
|
|
OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo"
|
|
|
|
OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
|
|
|
|
message(STATUS "MIN_LOG_LEVEL not specified, default is 3 (ERROR) for release builds")
|
|
|
|
set(MIN_LOG_LEVEL 3)
|
|
|
|
else()
|
|
|
|
message(STATUS "MIN_LOG_LEVEL not specified, default is 1 (INFO)")
|
|
|
|
set(MIN_LOG_LEVEL 1)
|
|
|
|
endif()
|
2019-02-15 13:18:16 -07:00
|
|
|
else()
|
|
|
|
if(NOT MIN_LOG_LEVEL MATCHES "^[0-3]$")
|
|
|
|
message(FATAL_ERROR "invalid MIN_LOG_LEVEL: " ${MIN_LOG_LEVEL})
|
|
|
|
endif()
|
|
|
|
message(STATUS "MIN_LOG_LEVEL=${MIN_LOG_LEVEL}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Default to -O2 on release builds.
|
|
|
|
if(CMAKE_C_FLAGS_RELEASE MATCHES "-O3")
|
|
|
|
message(STATUS "Replacing -O3 in CMAKE_C_FLAGS_RELEASE with -O2")
|
|
|
|
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
|
|
|
|
endif()
|
|
|
|
|
2017-06-29 00:29:40 -07:00
|
|
|
if(CMAKE_COMPILER_IS_GNUCC)
|
|
|
|
check_c_compiler_flag(-Og HAS_OG_FLAG)
|
|
|
|
else()
|
|
|
|
set(HAS_OG_FLAG 0)
|
2015-09-28 03:14:38 -07:00
|
|
|
endif()
|
|
|
|
|
2017-10-20 17:30:21 -07:00
|
|
|
#
|
|
|
|
# Build-type: RelWithDebInfo
|
|
|
|
#
|
2017-06-29 00:29:40 -07:00
|
|
|
if(HAS_OG_FLAG)
|
2017-10-20 17:30:21 -07:00
|
|
|
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -Og -g")
|
|
|
|
endif()
|
|
|
|
# We _want_ assertions in RelWithDebInfo build-type.
|
|
|
|
if(CMAKE_C_FLAGS_RELWITHDEBINFO MATCHES DNDEBUG)
|
2017-06-29 00:29:40 -07:00
|
|
|
string(REPLACE "-DNDEBUG" "" CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}")
|
2015-09-28 03:14:38 -07:00
|
|
|
endif()
|
|
|
|
|
2017-02-11 17:02:54 -07:00
|
|
|
# gcc 4.0+ sets _FORTIFY_SOURCE=2 automatically. This currently
|
2014-11-04 15:06:18 -07:00
|
|
|
# does not work with Neovim due to some uses of dynamically-sized structures.
|
2017-02-11 17:02:54 -07:00
|
|
|
# https://github.com/neovim/neovim/issues/223
|
2014-11-21 01:42:59 -07:00
|
|
|
include(CheckCSourceCompiles)
|
2014-12-16 04:02:42 -07:00
|
|
|
|
|
|
|
# Include the build type's default flags in the check for _FORTIFY_SOURCE,
|
|
|
|
# otherwise we may incorrectly identify the level as acceptable and find out
|
|
|
|
# later that it was not when optimizations were enabled. CFLAGS is applied
|
|
|
|
# even though you don't see it in CMAKE_REQUIRED_FLAGS.
|
|
|
|
set(INIT_FLAGS_NAME CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE})
|
|
|
|
string(TOUPPER ${INIT_FLAGS_NAME} INIT_FLAGS_NAME)
|
|
|
|
if(${INIT_FLAGS_NAME})
|
|
|
|
set(CMAKE_REQUIRED_FLAGS "${${INIT_FLAGS_NAME}}")
|
|
|
|
endif()
|
|
|
|
|
2016-02-09 14:22:30 -07:00
|
|
|
# Include <string.h> because some toolchains define _FORTIFY_SOURCE=2 in
|
|
|
|
# internal header files, which should in turn be #included by <string.h>.
|
2014-11-21 01:42:59 -07:00
|
|
|
check_c_source_compiles("
|
2016-02-09 14:22:30 -07:00
|
|
|
#include <string.h>
|
|
|
|
|
2014-11-21 01:42:59 -07:00
|
|
|
#if defined(_FORTIFY_SOURCE) && _FORTIFY_SOURCE > 1
|
|
|
|
#error \"_FORTIFY_SOURCE > 1\"
|
|
|
|
#endif
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
2015-06-04 02:08:26 -07:00
|
|
|
" HAS_ACCEPTABLE_FORTIFY)
|
2014-11-21 01:42:59 -07:00
|
|
|
|
2015-06-04 02:08:26 -07:00
|
|
|
if(NOT HAS_ACCEPTABLE_FORTIFY)
|
2018-10-06 09:45:34 -07:00
|
|
|
message(STATUS "Unsupported _FORTIFY_SOURCE found, forcing _FORTIFY_SOURCE=1")
|
2014-12-12 10:45:21 -07:00
|
|
|
# Extract possible prefix to _FORTIFY_SOURCE (e.g. -Wp,-D_FORTIFY_SOURCE).
|
|
|
|
STRING(REGEX MATCH "[^\ ]+-D_FORTIFY_SOURCE" _FORTIFY_SOURCE_PREFIX "${CMAKE_C_FLAGS}")
|
|
|
|
STRING(REPLACE "-D_FORTIFY_SOURCE" "" _FORTIFY_SOURCE_PREFIX "${_FORTIFY_SOURCE_PREFIX}" )
|
2015-08-26 15:00:33 -07:00
|
|
|
if(NOT _FORTIFY_SOURCE_PREFIX STREQUAL "")
|
2018-10-06 09:45:34 -07:00
|
|
|
message(STATUS "Detected _FORTIFY_SOURCE Prefix=${_FORTIFY_SOURCE_PREFIX}")
|
2014-12-12 10:45:21 -07:00
|
|
|
endif()
|
2014-11-04 15:06:18 -07:00
|
|
|
# -U in add_definitions doesn't end up in the correct spot, so we add it to
|
|
|
|
# the flags variable instead.
|
2014-12-12 10:45:21 -07:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${_FORTIFY_SOURCE_PREFIX}-U_FORTIFY_SOURCE ${_FORTIFY_SOURCE_PREFIX}-D_FORTIFY_SOURCE=1")
|
2014-11-04 15:06:18 -07:00
|
|
|
endif()
|
|
|
|
|
2015-09-30 11:38:34 -07:00
|
|
|
# Remove --sort-common from linker flags, as this seems to cause bugs (see #2641, #3374).
|
|
|
|
# TODO: Figure out the root cause.
|
|
|
|
if(CMAKE_EXE_LINKER_FLAGS MATCHES "--sort-common" OR
|
|
|
|
CMAKE_SHARED_LINKER_FLAGS MATCHES "--sort-common" OR
|
|
|
|
CMAKE_MODULE_LINKER_FLAGS MATCHES "--sort-common")
|
2018-10-06 09:45:34 -07:00
|
|
|
message(STATUS "Removing --sort-common from linker flags")
|
2015-09-30 11:38:34 -07:00
|
|
|
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
|
|
|
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
|
|
|
string(REGEX REPLACE ",--sort-common(=[^,]+)?" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
|
|
|
|
|
|
|
# If no linker flags remain for a -Wl argument, remove it.
|
|
|
|
# '-Wl$' will match LDFLAGS="-Wl,--sort-common",
|
|
|
|
# '-Wl ' will match LDFLAGS="-Wl,--sort-common -Wl,..."
|
|
|
|
string(REGEX REPLACE "-Wl($| )" "" CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS}")
|
|
|
|
string(REGEX REPLACE "-Wl($| )" "" CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS}")
|
|
|
|
string(REGEX REPLACE "-Wl($| )" "" CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS}")
|
|
|
|
endif()
|
|
|
|
|
2017-07-30 14:02:41 -07:00
|
|
|
check_c_source_compiles("
|
|
|
|
#include <execinfo.h>
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
void *trace[1];
|
2019-08-07 03:49:33 -07:00
|
|
|
backtrace(trace, 1);
|
2017-07-30 14:02:41 -07:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_EXECINFO_BACKTRACE)
|
|
|
|
|
2019-01-08 14:00:52 -07:00
|
|
|
check_c_source_compiles("
|
|
|
|
int main(void)
|
|
|
|
{
|
2019-08-07 03:49:33 -07:00
|
|
|
int a = 42;
|
2019-01-08 14:00:52 -07:00
|
|
|
__builtin_add_overflow(a, a, &a);
|
|
|
|
__builtin_sub_overflow(a, a, &a);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" HAVE_BUILTIN_ADD_OVERFLOW)
|
|
|
|
|
2015-08-27 19:00:09 -07:00
|
|
|
if(MSVC)
|
|
|
|
# XXX: /W4 gives too many warnings. #3241
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(/W3)
|
|
|
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE)
|
2018-03-04 16:44:23 -07:00
|
|
|
add_definitions(-DWIN32)
|
2015-08-27 19:00:09 -07:00
|
|
|
else()
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter
|
2019-01-29 18:26:12 -07:00
|
|
|
-Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion
|
|
|
|
-Wmissing-prototypes)
|
2016-02-27 18:20:27 -07:00
|
|
|
|
2020-06-19 19:18:30 -07:00
|
|
|
check_c_compiler_flag(-Wimplicit-fallthrough HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
|
|
|
|
if(HAVE_WIMPLICIT_FALLTHROUGH_FLAG)
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-Wimplicit-fallthrough)
|
2017-05-02 20:58:04 -07:00
|
|
|
endif()
|
|
|
|
|
2016-02-27 18:20:27 -07:00
|
|
|
# On FreeBSD 64 math.h uses unguarded C11 extension, which taints clang
|
|
|
|
# 3.4.1 used there.
|
2017-05-21 04:44:02 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "FreeBSD" AND CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-Wno-c11-extensions)
|
2016-02-27 18:20:27 -07:00
|
|
|
endif()
|
2015-08-27 19:00:09 -07:00
|
|
|
endif()
|
|
|
|
|
2015-08-26 15:00:33 -07:00
|
|
|
if(MINGW)
|
2014-07-03 06:32:09 -07:00
|
|
|
# Use POSIX compatible stdio in Mingw
|
|
|
|
add_definitions(-D__USE_MINGW_ANSI_STDIO)
|
2018-03-04 16:44:23 -07:00
|
|
|
endif()
|
|
|
|
if(WIN32)
|
|
|
|
# Windows Vista is the minimum supported version
|
2015-02-03 06:31:33 -07:00
|
|
|
add_definitions(-D_WIN32_WINNT=0x0600)
|
2014-07-03 06:32:09 -07:00
|
|
|
endif()
|
2014-05-14 16:08:41 -07:00
|
|
|
|
2015-10-02 09:51:45 -07:00
|
|
|
# OpenBSD's GCC (4.2.1) doesn't have -Wvla
|
|
|
|
check_c_compiler_flag(-Wvla HAS_WVLA_FLAG)
|
|
|
|
if(HAS_WVLA_FLAG)
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-Wvla)
|
2015-10-02 09:51:45 -07:00
|
|
|
endif()
|
|
|
|
|
2015-10-13 16:46:32 -07:00
|
|
|
if(UNIX)
|
|
|
|
# -fstack-protector breaks non Unix builds even in Mingw-w64
|
|
|
|
check_c_compiler_flag(-fstack-protector-strong HAS_FSTACK_PROTECTOR_STRONG_FLAG)
|
|
|
|
check_c_compiler_flag(-fstack-protector HAS_FSTACK_PROTECTOR_FLAG)
|
|
|
|
|
|
|
|
if(HAS_FSTACK_PROTECTOR_STRONG_FLAG)
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-fstack-protector-strong)
|
2019-10-26 12:36:26 -07:00
|
|
|
link_libraries(-fstack-protector-strong)
|
2015-10-13 16:46:32 -07:00
|
|
|
elseif(HAS_FSTACK_PROTECTOR_FLAG)
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-fstack-protector --param ssp-buffer-size=4)
|
2019-10-26 12:36:26 -07:00
|
|
|
link_libraries(-fstack-protector --param ssp-buffer-size=4)
|
2015-10-13 16:46:32 -07:00
|
|
|
endif()
|
2015-08-26 15:00:33 -07:00
|
|
|
endif()
|
|
|
|
|
2020-02-17 10:04:01 -07:00
|
|
|
check_c_compiler_flag(-fno-common HAVE_FNO_COMMON)
|
|
|
|
if (HAVE_FNO_COMMON)
|
|
|
|
add_compile_options(-fno-common)
|
|
|
|
endif()
|
|
|
|
|
2015-08-27 00:56:46 -07:00
|
|
|
check_c_compiler_flag(-fdiagnostics-color=auto HAS_DIAG_COLOR_FLAG)
|
|
|
|
if(HAS_DIAG_COLOR_FLAG)
|
2019-07-04 06:24:33 -07:00
|
|
|
if(CMAKE_GENERATOR MATCHES "Ninja")
|
|
|
|
add_compile_options(-fdiagnostics-color=always)
|
|
|
|
else()
|
|
|
|
add_compile_options(-fdiagnostics-color=auto)
|
|
|
|
endif()
|
2015-08-27 00:56:46 -07:00
|
|
|
endif()
|
|
|
|
|
2020-11-12 11:20:00 -07:00
|
|
|
option(CI_BUILD "CI, extra flags will be set" OFF)
|
2014-05-14 16:08:41 -07:00
|
|
|
|
2020-11-12 11:20:00 -07:00
|
|
|
if(CI_BUILD)
|
|
|
|
message(STATUS "CI build enabled")
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-Werror)
|
2016-10-09 10:55:08 -07:00
|
|
|
if(DEFINED ENV{BUILD_32BIT})
|
|
|
|
# Get some test coverage for unsigned char
|
2019-06-29 11:37:48 -07:00
|
|
|
add_compile_options(-funsigned-char)
|
2016-10-09 10:55:08 -07:00
|
|
|
endif()
|
2014-05-14 16:08:41 -07:00
|
|
|
endif()
|
2014-02-27 05:27:20 -07:00
|
|
|
|
2018-01-02 18:25:42 -07:00
|
|
|
option(LOG_LIST_ACTIONS "Add list actions logging" OFF)
|
|
|
|
|
2014-11-08 04:49:04 -07:00
|
|
|
add_definitions(-DINCLUDE_GENERATED_DECLARATIONS)
|
|
|
|
|
2018-06-15 05:33:07 -07:00
|
|
|
if(CMAKE_C_COMPILER_ID STREQUAL "GNU" OR CMAKE_C_COMPILER_ID STREQUAL "Clang")
|
2018-06-16 07:18:55 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "SunOS")
|
|
|
|
set(NO_UNDEFINED "-Wl,--no-undefined -lsocket")
|
|
|
|
elseif(NOT CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
|
|
set(NO_UNDEFINED "-Wl,--no-undefined")
|
|
|
|
endif()
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${NO_UNDEFINED}")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${NO_UNDEFINED}")
|
2016-01-24 19:16:00 -07:00
|
|
|
|
|
|
|
# For O_CLOEXEC, O_DIRECTORY, and O_NOFOLLOW flags on older systems
|
|
|
|
# (pre POSIX.1-2008: glibc 2.11 and earlier). #4042
|
2017-05-13 22:43:07 -07:00
|
|
|
# For ptsname(). #6743
|
2016-01-24 19:16:00 -07:00
|
|
|
add_definitions(-D_GNU_SOURCE)
|
2014-05-14 18:14:28 -07:00
|
|
|
endif()
|
|
|
|
|
2020-07-11 05:35:12 -07:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Darwin" AND CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT PREFER_LUA AND LUAJIT_VERSION LESS "2.1.0-beta3")
|
|
|
|
# Required for luajit < 2.1.0-beta3.
|
2014-10-17 03:50:13 -07:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS
|
|
|
|
"${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS
|
|
|
|
"${CMAKE_SHARED_LINKER_FLAGS} -image_base 100000000")
|
|
|
|
set(CMAKE_MODULE_LINKER_FLAGS
|
|
|
|
"${CMAKE_MODULE_LINKER_FLAGS} -image_base 100000000")
|
|
|
|
endif()
|
|
|
|
|
2014-04-03 12:00:43 -07:00
|
|
|
include_directories("${PROJECT_BINARY_DIR}/config")
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}/src")
|
|
|
|
|
2019-07-09 09:55:16 -07:00
|
|
|
find_package(LibUV 1.28.0 REQUIRED)
|
2014-05-15 04:21:13 -07:00
|
|
|
include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
|
2014-04-03 12:00:43 -07:00
|
|
|
|
2016-02-04 20:21:51 -07:00
|
|
|
find_package(Msgpack 1.0.0 REQUIRED)
|
2014-05-15 04:21:13 -07:00
|
|
|
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
|
2014-04-10 11:39:34 -07:00
|
|
|
|
2019-06-30 18:26:05 -07:00
|
|
|
find_package(LibLUV 1.30.0 REQUIRED)
|
2019-06-10 05:13:18 -07:00
|
|
|
include_directories(SYSTEM ${LIBLUV_INCLUDE_DIRS})
|
|
|
|
|
2020-11-09 13:15:03 -07:00
|
|
|
find_package(TreeSitter REQUIRED)
|
|
|
|
include_directories(SYSTEM ${TreeSitter_INCLUDE_DIRS})
|
2020-09-17 02:25:22 -07:00
|
|
|
|
2021-06-29 06:59:57 -07:00
|
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES "${TreeSitter_INCLUDE_DIRS}")
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${TreeSitter_LIBRARIES}")
|
|
|
|
check_c_source_compiles("
|
|
|
|
#include <tree_sitter/api.h>
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
TSQueryCursor *cursor = ts_query_cursor_new();
|
|
|
|
ts_query_cursor_set_match_limit(cursor, 32);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
" TS_HAS_SET_MATCH_LIMIT)
|
|
|
|
if(TS_HAS_SET_MATCH_LIMIT)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DNVIM_TS_HAS_SET_MATCH_LIMIT")
|
|
|
|
endif()
|
|
|
|
|
2017-05-13 04:57:08 -07:00
|
|
|
# Note: The test lib requires LuaJIT; it will be skipped if LuaJIT is missing.
|
|
|
|
option(PREFER_LUA "Prefer Lua over LuaJIT in the nvim executable." OFF)
|
2017-01-20 16:33:09 -07:00
|
|
|
|
2017-05-13 04:57:08 -07:00
|
|
|
if(PREFER_LUA)
|
2018-11-05 17:48:49 -07:00
|
|
|
find_package(Lua 5.1 REQUIRED)
|
2017-05-13 04:57:08 -07:00
|
|
|
set(LUA_PREFERRED_INCLUDE_DIRS ${LUA_INCLUDE_DIR})
|
|
|
|
set(LUA_PREFERRED_LIBRARIES ${LUA_LIBRARIES})
|
2018-06-01 11:17:24 -07:00
|
|
|
# Passive (not REQUIRED): if LUAJIT_FOUND is not set, nvim-test is skipped.
|
2017-05-13 04:57:08 -07:00
|
|
|
find_package(LuaJit)
|
|
|
|
else()
|
|
|
|
find_package(LuaJit REQUIRED)
|
|
|
|
set(LUA_PREFERRED_INCLUDE_DIRS ${LUAJIT_INCLUDE_DIRS})
|
|
|
|
set(LUA_PREFERRED_LIBRARIES ${LUAJIT_LIBRARIES})
|
2017-01-20 16:33:09 -07:00
|
|
|
endif()
|
2016-03-04 11:55:28 -07:00
|
|
|
|
2017-03-30 08:05:48 -07:00
|
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}")
|
|
|
|
check_c_source_compiles("
|
|
|
|
#include <msgpack.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
return MSGPACK_OBJECT_FLOAT32;
|
|
|
|
}
|
|
|
|
" MSGPACK_HAS_FLOAT32)
|
2019-07-05 03:19:13 -07:00
|
|
|
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${MSGPACK_INCLUDE_DIRS}")
|
2017-03-30 08:05:48 -07:00
|
|
|
if(MSGPACK_HAS_FLOAT32)
|
2018-06-17 20:29:39 -07:00
|
|
|
add_definitions(-DNVIM_MSGPACK_HAS_FLOAT32)
|
2017-03-30 08:05:48 -07:00
|
|
|
endif()
|
|
|
|
|
2017-03-17 17:06:47 -07:00
|
|
|
option(FEAT_TUI "Enable the Terminal UI" ON)
|
2015-02-13 08:06:05 -07:00
|
|
|
|
2016-05-23 14:16:39 -07:00
|
|
|
if(FEAT_TUI)
|
2019-09-06 14:39:41 -07:00
|
|
|
find_package(UNIBILIUM 2.0 REQUIRED)
|
2016-05-23 14:16:39 -07:00
|
|
|
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
|
|
|
|
|
2017-09-16 20:13:35 -07:00
|
|
|
list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
|
|
|
|
list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
|
|
|
|
check_c_source_compiles("
|
|
|
|
#include <unibilium.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main(void)
|
|
|
|
{
|
|
|
|
return unibi_num_from_var(unibi_var_from_num(0));
|
|
|
|
}
|
|
|
|
" UNIBI_HAS_VAR_FROM)
|
2019-07-05 03:19:13 -07:00
|
|
|
list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIRS}")
|
|
|
|
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARIES}")
|
2017-09-16 20:13:35 -07:00
|
|
|
if(UNIBI_HAS_VAR_FROM)
|
2018-06-17 20:29:39 -07:00
|
|
|
add_definitions(-DNVIM_UNIBI_HAS_VAR_FROM)
|
2017-09-16 20:13:35 -07:00
|
|
|
endif()
|
|
|
|
|
2018-11-03 13:28:07 -07:00
|
|
|
find_package(LibTermkey 0.18 REQUIRED)
|
2016-05-23 14:16:39 -07:00
|
|
|
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
|
|
|
|
endif()
|
2015-02-13 08:06:05 -07:00
|
|
|
|
2019-09-11 18:25:25 -07:00
|
|
|
find_package(LIBVTERM 0.1 REQUIRED)
|
2015-02-28 06:41:53 -07:00
|
|
|
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})
|
|
|
|
|
2016-02-24 01:14:19 -07:00
|
|
|
if(WIN32)
|
2018-11-03 13:28:07 -07:00
|
|
|
find_package(Winpty 0.4.3 REQUIRED)
|
2016-02-24 01:14:19 -07:00
|
|
|
include_directories(SYSTEM ${WINPTY_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
2015-06-09 01:43:22 -07:00
|
|
|
option(CLANG_ASAN_UBSAN "Enable Clang address & undefined behavior sanitizer for nvim binary." OFF)
|
2015-06-08 09:49:23 -07:00
|
|
|
option(CLANG_MSAN "Enable Clang memory sanitizer for nvim binary." OFF)
|
2015-06-09 01:43:22 -07:00
|
|
|
option(CLANG_TSAN "Enable Clang thread sanitizer for nvim binary." OFF)
|
|
|
|
|
|
|
|
if((CLANG_ASAN_UBSAN AND CLANG_MSAN)
|
|
|
|
OR (CLANG_ASAN_UBSAN AND CLANG_TSAN)
|
|
|
|
OR (CLANG_MSAN AND CLANG_TSAN))
|
2018-10-06 09:45:34 -07:00
|
|
|
message(FATAL_ERROR "Sanitizers cannot be enabled simultaneously")
|
2015-06-08 09:49:23 -07:00
|
|
|
endif()
|
2015-06-09 01:43:22 -07:00
|
|
|
|
|
|
|
if((CLANG_ASAN_UBSAN OR CLANG_MSAN OR CLANG_TSAN) AND NOT CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2018-10-06 09:45:34 -07:00
|
|
|
message(FATAL_ERROR "Sanitizers are only supported for Clang")
|
2015-04-12 07:40:08 -07:00
|
|
|
endif()
|
|
|
|
|
2020-01-28 01:56:26 -07:00
|
|
|
if(ENABLE_LIBICONV)
|
|
|
|
find_package(Iconv REQUIRED)
|
|
|
|
include_directories(SYSTEM ${Iconv_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
2018-06-01 11:17:24 -07:00
|
|
|
if(ENABLE_LIBINTL)
|
|
|
|
# LibIntl (not Intl) selects our FindLibIntl.cmake script. #8464
|
|
|
|
find_package(LibIntl REQUIRED)
|
2014-11-08 14:09:47 -07:00
|
|
|
include_directories(SYSTEM ${LibIntl_INCLUDE_DIRS})
|
2014-04-03 12:00:43 -07:00
|
|
|
endif()
|
|
|
|
|
2014-02-24 11:52:12 -07:00
|
|
|
# Determine platform's threading library. Set CMAKE_THREAD_PREFER_PTHREAD
|
2014-06-25 14:47:27 -07:00
|
|
|
# explicitly to indicate a strong preference for pthread.
|
2014-02-24 11:52:12 -07:00
|
|
|
set(CMAKE_THREAD_PREFER_PTHREAD ON)
|
|
|
|
find_package(Threads REQUIRED)
|
|
|
|
|
2016-01-08 19:40:57 -07:00
|
|
|
# Place targets in bin/ or lib/ for all build configurations
|
2014-03-03 08:09:06 -07:00
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
2014-11-30 19:22:46 -07:00
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
|
2016-01-08 19:40:57 -07:00
|
|
|
foreach(CFGNAME ${CMAKE_CONFIGURATION_TYPES})
|
|
|
|
string(TOUPPER ${CFGNAME} CFGNAME)
|
|
|
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${CFGNAME} ${CMAKE_BINARY_DIR}/bin)
|
|
|
|
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY_${CFGNAME} ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_${CFGNAME} ${CMAKE_BINARY_DIR}/lib)
|
|
|
|
endforeach()
|
2014-02-22 08:30:50 -07:00
|
|
|
|
2014-07-11 04:12:18 -07:00
|
|
|
# Find Lua interpreter
|
2014-07-11 04:12:10 -07:00
|
|
|
include(LuaHelpers)
|
2016-04-13 05:21:32 -07:00
|
|
|
set(LUA_DEPENDENCIES lpeg mpack bit)
|
2014-07-11 04:12:18 -07:00
|
|
|
if(NOT LUA_PRG)
|
2016-06-03 09:21:29 -07:00
|
|
|
foreach(CURRENT_LUA_PRG luajit lua5.1 lua5.2 lua)
|
2019-10-07 08:42:40 -07:00
|
|
|
unset(_CHECK_LUA_PRG CACHE)
|
2014-07-11 04:12:18 -07:00
|
|
|
unset(LUA_PRG_WORKS)
|
2019-10-07 08:42:40 -07:00
|
|
|
find_program(_CHECK_LUA_PRG ${CURRENT_LUA_PRG})
|
2014-07-11 04:12:18 -07:00
|
|
|
|
2019-10-07 08:42:40 -07:00
|
|
|
if(_CHECK_LUA_PRG)
|
|
|
|
check_lua_deps(${_CHECK_LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
2014-07-11 04:12:18 -07:00
|
|
|
if(LUA_PRG_WORKS)
|
2019-10-07 08:42:40 -07:00
|
|
|
set(LUA_PRG "${_CHECK_LUA_PRG}" CACHE FILEPATH "Path to a program.")
|
2014-07-11 04:12:18 -07:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
2019-10-07 08:42:40 -07:00
|
|
|
unset(_CHECK_LUA_PRG CACHE)
|
2014-07-11 04:12:18 -07:00
|
|
|
else()
|
|
|
|
check_lua_deps(${LUA_PRG} "${LUA_DEPENDENCIES}" LUA_PRG_WORKS)
|
|
|
|
endif()
|
2014-04-13 03:06:35 -07:00
|
|
|
|
2014-07-11 04:12:10 -07:00
|
|
|
if(NOT LUA_PRG_WORKS)
|
2018-10-06 09:45:34 -07:00
|
|
|
message(FATAL_ERROR "Failed to find a Lua 5.1-compatible interpreter")
|
2014-04-13 03:06:35 -07:00
|
|
|
endif()
|
|
|
|
|
2018-10-06 09:45:34 -07:00
|
|
|
message(STATUS "Using Lua interpreter: ${LUA_PRG}")
|
2014-04-13 03:06:35 -07:00
|
|
|
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
# Setup busted.
|
2016-03-19 10:54:14 -07:00
|
|
|
find_program(BUSTED_PRG NAMES busted busted.bat)
|
2016-03-06 20:42:49 -07:00
|
|
|
find_program(BUSTED_LUA_PRG busted-lua)
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
if(NOT BUSTED_OUTPUT_TYPE)
|
2017-05-25 05:51:53 -07:00
|
|
|
set(BUSTED_OUTPUT_TYPE "nvim")
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
endif()
|
2014-03-03 08:09:06 -07:00
|
|
|
|
2015-11-17 05:16:33 -07:00
|
|
|
find_program(LUACHECK_PRG luacheck)
|
2019-07-28 20:04:12 -07:00
|
|
|
find_program(FLAKE8_PRG flake8)
|
2016-06-19 07:41:08 -07:00
|
|
|
find_program(GPERF_PRG gperf)
|
|
|
|
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
include(InstallHelpers)
|
|
|
|
|
2015-05-17 11:45:30 -07:00
|
|
|
file(GLOB MANPAGES
|
|
|
|
RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
Remove outdated and unused manuals #2891
`nvim-[lang].1`:
The non-english manuals are completely outdated and still written in
roff, as opposed to mdoc, which is used for `nvim.1`.
Given that, they're nearly useless at the moment, and when/if they are
updated, they should probably be rewritten from scratch using `nvim.1`
as a reference.
`xxd*.1`:
xxd hasn't been in the source tree for a long time, so the manual is of
little use.
`nvimtutor*.1`:
The vimtutor script hasn't ever shipped with nvim, and the consensus
seems to be that it won't, at least in the form of an executable
installed alongside `$(PREFIX)/bin/nvim` (see #2700).
In `nvim.1`, the argument to the `.Os` macro was removed. This was done
because its only purpose was to signify that nvim and nvimtutor
were part of the "Neovim" distribution, i.e., one and the same, which
isn't applicable anymore because `nvimtutor.1` is being removed.
From the `.Os` documentation in `man mdoc`:
Os
Operating system version for display in the page footer. This is the
mandatory third macro of any mdoc file. Its syntax is as follows:
.Os [system [version]]
The optional system parameter specifies the relevant operating system or
environment. It is suggested to leave it unspecified, in which case
mandoc(1) uses its -Ios argument or, if that isn't specified either,
sysname and release as returned by uname(3).
Examples:
.Os
.Os KTH/CSC/TCS
.Os BSD 4.3
See also Dd and Dt.
Reviewed-by: Felipe Morales <hel.sheep@gmail.com>
Reviewed-by: Florian Walch <florian@fwalch.com>
Reviewed-by: Justin M. Keyes <justinkz@gmail.com>
[ci skip]
2015-06-24 11:12:51 -07:00
|
|
|
man/nvim.1)
|
2015-05-17 11:45:30 -07:00
|
|
|
install_helper(
|
|
|
|
FILES ${MANPAGES}
|
|
|
|
DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
|
|
|
|
2019-02-15 13:18:16 -07:00
|
|
|
#
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
# Go down the tree.
|
2019-02-15 13:18:16 -07:00
|
|
|
#
|
2014-03-03 08:09:06 -07:00
|
|
|
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
add_subdirectory(src/nvim)
|
2019-09-06 11:36:05 -07:00
|
|
|
get_directory_property(NVIM_VERSION_CFLAGS DIRECTORY src/nvim DEFINITION NVIM_VERSION_CFLAGS)
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
add_subdirectory(test/includes)
|
2014-11-09 05:52:15 -07:00
|
|
|
add_subdirectory(config)
|
2017-02-11 17:02:54 -07:00
|
|
|
add_subdirectory(test/functional/fixtures) # compile test programs
|
2015-04-02 09:45:34 -07:00
|
|
|
add_subdirectory(runtime)
|
2019-08-28 13:47:54 -07:00
|
|
|
get_directory_property(GENERATED_HELP_TAGS DIRECTORY runtime DEFINITION GENERATED_HELP_TAGS)
|
2018-05-19 23:27:52 -07:00
|
|
|
if(WIN32)
|
|
|
|
install_helper(
|
|
|
|
FILES ${DEPS_PREFIX}/share/nvim-qt/runtime/plugin/nvim_gui_shim.vim
|
|
|
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim-qt/runtime/plugin)
|
|
|
|
endif()
|
2015-02-23 08:34:20 -07:00
|
|
|
|
build: install with the correct permissions
The install() command will create the parent directories, but it does so
with the user's umask. We want to do our best to make sure the correct
permissions are being set, without clobbering existing permissions.
To do this, this commit introduces an install_helper(), which is similar
in signature to the install() command, to help ensure that directories
are created ahead of the actual install() command. This will attempt to
use 0644 permissions for files and 0755 permissions for directories by
default--though they can be overridden.
To make this work correctly, without trying to introduce some mechanism
with setting the umask, it meant that there's a small portion that makes
use of an "internal" version of the file() command. It has been tested
on CMake 2.8.11, 2.8.12, and 3.0.2, and works correctly on all versions.
This fixes #1201 and #1086.
2014-09-19 04:37:22 -07:00
|
|
|
# Setup some test-related bits. We do this after going down the tree because we
|
|
|
|
# need some of the targets.
|
2014-03-22 04:14:55 -07:00
|
|
|
if(BUSTED_PRG)
|
2014-04-30 02:10:37 -07:00
|
|
|
get_property(TEST_INCLUDE_DIRS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PROPERTY INCLUDE_DIRECTORIES)
|
2014-07-15 14:35:08 -07:00
|
|
|
|
2016-05-16 03:49:32 -07:00
|
|
|
# When running tests from 'ninja' we need to use the
|
|
|
|
# console pool: to do so we need to use the USES_TERMINAL
|
|
|
|
# option, but this is only available in CMake 3.2
|
|
|
|
set(TEST_TARGET_ARGS)
|
2021-10-19 19:19:33 -07:00
|
|
|
list(APPEND TEST_TARGET_ARGS "USES_TERMINAL")
|
2016-05-16 03:49:32 -07:00
|
|
|
|
2015-05-08 03:07:56 -07:00
|
|
|
set(UNITTEST_PREREQS nvim-test unittest-headers)
|
2019-10-18 07:32:56 -07:00
|
|
|
set(FUNCTIONALTEST_PREREQS nvim printenv-test printargs-test shell-test streams-test tty-test ${GENERATED_HELP_TAGS})
|
2015-05-08 03:07:56 -07:00
|
|
|
set(BENCHMARK_PREREQS nvim tty-test)
|
|
|
|
|
|
|
|
# Useful for automated build systems, if they want to manually run the tests.
|
|
|
|
add_custom_target(unittest-prereqs
|
|
|
|
DEPENDS ${UNITTEST_PREREQS})
|
2018-06-17 05:54:39 -07:00
|
|
|
set_target_properties(unittest-prereqs PROPERTIES FOLDER test)
|
2015-05-08 03:07:56 -07:00
|
|
|
|
|
|
|
add_custom_target(functionaltest-prereqs
|
|
|
|
DEPENDS ${FUNCTIONALTEST_PREREQS})
|
|
|
|
|
|
|
|
add_custom_target(benchmark-prereqs
|
|
|
|
DEPENDS ${BENCHMARK_PREREQS})
|
|
|
|
|
2016-05-07 19:06:46 -07:00
|
|
|
check_lua_module(${LUA_PRG} "ffi" LUA_HAS_FFI)
|
|
|
|
if(LUA_HAS_FFI)
|
|
|
|
add_custom_target(unittest
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DBUSTED_PRG=${BUSTED_PRG}
|
|
|
|
-DLUA_PRG=${LUA_PRG}
|
|
|
|
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
|
|
|
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
|
|
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
|
|
|
-DTEST_TYPE=unit
|
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
|
|
|
DEPENDS ${UNITTEST_PREREQS}
|
|
|
|
${TEST_TARGET_ARGS})
|
2018-06-17 05:54:39 -07:00
|
|
|
set_target_properties(unittest PROPERTIES FOLDER test)
|
2016-05-07 19:06:46 -07:00
|
|
|
else()
|
2017-02-11 17:02:54 -07:00
|
|
|
message(WARNING "disabling unit tests: no Luajit FFI in ${LUA_PRG}")
|
2016-05-07 19:06:46 -07:00
|
|
|
endif()
|
2014-09-29 05:43:52 -07:00
|
|
|
|
2018-06-16 07:20:25 -07:00
|
|
|
if(LUA_HAS_FFI)
|
|
|
|
set(TEST_LIBNVIM_PATH $<TARGET_FILE:nvim-test>)
|
2018-02-01 11:12:49 -07:00
|
|
|
else()
|
2018-06-16 07:20:25 -07:00
|
|
|
set(TEST_LIBNVIM_PATH "")
|
2018-02-01 11:12:49 -07:00
|
|
|
endif()
|
2018-06-16 07:20:25 -07:00
|
|
|
configure_file(
|
|
|
|
${CMAKE_SOURCE_DIR}/test/config/paths.lua.in
|
|
|
|
${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
|
|
|
|
file(GENERATE
|
|
|
|
OUTPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua
|
|
|
|
INPUT ${CMAKE_BINARY_DIR}/test/config/paths.lua.gen)
|
2018-02-01 11:12:49 -07:00
|
|
|
|
2014-11-05 03:54:20 -07:00
|
|
|
add_custom_target(functionaltest
|
2014-09-29 05:43:52 -07:00
|
|
|
COMMAND ${CMAKE_COMMAND}
|
2014-10-08 08:56:28 -07:00
|
|
|
-DBUSTED_PRG=${BUSTED_PRG}
|
2016-07-13 00:37:50 -07:00
|
|
|
-DLUA_PRG=${LUA_PRG}
|
2014-11-05 05:26:35 -07:00
|
|
|
-DNVIM_PRG=$<TARGET_FILE:nvim>
|
2014-09-29 05:43:52 -07:00
|
|
|
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
|
|
|
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
|
|
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
|
|
|
-DTEST_TYPE=functional
|
2014-11-10 17:26:01 -07:00
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2016-05-16 03:49:32 -07:00
|
|
|
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
|
|
|
${TEST_TARGET_ARGS})
|
2018-06-17 05:54:39 -07:00
|
|
|
set_target_properties(functionaltest functionaltest-prereqs
|
|
|
|
PROPERTIES FOLDER test)
|
2015-03-28 14:28:37 -07:00
|
|
|
|
|
|
|
add_custom_target(benchmark
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DBUSTED_PRG=${BUSTED_PRG}
|
2016-07-13 00:37:50 -07:00
|
|
|
-DLUA_PRG=${LUA_PRG}
|
2015-03-28 14:28:37 -07:00
|
|
|
-DNVIM_PRG=$<TARGET_FILE:nvim>
|
|
|
|
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
|
|
|
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
|
|
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
|
|
|
-DTEST_TYPE=benchmark
|
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2016-05-16 03:49:32 -07:00
|
|
|
DEPENDS ${BENCHMARK_PREREQS}
|
|
|
|
${TEST_TARGET_ARGS})
|
2018-06-17 05:54:39 -07:00
|
|
|
set_target_properties(benchmark benchmark-prereqs PROPERTIES FOLDER test)
|
2014-03-22 04:14:55 -07:00
|
|
|
endif()
|
2015-11-17 05:16:33 -07:00
|
|
|
|
2016-03-06 20:42:49 -07:00
|
|
|
if(BUSTED_LUA_PRG)
|
|
|
|
add_custom_target(functionaltest-lua
|
|
|
|
COMMAND ${CMAKE_COMMAND}
|
|
|
|
-DBUSTED_PRG=${BUSTED_LUA_PRG}
|
2016-07-13 00:37:50 -07:00
|
|
|
-DLUA_PRG=${LUA_PRG}
|
2016-03-06 20:42:49 -07:00
|
|
|
-DNVIM_PRG=$<TARGET_FILE:nvim>
|
|
|
|
-DWORKING_DIR=${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
-DBUSTED_OUTPUT_TYPE=${BUSTED_OUTPUT_TYPE}
|
|
|
|
-DTEST_DIR=${CMAKE_CURRENT_SOURCE_DIR}/test
|
|
|
|
-DBUILD_DIR=${CMAKE_BINARY_DIR}
|
|
|
|
-DTEST_TYPE=functional
|
|
|
|
-P ${PROJECT_SOURCE_DIR}/cmake/RunTests.cmake
|
2016-05-16 03:49:32 -07:00
|
|
|
DEPENDS ${FUNCTIONALTEST_PREREQS}
|
|
|
|
${TEST_TARGET_ARGS})
|
2018-06-17 05:54:39 -07:00
|
|
|
set_target_properties(functionaltest-lua PROPERTIES FOLDER test)
|
2016-03-06 20:42:49 -07:00
|
|
|
endif()
|
|
|
|
|
2015-11-17 05:16:33 -07:00
|
|
|
if(LUACHECK_PRG)
|
2019-07-03 20:30:16 -07:00
|
|
|
add_custom_target(lualint
|
2021-09-19 16:35:38 -07:00
|
|
|
COMMAND ${LUACHECK_PRG} -q runtime/ scripts/ src/ test/
|
2019-07-03 20:30:16 -07:00
|
|
|
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
|
else()
|
|
|
|
add_custom_target(lualint false
|
|
|
|
COMMENT "lualint: LUACHECK_PRG not defined")
|
2015-11-17 05:16:33 -07:00
|
|
|
endif()
|
2016-01-08 17:14:26 -07:00
|
|
|
|
|
|
|
set(CPACK_PACKAGE_NAME "Neovim")
|
|
|
|
set(CPACK_PACKAGE_VENDOR "neovim.io")
|
|
|
|
set(CPACK_PACKAGE_VERSION ${NVIM_VERSION_MEDIUM})
|
|
|
|
set(CPACK_PACKAGE_INSTALL_DIRECTORY "Neovim")
|
|
|
|
# Set toplevel directory/installer name as Neovim
|
|
|
|
set(CPACK_PACKAGE_FILE_NAME "Neovim")
|
|
|
|
set(CPACK_TOPLEVEL_TAG "Neovim")
|
|
|
|
set(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
|
|
|
|
set(CPACK_NSIS_MODIFY_PATH ON)
|
|
|
|
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL ON)
|
|
|
|
include(CPack)
|
2021-03-16 05:33:39 -07:00
|
|
|
|
|
|
|
#add uninstall target
|
|
|
|
if(NOT TARGET uninstall)
|
|
|
|
configure_file(
|
|
|
|
"cmake/UninstallHelper.cmake.in"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake"
|
|
|
|
IMMEDIATE @ONLY)
|
|
|
|
|
|
|
|
add_custom_target(uninstall
|
|
|
|
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/UninstallHelper.cmake)
|
|
|
|
endif()
|