2020-01-02 00:06:57 +00:00
|
|
|
cmake_minimum_required(VERSION 3.14)
|
2020-05-28 21:24:11 +00:00
|
|
|
project(notcurses VERSION 1.4.3
|
2019-12-02 11:02:03 +00:00
|
|
|
DESCRIPTION "UI for modern terminal emulators"
|
2019-11-17 10:04:41 +00:00
|
|
|
HOMEPAGE_URL "https://nick-black.com/dankwiki/index.php/notcurses"
|
|
|
|
LANGUAGES C CXX)
|
2019-12-03 18:31:04 +00:00
|
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
2019-11-17 10:04:41 +00:00
|
|
|
set(CMAKE_C_STANDARD 11)
|
2019-11-27 06:02:05 +00:00
|
|
|
set(CMAKE_C_VISIBILITY_PRESET hidden)
|
2019-12-27 22:20:20 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
2019-11-27 06:02:05 +00:00
|
|
|
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
|
2019-11-17 10:04:41 +00:00
|
|
|
|
|
|
|
include(GNUInstallDirs)
|
2020-02-23 02:28:36 +00:00
|
|
|
|
2020-02-18 17:36:16 +00:00
|
|
|
###################### USER-SELECTABLE OPTIONS ###########################
|
2020-05-29 06:47:29 +00:00
|
|
|
# BUILD_TESTING is defined by CTest
|
2020-02-18 17:36:16 +00:00
|
|
|
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
|
2020-05-20 03:12:27 +00:00
|
|
|
option(USE_COVERAGE "Assess code coverage with llvm-cov/lcov" OFF)
|
2020-02-20 05:25:59 +00:00
|
|
|
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
|
2020-02-18 17:36:16 +00:00
|
|
|
option(USE_NETWORK "Allow cargo to use the network" OFF)
|
|
|
|
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
|
|
|
|
option(USE_PYTHON "Build Python wrappers" ON)
|
2020-04-21 03:26:41 +00:00
|
|
|
option(USE_QRCODEGEN "Disable libqrcodegen QR code support" ON)
|
2020-04-08 04:12:22 +00:00
|
|
|
option(USE_RUST "Build Rust wrappers (experimental)" OFF)
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
option(USE_SIXEL "Build Sixel support" OFF)
|
2020-05-22 03:46:25 +00:00
|
|
|
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
|
2020-04-23 11:09:54 +00:00
|
|
|
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
|
|
|
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
2020-05-20 03:12:27 +00:00
|
|
|
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo Coverage)
|
2020-02-18 17:36:16 +00:00
|
|
|
############## END (additional) USER-SELECTABLE OPTIONS ##################
|
2020-04-23 11:09:54 +00:00
|
|
|
set(USE_FFMPEG OFF)
|
|
|
|
set(USE_OIIO OFF)
|
|
|
|
if(${USE_MULTIMEDIA} STREQUAL "ffmpeg")
|
|
|
|
set(USE_FFMPEG ON)
|
|
|
|
elseif(${USE_MULTIMEDIA} STREQUAL "oiio")
|
|
|
|
set(USE_OIIO ON)
|
2020-04-25 19:52:23 +00:00
|
|
|
elseif(NOT ${USE_MULTIMEDIA} STREQUAL "none")
|
|
|
|
message(FATAL_ERROR "USE_MULTIMEDIA must be one of 'oiio', 'ffmpeg', 'none' (was '${USE_MULTIMEDIA}')")
|
2020-04-23 11:09:54 +00:00
|
|
|
endif()
|
2019-12-25 07:00:53 +00:00
|
|
|
|
2020-05-06 09:24:23 +00:00
|
|
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
|
|
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE
|
|
|
|
STRING "Choose the build mode." FORCE)
|
|
|
|
endif()
|
|
|
|
string(APPEND CMAKE_C_FLAGS_DEBUG " -O0")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -O0")
|
2020-05-20 03:12:27 +00:00
|
|
|
if("${USE_COVERAGE}")
|
|
|
|
if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
|
|
|
message(FATAL_ERROR "USE_COVERAGE was on but CC isn't clang")
|
|
|
|
endif()
|
|
|
|
if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
|
|
|
|
message(FATAL_ERROR "USE_COVERAGE was on but CXX isn't clang++")
|
|
|
|
endif()
|
|
|
|
# FIXME requires clang11+
|
|
|
|
string(APPEND CMAKE_C_FLAGS_DEBUG " --coverage -fprofile-instr-generate -fcoverage-mapping")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " --coverage -fprofile-instr-generate -fcoverage-mapping")
|
|
|
|
endif()
|
2020-05-06 09:24:23 +00:00
|
|
|
|
|
|
|
# global compiler flags
|
|
|
|
add_compile_definitions(FORTIFY_SOURCE=2)
|
2020-05-22 07:31:03 +00:00
|
|
|
add_compile_options(-Wall -Wextra -W -Wshadow -Wformat -fexceptions)
|
2020-05-06 09:24:23 +00:00
|
|
|
|
|
|
|
message(STATUS "Requested multimedia engine: ${USE_MULTIMEDIA}")
|
|
|
|
message(STATUS "Requested build mode: ${CMAKE_BUILD_TYPE}")
|
|
|
|
|
2019-11-17 17:55:12 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
2019-12-01 22:48:38 +00:00
|
|
|
find_package(Threads REQUIRED)
|
2019-11-17 17:55:12 +00:00
|
|
|
pkg_check_modules(TERMINFO REQUIRED tinfo>=6.1)
|
2020-02-18 17:36:16 +00:00
|
|
|
if(${USE_FFMPEG})
|
2020-02-07 03:55:55 +00:00
|
|
|
pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0)
|
2019-11-28 16:15:29 +00:00
|
|
|
pkg_check_modules(AVFORMAT REQUIRED libavformat>=57.0)
|
2020-02-07 03:55:55 +00:00
|
|
|
pkg_check_modules(AVUTIL REQUIRED libavutil>=56.0)
|
2019-11-28 16:15:29 +00:00
|
|
|
pkg_check_modules(SWSCALE REQUIRED libswscale>=5.0)
|
2020-04-24 04:05:01 +00:00
|
|
|
elseif(${USE_OIIO})
|
2020-04-26 01:50:42 +00:00
|
|
|
pkg_check_modules(OIIO REQUIRED OpenImageIO>=2.1)
|
2019-12-25 07:00:53 +00:00
|
|
|
endif()
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
if(${USE_SIXEL})
|
|
|
|
pkg_check_modules(SIXEL REQUIRED libsixel>=1.8.5)
|
|
|
|
endif()
|
2020-05-09 07:47:56 +00:00
|
|
|
find_library(MATH_LIBRARIES m)
|
2020-05-07 21:14:45 +00:00
|
|
|
check_include_file("qrcodegen/qrcodegen.h" HAVE_QRCODEGEN_H)
|
|
|
|
if("${USE_QRCODEGEN}")
|
|
|
|
if(NOT "${HAVE_QRCODEGEN_H}")
|
|
|
|
message(FATAL_ERROR "USE_QRCODEGEN is active, but couldn't find qrcodegen.h")
|
|
|
|
endif()
|
|
|
|
endif()
|
2019-11-23 14:05:32 +00:00
|
|
|
find_library(LIBRT rt)
|
2020-05-29 06:47:29 +00:00
|
|
|
if(${BUILD_TESTING})
|
2020-02-19 01:03:20 +00:00
|
|
|
find_package(doctest 2.3.5 REQUIRED)
|
2020-04-08 06:12:46 +00:00
|
|
|
endif()
|
2019-11-17 17:55:12 +00:00
|
|
|
|
2020-04-23 07:52:07 +00:00
|
|
|
# libnotcurses (core shared library and static library)
|
|
|
|
file(GLOB NCSRCS CONFIGURE_DEPENDS src/lib/*.c src/lib/*.cpp)
|
2020-01-30 13:55:01 +00:00
|
|
|
add_library(notcurses SHARED ${NCSRCS})
|
2020-05-22 03:46:25 +00:00
|
|
|
if(${USE_STATIC})
|
2020-02-09 01:49:10 +00:00
|
|
|
add_library(notcurses-static STATIC ${NCSRCS})
|
2020-05-22 03:46:25 +00:00
|
|
|
else()
|
|
|
|
add_library(notcurses-static STATIC EXCLUDE_FROM_ALL ${NCSRCS})
|
|
|
|
endif()
|
2020-02-09 01:49:10 +00:00
|
|
|
set_target_properties(
|
|
|
|
notcurses-static PROPERTIES
|
2020-05-28 21:24:11 +00:00
|
|
|
OUTPUT_NAME notcurses
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
|
|
|
|
2019-12-25 07:00:53 +00:00
|
|
|
set_target_properties(notcurses PROPERTIES
|
2020-05-28 21:24:11 +00:00
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
|
|
|
)
|
|
|
|
set_target_properties(notcurses-static PROPERTIES
|
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2019-11-17 10:04:41 +00:00
|
|
|
target_include_directories(notcurses
|
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
2019-12-27 10:27:51 +00:00
|
|
|
"${TERMINFO_INCLUDE_DIRS}"
|
2019-12-25 07:00:53 +00:00
|
|
|
)
|
2020-02-09 01:49:10 +00:00
|
|
|
target_include_directories(notcurses-static
|
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
2020-02-09 05:08:11 +00:00
|
|
|
"${TERMINFO_STATIC_INCLUDE_DIRS}"
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2019-12-25 07:00:53 +00:00
|
|
|
target_link_libraries(notcurses
|
|
|
|
PRIVATE
|
|
|
|
"${TERMINFO_LIBRARIES}"
|
|
|
|
"${LIBRT}"
|
2020-04-08 13:37:11 +00:00
|
|
|
PUBLIC
|
|
|
|
Threads::Threads
|
2019-12-25 07:00:53 +00:00
|
|
|
)
|
2020-02-09 01:49:10 +00:00
|
|
|
target_link_libraries(notcurses-static
|
|
|
|
PRIVATE
|
2020-02-09 05:08:11 +00:00
|
|
|
"${TERMINFO_STATIC_LIBRARIES}"
|
2020-02-09 01:49:10 +00:00
|
|
|
"${LIBRT}"
|
2020-04-08 13:37:11 +00:00
|
|
|
PUBLIC
|
|
|
|
Threads::Threads
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2019-12-25 07:00:53 +00:00
|
|
|
target_link_directories(notcurses
|
|
|
|
PRIVATE
|
|
|
|
"${TERMINFO_LIBRARY_DIRS}"
|
|
|
|
)
|
2020-02-09 01:49:10 +00:00
|
|
|
target_link_directories(notcurses-static
|
|
|
|
PRIVATE
|
2020-02-09 05:08:11 +00:00
|
|
|
"${TERMINFO_STATIC_LIBRARY_DIRS}"
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2019-12-25 07:00:53 +00:00
|
|
|
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
if(${USE_SIXEL})
|
|
|
|
target_link_libraries(notcurses PRIVATE "${SIXEL_LIBRARIES}")
|
|
|
|
target_link_libraries(notcurses-static PRIVATE "${SIXEL_LIBRARIES}")
|
|
|
|
target_include_directories(notcurses PRIVATE "${SIXEL_INCLUDE_DIRS}")
|
|
|
|
target_include_directories(notcurses-static PRIVATE "${SIXEL_INCLUDE_DIRS}")
|
|
|
|
target_link_libraries(notcurses PRIVATE "${SIXEL_LIBRARY_DIRS}")
|
|
|
|
target_link_libraries(notcurses-static PRIVATE "${SIXEL_LIBRARY_DIRS}")
|
|
|
|
endif()
|
|
|
|
|
2020-04-21 03:26:41 +00:00
|
|
|
if(${USE_QRCODEGEN})
|
|
|
|
target_link_libraries(notcurses PRIVATE qrcodegen)
|
|
|
|
target_link_libraries(notcurses-static PRIVATE qrcodegen)
|
|
|
|
endif()
|
|
|
|
|
2020-02-18 17:36:16 +00:00
|
|
|
if(${USE_FFMPEG})
|
2019-12-25 07:00:53 +00:00
|
|
|
target_include_directories(notcurses
|
2020-02-01 09:12:54 +00:00
|
|
|
PUBLIC
|
2020-02-07 03:55:55 +00:00
|
|
|
"${AVCODEC_INCLUDE_DIRS}"
|
2019-12-27 10:27:51 +00:00
|
|
|
"${AVFORMAT_INCLUDE_DIRS}"
|
2020-02-01 09:12:54 +00:00
|
|
|
"${AVUTIL_INCLUDE_DIRS}"
|
2019-12-27 10:27:51 +00:00
|
|
|
"${SWSCALE_INCLUDE_DIRS}"
|
2019-11-17 17:55:12 +00:00
|
|
|
)
|
2020-02-09 01:49:10 +00:00
|
|
|
target_include_directories(notcurses-static
|
|
|
|
PUBLIC
|
2020-02-09 05:08:11 +00:00
|
|
|
"${AVCODEC_STATIC_INCLUDE_DIRS}"
|
|
|
|
"${AVFORMAT_STATIC_INCLUDE_DIRS}"
|
|
|
|
"${AVUTIL_STATIC_INCLUDE_DIRS}"
|
|
|
|
"${SWSCALE_STATIC_INCLUDE_DIRS}"
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2019-11-17 17:55:12 +00:00
|
|
|
target_link_libraries(notcurses
|
2019-11-23 14:05:32 +00:00
|
|
|
PRIVATE
|
2020-02-07 03:55:55 +00:00
|
|
|
"${AVCODEC_LIBRARIES}"
|
2019-11-25 03:22:18 +00:00
|
|
|
"${AVFORMAT_LIBRARIES}"
|
2019-11-27 22:22:35 +00:00
|
|
|
"${SWSCALE_LIBRARIES}"
|
2020-04-23 11:09:54 +00:00
|
|
|
PUBLIC
|
|
|
|
"${AVUTIL_LIBRARIES}"
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
|
|
|
target_link_libraries(notcurses-static
|
|
|
|
PRIVATE
|
2020-02-09 05:08:11 +00:00
|
|
|
"${AVCODEC_STATIC_LIBRARIES}"
|
|
|
|
"${AVFORMAT_STATIC_LIBRARIES}"
|
|
|
|
"${SWSCALE_STATIC_LIBRARIES}"
|
2020-04-23 11:09:54 +00:00
|
|
|
PUBLIC
|
|
|
|
"${AVUTIL_STATIC_LIBRARIES}"
|
2019-11-17 10:04:41 +00:00
|
|
|
)
|
2019-12-01 17:42:18 +00:00
|
|
|
target_link_directories(notcurses
|
2020-04-23 11:09:54 +00:00
|
|
|
PRIVATE
|
2020-02-07 03:55:55 +00:00
|
|
|
"${AVCODEC_LIBRARY_DIRS}"
|
2019-12-01 17:42:18 +00:00
|
|
|
"${AVFORMAT_LIBRARY_DIRS}"
|
|
|
|
"${SWSCALE_LIBRARY_DIRS}"
|
2020-04-23 11:09:54 +00:00
|
|
|
PUBLIC
|
|
|
|
"${AVUTIL_LIBRARY_DIRS}"
|
2019-12-01 17:42:18 +00:00
|
|
|
)
|
2020-02-09 01:49:10 +00:00
|
|
|
target_link_directories(notcurses-static
|
2020-04-23 11:09:54 +00:00
|
|
|
PRIVATE
|
2020-02-09 05:08:11 +00:00
|
|
|
"${AVCODEC_STATIC_LIBRARY_DIRS}"
|
|
|
|
"${AVFORMAT_STATIC_LIBRARY_DIRS}"
|
|
|
|
"${SWSCALE_STATIC_LIBRARY_DIRS}"
|
2020-04-23 11:09:54 +00:00
|
|
|
PUBLIC
|
|
|
|
"${AVUTIL_STATIC_LIBRARY_DIRS}"
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2020-04-24 04:05:01 +00:00
|
|
|
elseif(${USE_OIIO})
|
|
|
|
target_include_directories(notcurses PUBLIC "${OIIO_INCLUDE_DIRS}")
|
|
|
|
target_include_directories(notcurses-static PUBLIC "${OIIO_STATIC_INCLUDE_DIRS}")
|
|
|
|
target_link_libraries(notcurses PRIVATE ${OIIO_LIBRARIES})
|
|
|
|
target_link_libraries(notcurses-static PRIVATE ${OIIO_STATIC_LIBRARIES})
|
|
|
|
target_link_directories(notcurses PRIVATE ${OIIO_LIBRARY_DIRS})
|
|
|
|
target_link_directories(notcurses-static PRIVATE ${OIIO_STATIC_LIBRARY_DIRS})
|
2019-12-25 07:00:53 +00:00
|
|
|
endif()
|
2019-11-17 10:04:41 +00:00
|
|
|
|
2019-11-18 03:02:43 +00:00
|
|
|
target_compile_definitions(notcurses
|
2019-11-26 06:42:04 +00:00
|
|
|
PUBLIC
|
2019-12-27 06:41:14 +00:00
|
|
|
_XOPEN_SOURCE # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
2019-12-03 18:26:49 +00:00
|
|
|
PRIVATE
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
_GNU_SOURCE SOURCE_DEFAULT
|
2019-11-18 03:02:43 +00:00
|
|
|
)
|
2020-02-09 01:49:10 +00:00
|
|
|
target_compile_definitions(notcurses-static
|
|
|
|
PUBLIC
|
|
|
|
_XOPEN_SOURCE # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
|
|
|
PRIVATE
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
_GNU_SOURCE SOURCE_DEFAULT
|
2020-02-09 01:49:10 +00:00
|
|
|
)
|
2019-11-18 03:02:43 +00:00
|
|
|
|
2020-01-07 22:51:34 +00:00
|
|
|
# libnotcurses++
|
|
|
|
set(NCPP_SOURCES
|
2020-05-02 21:01:21 +00:00
|
|
|
src/libcpp/FDPlane.cc
|
2020-02-15 22:04:39 +00:00
|
|
|
src/libcpp/Menu.cc
|
2020-03-14 23:35:54 +00:00
|
|
|
src/libcpp/MultiSelector.cc
|
2020-01-07 22:51:34 +00:00
|
|
|
src/libcpp/NotCurses.cc
|
|
|
|
src/libcpp/Plane.cc
|
2020-05-02 21:01:21 +00:00
|
|
|
src/libcpp/Plot.cc
|
2020-02-05 22:29:42 +00:00
|
|
|
src/libcpp/Reel.cc
|
2020-01-07 22:51:34 +00:00
|
|
|
src/libcpp/Root.cc
|
2020-02-15 22:04:39 +00:00
|
|
|
src/libcpp/Selector.cc
|
2020-05-02 21:01:21 +00:00
|
|
|
src/libcpp/Subproc.cc
|
2020-01-07 22:51:34 +00:00
|
|
|
src/libcpp/Tablet.cc
|
2020-05-22 20:11:59 +00:00
|
|
|
src/libcpp/Utilities.cc
|
2020-01-07 22:51:34 +00:00
|
|
|
)
|
|
|
|
|
2020-05-22 03:46:25 +00:00
|
|
|
add_library(notcurses++ SHARED ${NCPP_SOURCES})
|
|
|
|
if(${USE_STATIC})
|
|
|
|
add_library(notcurses++-static STATIC ${NCPP_SOURCES})
|
|
|
|
else()
|
|
|
|
add_library(notcurses++-static STATIC EXCLUDE_FROM_ALL ${NCPP_SOURCES})
|
|
|
|
endif()
|
2020-01-07 22:51:34 +00:00
|
|
|
set_target_properties(
|
|
|
|
notcurses++-static PROPERTIES
|
2020-05-28 21:24:11 +00:00
|
|
|
OUTPUT_NAME notcurses++
|
2020-01-07 22:51:34 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set_target_properties(
|
|
|
|
notcurses++ PROPERTIES
|
2020-05-28 21:24:11 +00:00
|
|
|
VERSION ${PROJECT_VERSION}
|
|
|
|
SOVERSION ${PROJECT_VERSION_MAJOR}
|
|
|
|
OUTPUT_NAME "notcurses++")
|
2020-01-07 22:51:34 +00:00
|
|
|
|
|
|
|
set(NCPP_INCLUDE_DIRS
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
|
|
|
"${TERMINFO_INCLUDE_DIRS}"
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(notcurses++
|
|
|
|
PRIVATE ${NCPP_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(notcurses++-static
|
|
|
|
PRIVATE ${NCPP_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(notcurses++
|
2020-03-15 05:19:47 +00:00
|
|
|
PUBLIC
|
2020-01-07 22:51:34 +00:00
|
|
|
notcurses)
|
|
|
|
|
|
|
|
set(NCPP_COMPILE_OPTIONS
|
|
|
|
-Werror=format-security
|
|
|
|
-Wnull-dereference
|
|
|
|
-Wmisleading-indentation
|
|
|
|
-Wunused
|
|
|
|
-Wpedantic
|
|
|
|
-Wsuggest-override
|
|
|
|
-Wno-c99-extensions
|
|
|
|
-fno-strict-aliasing
|
|
|
|
-ffunction-sections
|
|
|
|
-funswitch-loops
|
|
|
|
-finline-limit=300
|
|
|
|
-fstack-protector
|
|
|
|
-fno-rtti
|
|
|
|
-fno-exceptions
|
|
|
|
-fpic
|
|
|
|
)
|
|
|
|
|
|
|
|
set(NCPP_COMPILE_DEFINITIONS_PUBLIC
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
_GNU_SOURCE SOURCE_DEFAULT
|
2020-01-07 22:51:34 +00:00
|
|
|
)
|
|
|
|
set(NCPP_COMPILE_DEFINITIONS_PRIVATE
|
|
|
|
_XOPEN_SOURCE # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_options(notcurses++
|
|
|
|
PRIVATE
|
|
|
|
${NCPP_COMPILLE_OPTIONS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_options(notcurses++-static
|
|
|
|
PRIVATE
|
|
|
|
${NCPP_COMPILLE_OPTIONS}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(notcurses++
|
|
|
|
PUBLIC
|
|
|
|
${NCPP_COMPILE_DEFINITIONS_PUBLIC}
|
|
|
|
PRIVATE
|
|
|
|
${NCPP_COMPILE_DEFINITIONS_PRIVATE}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(notcurses++-static
|
|
|
|
PUBLIC
|
|
|
|
${NCPP_COMPILE_DEFINITIONS_PUBLIC}
|
|
|
|
PRIVATE
|
|
|
|
${NCPP_COMPILE_DEFINITIONS_PRIVATE}
|
|
|
|
)
|
|
|
|
|
2020-04-10 19:59:13 +00:00
|
|
|
file(GLOB NOTCURSES_HEADERS
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
LIST_DIRECTORIES false
|
2020-04-23 11:09:54 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include/notcurses/*.h)
|
2020-04-10 19:59:13 +00:00
|
|
|
|
2020-01-07 22:51:34 +00:00
|
|
|
file(GLOB NCPP_HEADERS
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
LIST_DIRECTORIES false
|
2020-04-23 11:09:54 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include/ncpp/*.hh)
|
2020-01-07 22:51:34 +00:00
|
|
|
|
|
|
|
file(GLOB NCPP_INTERNAL_HEADERS
|
|
|
|
CONFIGURE_DEPENDS
|
|
|
|
LIST_DIRECTORIES false
|
2020-04-23 11:09:54 +00:00
|
|
|
${PROJECT_SOURCE_DIR}/include/ncpp/internal/*.hh)
|
2020-01-07 22:51:34 +00:00
|
|
|
|
2020-05-09 09:51:00 +00:00
|
|
|
export(PACKAGE notcurses)
|
|
|
|
|
2020-04-10 19:59:13 +00:00
|
|
|
install(FILES ${NOTCURSES_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/notcurses)
|
2020-01-07 22:51:34 +00:00
|
|
|
install(FILES ${NCPP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ncpp)
|
|
|
|
install(FILES ${NCPP_INTERNAL_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/ncpp/internal)
|
|
|
|
|
2019-12-27 12:36:42 +00:00
|
|
|
# notcurses-demo
|
2019-11-27 20:22:54 +00:00
|
|
|
file(GLOB DEMOSRCS CONFIGURE_DEPENDS src/demo/*.c)
|
|
|
|
add_executable(notcurses-demo ${DEMOSRCS})
|
2020-01-05 09:53:43 +00:00
|
|
|
target_include_directories(notcurses-demo
|
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
2020-02-01 09:12:54 +00:00
|
|
|
PUBLIC
|
2020-02-07 05:13:32 +00:00
|
|
|
"${AVCODEC_INCLUDE_DIRS}"
|
2020-02-01 09:12:54 +00:00
|
|
|
"${AVFORMAT_INCLUDE_DIRS}"
|
|
|
|
"${AVUTIL_INCLUDE_DIRS}"
|
|
|
|
"${SWSCALE_INCLUDE_DIRS}"
|
2020-01-05 09:53:43 +00:00
|
|
|
)
|
2019-11-17 10:04:41 +00:00
|
|
|
target_link_libraries(notcurses-demo
|
|
|
|
PRIVATE
|
|
|
|
notcurses
|
2020-05-09 07:47:56 +00:00
|
|
|
${MATH_LIBRARIES}
|
2019-11-17 10:04:41 +00:00
|
|
|
)
|
2019-12-03 18:26:49 +00:00
|
|
|
target_compile_definitions(notcurses-demo
|
|
|
|
PRIVATE
|
Fully general ncvisual layer (#647)
This represents an essentially complete rewrite of ncvisual and associated code. It had two major goals:
Improve the ncvisual API based off lessons learned, pursuant to the upcoming API freeze. In particular, I wanted to:
decouple ncvisuals from ncplanes. It should be possible to render a ncvisual to multiple planes, with different scaling each time. It should be possible to create an ncvisual without a plane, etc.
normalize the various ways of constructing an ncvisual -- file, memory, plane, etc.
Support multiple blitters, from 7-bit ASCII to Sixel. This required writing the blitters in several cases, and they're not yet in their final implementations (but the API is fine)
I have not yet unified Plots and Visuals, and might not, given that the Plot code works fine. We could at this point implement Plots in terms of Visuals, though -- the blitter backend range has been unified. Sixel is not yet implemented, though it is listed.
There is a new POC tool, blitter. It renders its arguments using all possible blitter+scaling combinations. Another new POC, resize, displays its argument, then resizes it to the screen size and displays that, explicitly making use of ncvisual_resize() rather than a scaling parameter to ncvisual_render().
This also eliminates some memory leaks and bugs we were seeing in trunk, and brings in Sixel scaffolding.
The C++ wrapper will also need patching back up; I cut most of it down while wrestling with this crap, urk.
Closes #638, #562, and #622.
2020-05-29 01:16:58 +00:00
|
|
|
_GNU_SOURCE
|
2019-12-03 18:26:49 +00:00
|
|
|
)
|
2019-11-17 10:04:41 +00:00
|
|
|
|
2019-12-12 09:52:59 +00:00
|
|
|
# tiny proofs of concept, one binary per source file
|
2019-12-17 05:33:51 +00:00
|
|
|
file(GLOB POCSRCS CONFIGURE_DEPENDS src/poc/*.c src/poc/*.cpp)
|
2019-12-12 09:52:59 +00:00
|
|
|
foreach(f ${POCSRCS})
|
|
|
|
get_filename_component(fe "${f}" NAME_WE)
|
|
|
|
add_executable(${fe} ${f})
|
|
|
|
target_include_directories(${fe}
|
2019-12-27 10:27:51 +00:00
|
|
|
PRIVATE include "${TERMINFO_INCLUDE_DIRS}"
|
2020-04-08 06:12:46 +00:00
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
2019-12-12 09:52:59 +00:00
|
|
|
)
|
|
|
|
target_link_libraries(${fe}
|
2020-04-02 23:42:17 +00:00
|
|
|
PRIVATE notcurses++ "${TERMINFO_LIBRARIES}"
|
2019-12-12 09:52:59 +00:00
|
|
|
)
|
|
|
|
target_link_directories(${fe}
|
|
|
|
PRIVATE "${TERMINFO_LIBRARY_DIRS}"
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
2020-02-18 17:36:16 +00:00
|
|
|
# Pandoc documentation (man pages, HTML reference)
|
|
|
|
if(USE_PANDOC)
|
|
|
|
file(GLOB MANSOURCE1 CONFIGURE_DEPENDS doc/man/man1/*.md)
|
|
|
|
file(GLOB MANSOURCE3 CONFIGURE_DEPENDS doc/man/man3/*.md)
|
|
|
|
find_program(PANDOC pandoc)
|
|
|
|
if(NOT PANDOC)
|
|
|
|
message(FATAL_ERROR "pandoc not found. USE_PANDOC=OFF to disable.")
|
|
|
|
else()
|
|
|
|
foreach(m ${MANSOURCE3} ${MANSOURCE1})
|
|
|
|
get_filename_component(me ${m} NAME_WLE)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${me}
|
|
|
|
DEPENDS ${m}
|
|
|
|
COMMAND ${PANDOC}
|
|
|
|
ARGS --to man --standalone ${m} > ${CMAKE_CURRENT_BINARY_DIR}/${me}
|
|
|
|
COMMENT "Building man page ${me}"
|
|
|
|
)
|
|
|
|
add_custom_target(${me}.man
|
|
|
|
ALL
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${me}
|
|
|
|
)
|
|
|
|
file(GLOB ANALHTML doc/analytics-header.html)
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${me}.html
|
|
|
|
DEPENDS ${m} ${ANALHTML}
|
|
|
|
COMMAND ${PANDOC}
|
|
|
|
ARGS -H ${ANALHTML} --to html --standalone ${m} > ${CMAKE_CURRENT_BINARY_DIR}/${me}.html
|
|
|
|
COMMENT "Building HTML5 ${me}.html"
|
|
|
|
)
|
|
|
|
add_custom_target(${me}.html5
|
|
|
|
ALL
|
|
|
|
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${me}.html
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
foreach(m ${MANSOURCE3})
|
|
|
|
get_filename_component(me ${m} NAME_WLE)
|
2020-04-23 11:09:54 +00:00
|
|
|
LIST(APPEND MANPAGES3 ${CMAKE_CURRENT_BINARY_DIR}/${me})
|
2020-02-18 17:36:16 +00:00
|
|
|
endforeach()
|
|
|
|
foreach(m ${MANSOURCE1})
|
|
|
|
get_filename_component(me ${m} NAME_WLE)
|
2020-04-23 11:09:54 +00:00
|
|
|
LIST(APPEND MANPAGES1 ${CMAKE_CURRENT_BINARY_DIR}/${me})
|
2020-02-18 17:36:16 +00:00
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Doxygen
|
|
|
|
if(USE_DOXYGEN)
|
|
|
|
find_package(Doxygen REQUIRED dot dia)
|
|
|
|
if(NOT ${DOXYGEN_FOUND})
|
|
|
|
message(FATAL_ERROR "doxygen not found. USE_DOXYGEN=OFF to disable.")
|
|
|
|
else()
|
|
|
|
set(DOXYFILE ${CMAKE_CURRENT_SOURCE_DIR}/doc/Doxyfile)
|
|
|
|
# FIXME should dep on all source, i suppose, yuck
|
2020-01-14 21:20:24 +00:00
|
|
|
add_custom_command(
|
2020-02-18 17:36:16 +00:00
|
|
|
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
|
|
|
|
DEPENDS ${DOXYFILE}
|
|
|
|
COMMAND Doxygen::doxygen
|
|
|
|
ARGS ${DOXYFILE}
|
|
|
|
COMMENT "Running doxygen"
|
2020-01-14 21:20:24 +00:00
|
|
|
)
|
2020-02-18 17:36:16 +00:00
|
|
|
add_custom_target(doxygen
|
2020-01-14 21:20:24 +00:00
|
|
|
ALL
|
2020-02-18 17:36:16 +00:00
|
|
|
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
|
2020-01-14 21:20:24 +00:00
|
|
|
)
|
2020-02-18 17:36:16 +00:00
|
|
|
endif()
|
2019-12-27 12:36:42 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-08 13:13:39 +00:00
|
|
|
# notcurses-input
|
2020-04-02 23:42:17 +00:00
|
|
|
file(GLOB INPUTSRCS CONFIGURE_DEPENDS src/input/input.cpp)
|
2019-11-29 05:20:30 +00:00
|
|
|
add_executable(notcurses-input ${INPUTSRCS})
|
|
|
|
target_include_directories(notcurses-input
|
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
|
|
|
)
|
|
|
|
target_link_libraries(notcurses-input
|
|
|
|
PRIVATE
|
2020-04-02 23:42:17 +00:00
|
|
|
notcurses++
|
2019-11-29 05:20:30 +00:00
|
|
|
)
|
|
|
|
|
2020-02-06 01:18:11 +00:00
|
|
|
# notcurses-ncreel
|
2020-04-02 23:42:17 +00:00
|
|
|
file(GLOB NCREELSRCS CONFIGURE_DEPENDS src/ncreel/*.cpp)
|
|
|
|
add_executable(notcurses-ncreel ${NCREELSRCS})
|
2020-02-06 01:18:11 +00:00
|
|
|
target_include_directories(notcurses-ncreel
|
2019-12-21 01:38:13 +00:00
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
|
|
|
)
|
2020-02-06 01:18:11 +00:00
|
|
|
target_link_libraries(notcurses-ncreel
|
2019-12-21 01:38:13 +00:00
|
|
|
PRIVATE
|
2020-04-02 23:42:17 +00:00
|
|
|
notcurses++
|
2019-12-21 01:38:13 +00:00
|
|
|
)
|
|
|
|
|
2020-03-22 21:33:08 +00:00
|
|
|
file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp)
|
|
|
|
add_executable(notcurses-tetris ${TETRISSRC})
|
|
|
|
target_include_directories(notcurses-tetris
|
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
|
|
|
)
|
|
|
|
target_link_libraries(notcurses-tetris
|
|
|
|
PRIVATE
|
|
|
|
notcurses++
|
|
|
|
)
|
|
|
|
|
2019-12-27 12:36:42 +00:00
|
|
|
# notcurses-view
|
2020-04-25 19:52:23 +00:00
|
|
|
if(${USE_FFMPEG} OR ${USE_OIIO})
|
2019-11-27 20:22:54 +00:00
|
|
|
file(GLOB VIEWSRCS CONFIGURE_DEPENDS src/view/*.cpp)
|
|
|
|
add_executable(notcurses-view ${VIEWSRCS})
|
2019-11-27 21:22:50 +00:00
|
|
|
target_include_directories(notcurses-view
|
|
|
|
PRIVATE
|
|
|
|
include
|
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
2020-02-07 14:38:04 +00:00
|
|
|
"${AVCODEC_INCLUDE_DIRS}"
|
|
|
|
"${AVFORMAT_INCLUDE_DIRS}"
|
2019-12-27 10:27:51 +00:00
|
|
|
"${AVUTIL_INCLUDE_DIRS}"
|
2019-11-27 21:22:50 +00:00
|
|
|
)
|
|
|
|
target_link_directories(notcurses-view
|
|
|
|
PRIVATE
|
2020-02-07 14:38:04 +00:00
|
|
|
"${AVCODEC_LIBRARY_DIRS}"
|
|
|
|
"${AVFORMAT_LIBRARY_DIRS}"
|
2019-11-27 21:22:50 +00:00
|
|
|
"${AVUTIL_LIBRARY_DIRS}"
|
|
|
|
)
|
2019-11-27 20:22:54 +00:00
|
|
|
target_link_libraries(notcurses-view
|
|
|
|
PRIVATE
|
2020-04-02 23:42:17 +00:00
|
|
|
notcurses++
|
2019-11-27 21:22:50 +00:00
|
|
|
PRIVATE
|
2020-02-07 14:38:04 +00:00
|
|
|
"${AVCODEC_LIBRARIES}"
|
2019-12-25 07:00:53 +00:00
|
|
|
"${AVFORMAT_LIBRARIES}"
|
2020-02-07 14:38:04 +00:00
|
|
|
"${AVUTIL_LIBRARIES}"
|
2019-12-25 07:00:53 +00:00
|
|
|
"${SWSCALE_LIBRARIES}"
|
2019-11-27 20:22:54 +00:00
|
|
|
)
|
2019-12-03 18:26:49 +00:00
|
|
|
target_compile_definitions(notcurses-view
|
|
|
|
PRIVATE
|
|
|
|
)
|
2019-12-27 06:29:45 +00:00
|
|
|
endif()
|
2019-11-27 20:22:54 +00:00
|
|
|
|
2019-12-27 12:36:42 +00:00
|
|
|
# Testing
|
2020-05-29 06:47:29 +00:00
|
|
|
include(CTest)
|
|
|
|
if(${BUILD_TESTING})
|
2019-11-17 10:04:41 +00:00
|
|
|
file(GLOB TESTSRCS CONFIGURE_DEPENDS tests/*.cpp)
|
|
|
|
add_executable(notcurses-tester ${TESTSRCS})
|
2019-11-24 17:36:46 +00:00
|
|
|
target_include_directories(notcurses-tester
|
|
|
|
PRIVATE
|
|
|
|
include
|
2019-12-25 07:00:53 +00:00
|
|
|
"${PROJECT_BINARY_DIR}/include"
|
2019-11-24 17:36:46 +00:00
|
|
|
src/lib
|
|
|
|
)
|
2019-11-17 10:04:41 +00:00
|
|
|
target_link_libraries(notcurses-tester
|
2019-12-27 22:20:20 +00:00
|
|
|
PRIVATE
|
2020-05-20 22:36:25 +00:00
|
|
|
notcurses++
|
2020-04-21 05:50:53 +00:00
|
|
|
"${TERMINFO_LIBRARIES}"
|
2019-11-17 10:04:41 +00:00
|
|
|
)
|
2020-05-29 06:47:29 +00:00
|
|
|
# sadly, this doesn't take effect until CMake 3.17...
|
|
|
|
set(CMAKE_CTEST_ARGUMENTS "-V")
|
2019-11-17 10:04:41 +00:00
|
|
|
enable_testing()
|
2019-12-27 22:20:20 +00:00
|
|
|
add_test(
|
|
|
|
NAME notcurses-tester
|
2020-02-02 16:50:33 +00:00
|
|
|
COMMAND notcurses-tester -p ${CMAKE_CURRENT_SOURCE_DIR}/data
|
2019-12-27 22:20:20 +00:00
|
|
|
)
|
2020-04-08 06:12:46 +00:00
|
|
|
endif()
|
2019-11-17 10:04:41 +00:00
|
|
|
|
2019-12-27 12:36:42 +00:00
|
|
|
# pkg-config support
|
2019-11-17 10:04:41 +00:00
|
|
|
configure_file(tools/notcurses.pc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
|
2020-01-07 22:51:34 +00:00
|
|
|
configure_file(tools/notcurses++.pc.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
|
|
|
|
@ONLY
|
|
|
|
)
|
|
|
|
install(FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
|
|
)
|
|
|
|
|
2019-11-17 10:04:41 +00:00
|
|
|
include(CMakePackageConfigHelpers)
|
2020-01-05 09:53:43 +00:00
|
|
|
configure_file(tools/version.h.in include/version.h)
|
|
|
|
|
2019-11-17 10:04:41 +00:00
|
|
|
configure_package_config_file(tools/notcursesConfig.cmake.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfig.cmake
|
|
|
|
INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/notcurses/cmake
|
|
|
|
)
|
|
|
|
|
|
|
|
write_basic_package_version_file(
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/notcursesConfigVersion.cmake
|
|
|
|
COMPATIBILITY SameMajorVersion
|
|
|
|
)
|
|
|
|
|
2020-04-25 22:06:02 +00:00
|
|
|
# Python bindings. When we're building debs, we use pybuild to directly call
|
|
|
|
# into setup.py, so none of this applies---debian/rules sets USE_PYTHON=off.
|
|
|
|
# arch also doesn't use it. fedora does.
|
2020-02-18 17:36:16 +00:00
|
|
|
if(${USE_PYTHON})
|
2020-04-25 22:06:02 +00:00
|
|
|
find_package(Python3 COMPONENTS Development Interpreter REQUIRED)
|
|
|
|
file(GLOB PYSRC CONFIGURE_DEPENDS python/src/notcurses/*.py)
|
|
|
|
file(COPY python/src/ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python/src)
|
|
|
|
file(COPY python/README.md DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/python)
|
|
|
|
set(SETUP_PY_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.py.in")
|
|
|
|
set(SETUP_PY "${CMAKE_CURRENT_BINARY_DIR}/python/setup.py")
|
|
|
|
set(SETUP_CFG_IN "${CMAKE_CURRENT_SOURCE_DIR}/tools/setup.cfg.in")
|
|
|
|
set(SETUP_CFG "${CMAKE_CURRENT_BINARY_DIR}/python/setup.cfg")
|
|
|
|
configure_file(${SETUP_PY_IN} ${SETUP_PY})
|
|
|
|
configure_file(${SETUP_CFG_IN} ${SETUP_CFG})
|
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp"
|
|
|
|
COMMAND
|
|
|
|
env LDFLAGS=\"-Wl,-soname,_notcurses.abi3.so.1 -L${CMAKE_CURRENT_BINARY_DIR}\" "${Python3_EXECUTABLE}" ${SETUP_PY} build &&
|
|
|
|
"${Python3_EXECUTABLE}" ${SETUP_PY} egg_info
|
|
|
|
DEPENDS
|
|
|
|
${PYSRC} ${SETUP_PY} ${SETUP_CFG} notcurses
|
|
|
|
COMMENT "Building Python wrappers"
|
|
|
|
WORKING_DIRECTORY
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/python
|
|
|
|
)
|
|
|
|
# build/pytimestamp isn't actually generated, and thus this runs each time.
|
|
|
|
# python does its own dep tracking, so it "works" out like recursive make.
|
|
|
|
add_custom_target(pymod ALL
|
|
|
|
DEPENDS
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/build/pytimestamp"
|
|
|
|
WORKING_DIRECTORY
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/python
|
|
|
|
)
|
2020-04-11 02:42:35 +00:00
|
|
|
install(CODE "execute_process(COMMAND ${Python3_EXECUTABLE} setup.py install --prefix=${CMAKE_INSTALL_PREFIX} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/python)")
|
2020-01-29 05:58:55 +00:00
|
|
|
endif()
|
2020-01-07 20:29:04 +00:00
|
|
|
|
2020-04-08 04:12:22 +00:00
|
|
|
# Rust bindings
|
2020-02-18 17:36:16 +00:00
|
|
|
if(${USE_RUST})
|
2020-02-18 18:18:20 +00:00
|
|
|
file(GLOB LIBNCRSSRC CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/rust/libnotcurses-sys/src/*.rs ${CMAKE_CURRENT_SOURCE_DIR}/rust/libnotcurses-sys/src/*.rs)
|
|
|
|
set(LIBNOTCURSESSYS ${CMAKE_CURRENT_BINARY_DIR}/rust/debug/liblibnotcurses_sys.rlib)
|
2020-02-18 18:41:57 +00:00
|
|
|
set(CRATENOTCURSES ${CMAKE_CURRENT_BINARY_DIR}/rust/debug/libnotcurses.rlib)
|
2020-02-18 17:36:16 +00:00
|
|
|
find_program(CARGO cargo REQUIRED)
|
2020-04-03 06:26:14 +00:00
|
|
|
# might need --locked here
|
|
|
|
set(CARGO_ARGS --verbose --release)
|
2020-02-18 17:36:16 +00:00
|
|
|
if(NOT ${USE_NETWORK})
|
2020-04-03 06:26:14 +00:00
|
|
|
set(CARGO_ARGS "${CARGO_ARGS}" --offline) # might want --frozen here
|
2020-02-18 17:36:16 +00:00
|
|
|
endif()
|
2020-02-18 18:18:20 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
${LIBNOTCURSESSYS}
|
|
|
|
COMMAND
|
|
|
|
PKG_CONFIG_PATH=${CMAKE_CURRENT_BINARY_DIR} CARGO_HOME=${CMAKE_CURRENT_BINARY_DIR}/rust CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}/rust ${CARGO} build ${CARGO_ARGS}
|
|
|
|
DEPENDS
|
2020-04-08 04:12:22 +00:00
|
|
|
${LIBNCRSSRC}
|
2020-02-18 18:18:20 +00:00
|
|
|
COMMENT "Building rust crate libnotcurses-sys"
|
|
|
|
WORKING_DIRECTORY
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/rust/libnotcurses-sys
|
|
|
|
)
|
|
|
|
add_custom_target(libnotcurses-sys ALL
|
|
|
|
DEPENDS
|
|
|
|
${LIBNOTCURSESSYS}
|
|
|
|
)
|
2020-02-18 18:41:57 +00:00
|
|
|
add_custom_command(
|
|
|
|
OUTPUT
|
|
|
|
${CRATENOTCURSES}
|
|
|
|
COMMAND
|
|
|
|
CARGO_HOME=${CMAKE_CURRENT_BINARY_DIR}/rust CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}/rust ${CARGO} build ${CARGO_ARGS}
|
|
|
|
DEPENDS
|
|
|
|
${CRATENOTCURSESSRC} ${LIBNOTCURSESSYS}
|
|
|
|
COMMENT "Building rust crate notcurses"
|
|
|
|
WORKING_DIRECTORY
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/rust/notcurses
|
|
|
|
)
|
|
|
|
add_custom_target(cratenotcurses ALL
|
|
|
|
DEPENDS
|
|
|
|
${CRATENOTCURSES}
|
|
|
|
)
|
2020-02-18 17:36:16 +00:00
|
|
|
endif()
|
|
|
|
|
2019-12-27 12:36:42 +00:00
|
|
|
# Installation
|
2019-11-17 10:04:41 +00:00
|
|
|
install(FILES
|
2020-05-09 09:51:00 +00:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/notcursesConfig.cmake"
|
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/notcursesConfigVersion.cmake"
|
|
|
|
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/notcurses"
|
2019-11-17 10:04:41 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
install(FILES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig
|
|
|
|
)
|
|
|
|
|
2020-04-25 19:52:23 +00:00
|
|
|
if(${USE_FFMPEG} OR ${USE_OIIO})
|
2019-12-24 00:16:49 +00:00
|
|
|
file(GLOB TESTDATA CONFIGURE_DEPENDS data/*)
|
2020-04-18 01:06:30 +00:00
|
|
|
# Don't install source materia for self-originated multimedia
|
|
|
|
list(FILTER TESTDATA EXCLUDE REGEX ".*xcf$")
|
2020-04-18 01:32:07 +00:00
|
|
|
list(FILTER TESTDATA EXCLUDE REGEX ".*osp$")
|
2020-04-19 21:18:10 +00:00
|
|
|
install(FILES ${TESTDATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/notcurses)
|
2020-04-08 06:12:46 +00:00
|
|
|
endif()
|
2019-12-01 20:27:17 +00:00
|
|
|
|
2020-04-19 21:18:10 +00:00
|
|
|
install(FILES ${MANPAGES1} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man1)
|
|
|
|
install(FILES ${MANPAGES3} DESTINATION ${CMAKE_INSTALL_PREFIX}/share/man/man3)
|
|
|
|
file(GLOB MARKDOWN CONFIGURE_DEPENDS *.md)
|
|
|
|
install(FILES ${MARKDOWN} DESTINATION ${CMAKE_INSTALL_DOCDIR})
|
2019-12-05 15:12:47 +00:00
|
|
|
|
2020-02-20 05:25:59 +00:00
|
|
|
install(PROGRAMS src/pydemo/notcurses-pydemo DESTINATION bin)
|
2019-11-17 10:04:41 +00:00
|
|
|
install(TARGETS notcurses-demo DESTINATION bin)
|
2020-02-07 16:21:06 +00:00
|
|
|
install(TARGETS notcurses-input DESTINATION bin)
|
|
|
|
install(TARGETS notcurses-ncreel DESTINATION bin)
|
2020-05-29 06:47:29 +00:00
|
|
|
if(${BUILD_TESTING})
|
2020-02-07 16:21:06 +00:00
|
|
|
install(TARGETS notcurses-tester DESTINATION bin)
|
2020-04-08 06:12:46 +00:00
|
|
|
endif()
|
2020-03-22 21:33:08 +00:00
|
|
|
install(TARGETS notcurses-tetris DESTINATION bin)
|
2020-04-25 19:52:23 +00:00
|
|
|
if(${USE_FFMPEG} OR ${USE_OIIO})
|
2019-11-27 20:22:54 +00:00
|
|
|
install(TARGETS notcurses-view DESTINATION bin)
|
2019-12-25 07:00:53 +00:00
|
|
|
endif()
|
2020-05-22 03:51:10 +00:00
|
|
|
|
|
|
|
install(TARGETS notcurses notcurses++
|
2019-11-17 10:04:41 +00:00
|
|
|
LIBRARY
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
COMPONENT Libraries
|
|
|
|
NAMELINK_COMPONENT Development
|
|
|
|
)
|
2020-05-22 03:51:10 +00:00
|
|
|
if(${USE_STATIC})
|
|
|
|
install(
|
|
|
|
TARGETS notcurses-static notcurses++-static
|
|
|
|
LIBRARY
|
|
|
|
DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
COMPONENT Libraries
|
|
|
|
NAMELINK_COMPONENT Development
|
|
|
|
)
|
|
|
|
endif()
|