mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
add USE_READLINE cmake flag
This commit is contained in:
parent
186049b3b5
commit
9ed9f6bfc0
@ -27,6 +27,7 @@ option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
|
||||
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
|
||||
option(USE_POC "Build small, uninstalled proof-of-concept binaries" ON)
|
||||
option(USE_QRCODEGEN "Enable libqrcodegen QR code support" OFF)
|
||||
option(USE_READLINE "Enable libreadline line-editing support" ON)
|
||||
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
|
||||
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
||||
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
||||
@ -85,9 +86,11 @@ pkg_search_module(TERMINFO REQUIRED tinfo>=6.1 ncursesw>=6.1)
|
||||
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND terminfo)
|
||||
set_package_properties(terminfo PROPERTIES TYPE REQUIRED)
|
||||
set(PKGCONF_REQ_PRIV "${TERMINFO_LIBRARIES}")
|
||||
if(${USE_READLINE})
|
||||
pkg_search_module(READLINE REQUIRED readline>=8.0)
|
||||
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND readline)
|
||||
set_package_properties(readline PROPERTIES TYPE REQUIRED)
|
||||
endif()
|
||||
if(${USE_FFMPEG})
|
||||
pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0)
|
||||
pkg_check_modules(AVFORMAT REQUIRED libavformat>=57.0)
|
||||
@ -157,7 +160,6 @@ target_include_directories(notcurses-core
|
||||
"${CMAKE_REQUIRED_INCLUDES}"
|
||||
"${PROJECT_BINARY_DIR}/include"
|
||||
"${TERMINFO_INCLUDE_DIRS}"
|
||||
"${READLINE_INCLUDE_DIRS}"
|
||||
)
|
||||
target_include_directories(notcurses-core-static
|
||||
PRIVATE
|
||||
@ -166,12 +168,10 @@ target_include_directories(notcurses-core-static
|
||||
"${CMAKE_REQUIRED_INCLUDES}"
|
||||
"${PROJECT_BINARY_DIR}/include"
|
||||
"${TERMINFO_STATIC_INCLUDE_DIRS}"
|
||||
"${READLINE_STATIC_INCLUDE_DIRS}"
|
||||
)
|
||||
target_link_libraries(notcurses-core
|
||||
PRIVATE
|
||||
"${TERMINFO_LIBRARIES}"
|
||||
"${READLINE_LIBRARIES}"
|
||||
"${LIBM}"
|
||||
"${LIBRT}"
|
||||
"${unistring}"
|
||||
@ -181,7 +181,6 @@ target_link_libraries(notcurses-core
|
||||
target_link_libraries(notcurses-core-static
|
||||
PRIVATE
|
||||
"${TERMINFO_STATIC_LIBRARIES}"
|
||||
"${READLINE_STATIC_LIBRARIES}"
|
||||
"${LIBM}"
|
||||
"${LIBRT}"
|
||||
"${unistring}"
|
||||
@ -191,12 +190,10 @@ target_link_libraries(notcurses-core-static
|
||||
target_link_directories(notcurses-core
|
||||
PRIVATE
|
||||
"${TERMINFO_LIBRARY_DIRS}"
|
||||
"${READLINE_LIBRARY_DIRS}"
|
||||
)
|
||||
target_link_directories(notcurses-core-static
|
||||
PRIVATE
|
||||
"${TERMINFO_STATIC_LIBRARY_DIRS}"
|
||||
"${READLINE_STATIC_LIBRARY_DIRS}"
|
||||
)
|
||||
# don't want these on freebsd/dragonfly/osx
|
||||
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
|
@ -109,7 +109,7 @@ may well be possible to use still older versions. Let me know of any successes!
|
||||
* (OPTIONAL) (OpenImageIO, testing, C++ bindings): A C++17 compiler
|
||||
* (build+runtime) From [NCURSES](https://invisible-island.net/ncurses/announce.html): terminfo 6.1+
|
||||
* (build+runtime) GNU [libunistring](https://www.gnu.org/software/libunistring/) 0.9.10+
|
||||
* (build+runtime) GNU [Readline](https://www.gnu.org/software/readline/) 8.0+
|
||||
* (OPTIONAL) (build+runtime) GNU [Readline](https://www.gnu.org/software/readline/) 8.0+
|
||||
* (OPTIONAL) (build+runtime) From QR-Code-generator: [libqrcodegen](https://github.com/nayuki/QR-Code-generator) 1.5.0+
|
||||
* (OPTIONAL) (build+runtime) From [FFmpeg](https://www.ffmpeg.org/): libswscale 5.0+, libavformat 57.0+, libavutil 56.0+
|
||||
* (OPTIONAL) (build+runtime) [OpenImageIO](https://github.com/OpenImageIO/oiio) 2.15.0+, requires C++
|
||||
|
@ -4,7 +4,9 @@
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <termios.h>
|
||||
#ifdef USE_READLINE
|
||||
#include <readline/readline.h>
|
||||
#endif
|
||||
#include "version.h"
|
||||
#include "visual-details.h"
|
||||
#include "notcurses/direct.h"
|
||||
@ -759,7 +761,9 @@ ncdirect_stop_minimal(void* vnc){
|
||||
ncdirect* nc = vnc;
|
||||
int ret = drop_signals(nc);
|
||||
if(nc->initialized_readline){
|
||||
#ifdef USE_READLINE
|
||||
rl_deprep_terminal();
|
||||
#endif
|
||||
}
|
||||
ret |= reset_term_attributes(&nc->tcache, nc->ttyfp);
|
||||
if(nc->ctermfd >= 0){
|
||||
@ -854,6 +858,7 @@ int ncdirect_stop(ncdirect* nc){
|
||||
}
|
||||
|
||||
char* ncdirect_readline(ncdirect* n, const char* prompt){
|
||||
#ifdef USE_READLINE
|
||||
if(!n->initialized_readline){
|
||||
rl_outstream = n->ttyfp;
|
||||
rl_instream = stdin;
|
||||
@ -861,6 +866,11 @@ char* ncdirect_readline(ncdirect* n, const char* prompt){
|
||||
n->initialized_readline = true;
|
||||
}
|
||||
return readline(prompt);
|
||||
#else
|
||||
(void)n;
|
||||
(void)prompt;
|
||||
return NULL;
|
||||
#endif
|
||||
}
|
||||
|
||||
static inline int
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Populated by CMake; not installed
|
||||
#cmakedefine DFSG_BUILD
|
||||
#cmakedefine USE_QRCODEGEN
|
||||
#cmakedefine USE_READLINE
|
||||
// exclusive with USE_OIIO
|
||||
#cmakedefine USE_FFMPEG
|
||||
// exclusive with USE_FFMPEG
|
||||
|
Loading…
x
Reference in New Issue
Block a user