Windows: Don't build the TUI is systems where it is not supported

The TUI can be enabled/disabled at build time with -DFEAT_TUI, default is ON for
UNIX, and OFF for non UNIX. When off, Neovim prints a message to stderr, along
with a list of the server endpoints.
This commit is contained in:
Rui Abreu Ferreira 2016-05-23 22:16:39 +01:00
parent 1d63672c77
commit 46aac2a09a
5 changed files with 43 additions and 5 deletions

View File

@ -300,11 +300,19 @@ include_directories(SYSTEM ${LIBUV_INCLUDE_DIRS})
find_package(Msgpack 1.0.0 REQUIRED)
include_directories(SYSTEM ${MSGPACK_INCLUDE_DIRS})
find_package(Unibilium REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
if(UNIX)
option(FEAT_TUI "Enable the Terminal UI" ON)
else()
option(FEAT_TUI "Enable the Terminal UI" OFF)
endif()
find_package(LibTermkey REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
if(FEAT_TUI)
find_package(Unibilium REQUIRED)
include_directories(SYSTEM ${UNIBILIUM_INCLUDE_DIRS})
find_package(LibTermkey REQUIRED)
include_directories(SYSTEM ${LIBTERMKEY_INCLUDE_DIRS})
endif()
find_package(LibVterm REQUIRED)
include_directories(SYSTEM ${LIBVTERM_INCLUDE_DIRS})

View File

@ -50,6 +50,7 @@
#cmakedefine USE_FNAME_CASE
#define FEAT_CSCOPE
#cmakedefine FEAT_TUI
#ifndef UNIT_TESTING
#cmakedefine HAVE_JEMALLOC

View File

@ -55,6 +55,10 @@ foreach(subdir
event
eval
)
if(${subdir} MATCHES "tui" AND NOT FEAT_TUI)
continue()
endif()
file(MAKE_DIRECTORY ${GENERATED_DIR}/${subdir})
file(MAKE_DIRECTORY ${GENERATED_INCLUDES_DIR}/${subdir})
file(GLOB sources ${subdir}/*.c)

View File

@ -30,7 +30,11 @@
#include "nvim/screen.h"
#include "nvim/syntax.h"
#include "nvim/window.h"
#include "nvim/tui/tui.h"
#ifdef FEAT_TUI
# include "nvim/tui/tui.h"
#else
# include "nvim/msgpack_rpc/server.h"
#endif
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "ui.c.generated.h"
@ -83,7 +87,22 @@ static int height, width;
void ui_builtin_start(void)
{
#ifdef FEAT_TUI
tui_start();
#else
fprintf(stderr, "Neovim was built without a Terminal UI," \
"press Ctrl+C to exit\n");
size_t len;
char **addrs = server_address_list(&len);
if (addrs != NULL) {
fprintf(stderr, "currently listening on the following address(es)\n");
for (size_t i = 0; i < len; i++) {
fprintf(stderr, "\t%s\n", addrs[i]);
}
xfree(addrs);
}
#endif
}
void ui_builtin_stop(void)

View File

@ -64,6 +64,12 @@ static char *features[] = {
#else
"-jemalloc",
#endif
#ifdef FEAT_TUI
"+tui",
#else
"-tui",
#endif
NULL
};