build man pages using ronn

This commit is contained in:
nick black 2019-12-27 07:36:42 -05:00
parent 66057e0363
commit cad8471d76
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
4 changed files with 70 additions and 16 deletions

View File

@ -25,6 +25,7 @@ pkg_check_modules(SWSCALE REQUIRED libswscale>=5.0)
endif()
find_library(LIBRT rt)
# libnotcurses
file(GLOB LIBSRCS CONFIGURE_DEPENDS src/lib/*.c)
add_library(notcurses SHARED ${LIBSRCS})
set_target_properties(notcurses PROPERTIES
@ -77,6 +78,7 @@ target_compile_definitions(notcurses
FORTIFY_SOURCE=2 _GNU_SOURCE SOURCE_DEFAULT
)
# notcurses-demo
file(GLOB DEMOSRCS CONFIGURE_DEPENDS src/demo/*.c)
add_executable(notcurses-demo ${DEMOSRCS})
target_include_directories(notcurses-demo PRIVATE include)
@ -110,6 +112,30 @@ foreach(f ${POCSRCS})
)
endforeach()
# Documentation
file(GLOB MANSOURCE1 CONFIGURE_DEPENDS doc/man/man1/*.ronn)
file(GLOB MANSOURCE3 CONFIGURE_DEPENDS doc/man/man3/*.ronn)
FIND_PROGRAM(RONN ronn)
iF(NOT RONN)
message(WARNING "ronn not found, won't regenerate man pages")
else()
foreach(m ${MANSOURCE1} ${MANSOURCE3})
get_filename_component(me "${m}" NAME_WLE)
add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${m}
DEPENDS ${m}
COMMAND ${RONN}
ARGS -r --pipe ${me}.ronn > ${CMAKE_CURRENT_BINARY_DIR}/${me}
COMMENT "Generating man page with ronn"
)
add_custom_target(docs
ALL
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${m}
)
endforeach()
endif()
# notcurses-input
file(GLOB INPUTSRCS CONFIGURE_DEPENDS src/input/*.cpp)
add_executable(notcurses-input ${INPUTSRCS})
target_include_directories(notcurses-input
@ -130,6 +156,7 @@ target_compile_definitions(notcurses-input
FORTIFY_SOURCE=2
)
# notcurses-planereel
file(GLOB PLANEREELSRCS CONFIGURE_DEPENDS src/planereel/*.cpp)
add_executable(notcurses-planereel ${PLANEREELSRCS})
target_include_directories(notcurses-planereel
@ -150,6 +177,7 @@ target_compile_definitions(notcurses-planereel
FORTIFY_SOURCE=2
)
# notcurses-view
file(GLOB VIEWSRCS CONFIGURE_DEPENDS src/view/*.cpp)
if(NOT "${DISABLE_FFMPEG}")
add_executable(notcurses-view ${VIEWSRCS})
@ -181,6 +209,7 @@ target_compile_definitions(notcurses-view
)
endif()
# Testing
file(GLOB TESTSRCS CONFIGURE_DEPENDS tests/*.cpp)
add_executable(notcurses-tester ${TESTSRCS})
find_package(GTest 1.9 REQUIRED)
@ -205,11 +234,13 @@ target_compile_definitions(notcurses-tester
gtest_discover_tests(notcurses-tester)
enable_testing()
# pkg-config support
configure_file(tools/notcurses.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
@ONLY
)
# CMake support
include(CMakePackageConfigHelpers)
configure_package_config_file(tools/notcursesConfig.cmake.in
@ -222,6 +253,7 @@ write_basic_package_version_file(
COMPATIBILITY SameMajorVersion
)
# Installation
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfigVersion.cmake
@ -239,8 +271,8 @@ install(FILES
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/notcurses
)
file(GLOB MANPAGES1 CONFIGURE_DEPENDS doc/man/man1/*)
file(GLOB MANPAGES3 CONFIGURE_DEPENDS doc/man/man3/*)
file(GLOB MANPAGES1 CONFIGURE_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/*.1)
file(GLOB MANPAGES3 CONFIGURE_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/*.3notcurses)
install(FILES
${MANPAGES1}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1

View File

@ -105,6 +105,7 @@ that fine library.
* CMake 3.13.0+
* From NCURSES: terminfo 6.1+
* (OPTIONAL) From FFMpeg: libswscale 5.0+, libavformat 57.0+, libavutil 56.0+
* (man pages) [ronn](https://github.com/rtomayko/ronn) 0.8+
### Building

View File

@ -1,14 +0,0 @@
.TH notcurses 3notcurses "2019-12-12"
.SH NAME
notcurses \- TUI library for modern terminal emulators
.SH SYNOPSIS
.B #include <notcurses.h>
.SH DESCRIPTION
.SH NOTES
.SH SEE ALSO
notcurses-demo(1)

View File

@ -0,0 +1,35 @@
notcurses(3notcurses) -- TUI library for modern terminal emulators
==================================================================
## SYNOPSIS
`#include <notcurses.h>`
`-lnotcurses`
## DESCRIPTION
notcurses builds atop the terminfo(5) abstraction layer to provide reasonably
portable vivid character displays. It is an intellectual descendant of
ncurses(3NCURSES), but goes beyond that library (and the X/Open Curses API it
implements). notcurses is capable of subregion fades, 24bpp DirectColor,
transparency, multimedia, and safe multithreaded use.
A program wishing to use notcurses will need to link it, ideally using the
output of `pkg-config --libs notcurses` (see pkg-config(1)). It is advised to
compile with the output of `pkg-config --cflags notcurses`. If using CMake, a
support file is provided, and can be accessed as `notcurses` (see cmake(1)).
Before calling into notcurses—and usually as one of the first calls of the
program—be sure to call `setlocale(3)` with an appropriate UTF-8 `LC_ALL`
locale. It is usually appropriate to use `setlocale(LC_ALL, "")`, relying on
the user to properly set the `LANG` environment variable. notcurses will
refuse to start if `nl_langinfo(3)` doesn't indicate UTF-8.
## AUTHORS
Nick Black <nickblack@linux.com>
## SEE ALSO
notcurses-demo(1), ncurses(3NCURSES), terminfo(5)