Very basic Notcurses support. There are bugs! (0.37.45)
This commit is contained in:
parent
4a6903e58a
commit
fd582f4d3a
30 changed files with 465 additions and 5 deletions
|
|
@ -1,5 +1,5 @@
|
|||
cmake_minimum_required(VERSION 3.10)
|
||||
project(fun VERSION 0.37.44 LANGUAGES C)
|
||||
project(fun VERSION 0.37.45 LANGUAGES C)
|
||||
|
||||
set(CMAKE_C_STANDARD 99)
|
||||
set(CMAKE_C_STANDARD_REQUIRED ON)
|
||||
|
|
@ -474,6 +474,38 @@ if(M_LIB)
|
|||
target_link_libraries(fun_core PUBLIC ${M_LIB})
|
||||
endif()
|
||||
|
||||
# Optional Notcurses TUI support (per-opcode files under src/vm/notcurses)
|
||||
option(FUN_WITH_NOTCURSES "Enable Notcurses TUI support" OFF)
|
||||
set(NOTCURSES_INCLUDE_DIRS "")
|
||||
set(NOTCURSES_LINK_LIBS "")
|
||||
if(FUN_WITH_NOTCURSES)
|
||||
message(STATUS "FUN_WITH_NOTCURSES=ON: enabling Notcurses TUI ops")
|
||||
add_definitions(-DFUN_WITH_NOTCURSES)
|
||||
find_package(PkgConfig QUIET)
|
||||
if(PkgConfig_FOUND)
|
||||
# Prefer full 'notcurses', fall back to 'notcurses-core'
|
||||
pkg_check_modules(NOTCURSES QUIET notcurses)
|
||||
if(NOT NOTCURSES_FOUND)
|
||||
pkg_check_modules(NOTCURSES QUIET notcurses-core)
|
||||
endif()
|
||||
endif()
|
||||
if(NOTCURSES_FOUND)
|
||||
list(APPEND NOTCURSES_INCLUDE_DIRS ${NOTCURSES_INCLUDE_DIRS} ${NOTCURSES_INCLUDE_DIRS})
|
||||
list(APPEND NOTCURSES_LINK_LIBS ${NOTCURSES_LINK_LIBS} ${NOTCURSES_LIBRARIES})
|
||||
include_directories(${NOTCURSES_INCLUDE_DIRS})
|
||||
else()
|
||||
message(FATAL_ERROR "FUN_WITH_NOTCURSES=ON but notcurses was not found via pkg-config (tried notcurses and notcurses-core). Install notcurses or configure with -DFUN_WITH_NOTCURSES=OFF")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# notcurses include and link (if enabled)
|
||||
if(NOTCURSES_INCLUDE_DIRS)
|
||||
target_include_directories(fun_core PRIVATE ${NOTCURSES_INCLUDE_DIRS})
|
||||
endif()
|
||||
if(NOTCURSES_LINK_LIBS)
|
||||
target_link_libraries(fun_core PUBLIC ${NOTCURSES_LINK_LIBS})
|
||||
endif()
|
||||
|
||||
# Interpreter /usr/bin/fun
|
||||
option(FUN_WITH_REPL "Enable interactive REPL in the fun CLI" OFF)
|
||||
add_executable(fun
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue