notcurses/CMakeLists.txt

1151 lines
31 KiB
CMake
Raw Normal View History

# 3.14.0 introduced NAME_WLE
2020-08-14 03:38:10 +00:00
cmake_minimum_required(VERSION 3.14.0)
2022-01-21 17:39:27 +00:00
project(notcurses VERSION 3.0.5
2020-08-09 21:47:21 +00:00
DESCRIPTION "Blingful 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)
include(CTest)
2019-11-17 10:04:41 +00:00
include(GNUInstallDirs)
include(CMakeDependentOption)
2020-08-18 06:50:02 +00:00
include(FeatureSummary)
###################### USER-SELECTABLE OPTIONS ###########################
# BUILD_TESTING is defined by CTest
option(DFSG_BUILD "DFSG build (no non-free media/code)" OFF)
option(USE_ASAN "Build with AddressSanitizer" OFF)
2020-05-20 03:12:27 +00:00
option(USE_COVERAGE "Assess code coverage with llvm-cov/lcov" OFF)
2021-12-10 09:45:00 +00:00
option(USE_CXX "Build C++ code" ON)
cmake_dependent_option(
USE_DOCTEST "Build notcurses-tester with doctest" ON
2021-12-10 09:45:00 +00:00
"BUILD_TESTING;USE_CXX" OFF
)
option(USE_DEFLATE "Use libdeflate instead of libz" ON)
2020-02-20 05:25:59 +00:00
option(USE_DOXYGEN "Build HTML cross reference with doxygen" OFF)
2021-08-24 01:42:08 +00:00
option(USE_GPM "Enable libgpm console mouse support" OFF)
option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
2021-12-14 10:24:53 +00:00
option(BUILD_EXECUTABLES "Build executables" ON)
option(BUILD_FFI_LIBRARY "Build ffi library (containing all symbols which are static inline)" ON)
option(USE_POC "Build small, uninstalled proof-of-concept binaries" ON)
option(USE_QRCODEGEN "Enable libqrcodegen QR code support" OFF)
2020-05-22 03:46:25 +00:00
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)
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE
STRING "Choose the build mode." FORCE)
endif()
2020-05-20 03:12:27 +00:00
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS Debug Release MinSizeRel RelWithDebInfo Coverage)
############## END (additional) USER-SELECTABLE OPTIONS ##################
set(USE_FFMPEG OFF)
set(USE_OIIO OFF)
if(${USE_MULTIMEDIA} STREQUAL "ffmpeg")
set(USE_FFMPEG ON)
elseif(${USE_MULTIMEDIA} STREQUAL "oiio")
2021-12-10 09:45:00 +00:00
if(NOT ${USE_CXX})
message(FATAL_ERROR "USE_CXX must be on to use OpenImageIO.")
endif()
set(USE_OIIO ON)
elseif(NOT ${USE_MULTIMEDIA} STREQUAL "none")
message(FATAL_ERROR "USE_MULTIMEDIA must be one of 'oiio', 'ffmpeg', 'none' (was '${USE_MULTIMEDIA}').")
endif()
2021-12-14 10:24:53 +00:00
if (NOT BUILD_EXECUTABLES AND USE_POC)
message(WARNING "Disabling USE_POC since BUILD_EXECUTABLES=OFF")
2021-12-13 10:41:29 +00:00
set(USE_POC OFF)
endif()
2019-12-25 07:00:53 +00:00
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
enable_language(CXX)
endif()
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -Og")
endif()
set(CMAKE_C_STANDARD 11)
set(CMAKE_C_VISIBILITY_PRESET hidden)
message(STATUS "Requested multimedia engine: ${USE_MULTIMEDIA}")
message(STATUS "Requested build mode: ${CMAKE_BUILD_TYPE}")
2021-02-10 21:07:40 +00:00
string(APPEND CMAKE_C_FLAGS_DEBUG " -Og")
if(${USE_COVERAGE})
2020-05-20 03:12:27 +00:00
if(NOT "${CMAKE_C_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
message(FATAL_ERROR "USE_COVERAGE was on but CC isn't clang")
endif()
# FIXME requires clang11+
string(APPEND CMAKE_C_FLAGS_DEBUG " --coverage -fprofile-instr-generate -fcoverage-mapping")
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "(Apple)?[Cc]lang")
message(FATAL_ERROR "USE_COVERAGE was on but CXX isn't clang++")
endif()
string(APPEND CMAKE_CXX_FLAGS_DEBUG " --coverage -fprofile-instr-generate -fcoverage-mapping")
endif()
2020-05-20 03:12:27 +00:00
endif()
# under msys2 (and all other operating systems) we want pkgconfig. when
# building with visual studio, don't require it.
if(NOT MSVC)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
elseif(APPLE)
# surely there's a better way to do this? alas, seems necessary to pull the
# pkg-config files out of Homebrew.
if(NOT DEFINED ENV{PKG_CONFIG_PATH})
set(ENV{PKG_CONFIG_PATH} "/usr/local/opt/ncurses/lib/pkgconfig")
endif()
set(PKGCONFIG_DIR "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
else()
set(PKGCONFIG_DIR "${CMAKE_INSTALL_PREFIX}/libdata/pkgconfig")
endif()
2019-11-17 17:55:12 +00:00
find_package(PkgConfig REQUIRED)
# some distros (<cough>motherfucking alpine</cough> subsume terminfo directly
# into ncurses. accept either, and may god have mercy on our souls.
pkg_search_module(TERMINFO REQUIRED tinfo>=6.1 ncursesw>=6.1)
2020-08-30 02:32:27 +00:00
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND terminfo)
set_package_properties(terminfo PROPERTIES TYPE REQUIRED)
set(PKGCONF_REQ_PRIV "${TERMINFO_LIBRARIES}")
if(${USE_FFMPEG})
2020-08-30 02:32:27 +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-08-30 02:32:27 +00:00
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND FFMpeg)
2020-04-24 04:05:01 +00:00
elseif(${USE_OIIO})
find_package(OpenImageIO 2.1 REQUIRED)
2019-12-25 07:00:53 +00:00
endif()
endif()
# global compiler flags
if(NOT WIN32)
# MSYS2 needs -lssp and -fstack-protector for _FORTIFY_SOURCE
# macOS with ASAN can't handle _FORTIFY_SOURCE != 1
if(NOT ${USE_ASAN})
add_compile_definitions(_FORTIFY_SOURCE=2)
endif()
add_compile_options(-Wformat -Werror=format-security)
endif()
2021-11-02 03:50:01 +00:00
if(MSVC)
add_compile_options(/W4)
else()
2021-10-26 20:04:02 +00:00
add_compile_options(-Wall -Wextra -W -Wshadow -Wvla)
# -ffast-math dies on NaNs we draw from libav (by -ffinite-math-only)
add_compile_options(-fno-signed-zeros -fno-trapping-math -fassociative-math)
2021-10-21 09:11:18 +00:00
add_compile_options(-fno-math-errno -freciprocal-math -funsafe-math-optimizations)
add_compile_options(-fexceptions -fstrict-aliasing)
if(${USE_ASAN})
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()
2021-11-02 03:50:01 +00:00
endif()
# don't use REQUIRED with subsequent find_package() operations; we use
# feature_summary + set_package_properties to fail in one fell swoop.
find_package(Threads)
set_package_properties(Threads PROPERTIES TYPE REQUIRED)
# platform-specific logics
if(WIN32)
2021-12-15 19:45:08 +00:00
set(LIBRT wsock32 ws2_32 secur32)
elseif(NOT APPLE)
find_library(LIBM m REQUIRED)
find_library(LIBRT rt REQUIRED)
endif()
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
include_directories(/usr/local/include)
link_directories(/usr/local/lib)
set(CMAKE_REQUIRED_INCLUDES /usr/local/include)
endif()
if(${USE_DOCTEST})
2020-08-18 06:50:02 +00:00
find_package(doctest 2.3.5)
set_package_properties(doctest PROPERTIES TYPE REQUIRED)
endif()
# don't cache these, or installing them requires clearing the cache to be found.
# this is going to be true for anything lacking pkg-config/CMake support.
2021-07-10 21:54:06 +00:00
# unigbrk.h was introduced in libunistring 0.9.4, 2010-02-14.
unset(HAVE_UNISTRING_H CACHE)
2021-07-10 21:54:06 +00:00
check_include_file("unigbrk.h" HAVE_UNISTRING_H)
if(NOT "${HAVE_UNISTRING_H}")
2021-07-10 21:54:06 +00:00
message(FATAL_ERROR "Couldn't find unigbrk.h from GNU libunistring")
endif()
find_library(unistring unistring REQUIRED)
2020-08-30 02:32:27 +00:00
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libunistring)
set_package_properties(libunistring PROPERTIES TYPE REQUIRED)
# optional dependencies lacking pkg-config support
if(${USE_DEFLATE})
unset(HAVE_DEFLATE_H CACHE)
check_include_file("libdeflate.h" HAVE_DEFLATE_H)
if(NOT "${HAVE_DEFLATE_H}")
message(FATAL_ERROR "Couldn't find libdeflate.h")
endif()
find_library(libdeflate deflate REQUIRED)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libdeflate)
set_package_properties(libdeflate PROPERTIES TYPE REQUIRED)
else()
find_package(ZLIB)
set_package_properties(ZLIB PROPERTIES TYPE REQUIRED)
endif()
2021-08-24 01:42:08 +00:00
if(${USE_GPM}) # no pkgconfig from gpm
unset(HAVE_GPM_H CACHE)
check_include_file("gpm.h" HAVE_GPM_H)
if(NOT "${HAVE_GPM_H}")
message(FATAL_ERROR "Couldn't find gpm.h from libgpm")
endif()
find_library(gpm gpm REQUIRED)
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libgpm)
set_package_properties(libgpm PROPERTIES TYPE REQUIRED)
endif()
if("${USE_QRCODEGEN}")
unset(HAVE_QRCODEGEN_H CACHE)
check_include_file("qrcodegen/qrcodegen.h" HAVE_QRCODEGEN_H)
if(NOT "${HAVE_QRCODEGEN_H}")
message(FATAL_ERROR "USE_QRCODEGEN is active, but couldn't find qrcodegen.h")
endif()
2020-08-30 02:32:27 +00:00
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND qrcodegen)
endif()
feature_summary(WHAT ALL FATAL_ON_MISSING_REQUIRED_PACKAGES)
2019-11-17 17:55:12 +00:00
file(GLOB COMPATSRC CONFIGURE_DEPENDS src/compat/*.c)
############################################################################
# libnotcurses-core (core shared library, core static library)
2021-12-13 05:53:31 +00:00
file(GLOB NCCORESRCS CONFIGURE_DEPENDS src/lib/*.c)
add_library(notcurses-core SHARED ${NCCORESRCS} ${COMPATSRC})
2020-05-22 03:46:25 +00:00
if(${USE_STATIC})
add_library(notcurses-core-static STATIC ${NCCORESRCS} ${COMPATSRC})
2020-05-22 03:46:25 +00:00
else()
add_library(notcurses-core-static STATIC EXCLUDE_FROM_ALL ${NCCORESRCS} ${COMPATSRC})
2020-05-22 03:46:25 +00:00
endif()
# don't want these on freebsd/dragonfly/osx
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_compile_definitions(notcurses-core
PUBLIC
_XOPEN_SOURCE=700 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
PRIVATE
_GNU_SOURCE _DEFAULT_SOURCE
)
target_compile_definitions(notcurses-core-static
PUBLIC
_XOPEN_SOURCE=700 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
PRIVATE
_GNU_SOURCE _DEFAULT_SOURCE
)
endif()
set_target_properties(notcurses-core PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
set_target_properties(notcurses-core-static PROPERTIES
VERSION ${PROJECT_VERSION}
2021-01-21 08:18:40 +00:00
OUTPUT_NAME notcurses-core
2020-02-09 01:49:10 +00:00
)
target_include_directories(notcurses-core
BEFORE
2019-11-17 10:04:41 +00:00
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
2019-11-17 10:04:41 +00:00
"${PROJECT_BINARY_DIR}/include"
2019-12-27 10:27:51 +00:00
"${TERMINFO_INCLUDE_DIRS}"
"${libdeflate_INCLUDE_DIRS}"
"${ZLIB_INCLUDE_DIRS}"
2019-12-25 07:00:53 +00:00
)
target_include_directories(notcurses-core-static
BEFORE
2020-02-09 01:49:10 +00:00
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
2020-02-09 01:49:10 +00:00
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_STATIC_INCLUDE_DIRS}"
"${libdeflate_STATIC_INCLUDE_DIRS}"
"${ZLIB_STATIC_INCLUDE_DIRS}"
2020-02-09 01:49:10 +00:00
)
target_link_libraries(notcurses-core
2019-12-25 07:00:53 +00:00
PRIVATE
"${libdeflate}"
"${ZLIB_LIBRARIES}"
2019-12-25 07:00:53 +00:00
"${TERMINFO_LIBRARIES}"
2021-07-12 23:04:54 +00:00
"${LIBM}"
"${unistring}"
"${gpm}"
PUBLIC
Threads::Threads
"${LIBRT}"
2019-12-25 07:00:53 +00:00
)
target_link_libraries(notcurses-core-static
2020-02-09 01:49:10 +00:00
PRIVATE
"${libdeflate_STATIC_LIBRARIES}"
"${ZLIB_STATIC_LIBRARIES}"
"${TERMINFO_STATIC_LIBRARIES}"
2021-07-12 23:04:54 +00:00
"${LIBM}"
"${unistring}"
"${gpm}"
Threads::Threads
"${LIBRT}"
2020-02-09 01:49:10 +00:00
)
target_link_directories(notcurses-core
2019-12-25 07:00:53 +00:00
PRIVATE
"${TERMINFO_LIBRARY_DIRS}"
"${libdeflate_LIBRARY_DIRS}"
"${ZLIB_LIBRARY_DIRS}"
2019-12-25 07:00:53 +00:00
)
target_link_directories(notcurses-core-static
2020-02-09 01:49:10 +00:00
PRIVATE
"${TERMINFO_STATIC_LIBRARY_DIRS}"
"${libdeflate_STATIC_LIBRARY_DIRS}"
"${ZLIB_STATIC_LIBRARY_DIRS}"
2020-02-09 01:49:10 +00:00
)
if(${USE_QRCODEGEN})
target_link_libraries(notcurses-core PRIVATE qrcodegen)
target_link_libraries(notcurses-core-static PRIVATE qrcodegen)
endif()
############################################################################
# libnotcurses (multimedia shared library+static library)
file(GLOB NCSRCS CONFIGURE_DEPENDS src/media/*.c src/media/*.cpp)
add_library(notcurses SHARED ${NCSRCS} ${COMPATSRC})
if(${USE_STATIC})
add_library(notcurses-static STATIC ${NCSRCS} ${COMPATSRC})
else()
add_library(notcurses-static STATIC EXCLUDE_FROM_ALL ${NCSRCS} ${COMPATSRC})
endif()
2021-01-21 08:18:40 +00:00
set_target_properties(notcurses PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
set_target_properties(notcurses-static PROPERTIES
VERSION ${PROJECT_VERSION}
OUTPUT_NAME notcurses
)
2019-12-25 07:00:53 +00:00
target_include_directories(notcurses
BEFORE
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_INCLUDE_DIRS}"
)
target_include_directories(notcurses-static
BEFORE
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_INCLUDE_DIRS}"
)
target_compile_definitions(notcurses
PRIVATE
_GNU_SOURCE _DEFAULT_SOURCE
)
target_compile_definitions(notcurses-static
PRIVATE
_GNU_SOURCE _DEFAULT_SOURCE
)
target_link_libraries(notcurses
PUBLIC
notcurses-core
)
target_link_libraries(notcurses-static
2020-02-01 09:12:54 +00:00
PUBLIC
notcurses-core-static
)
if(${USE_FFMPEG})
target_include_directories(notcurses
PRIVATE
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
PRIVATE
"${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
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}"
"${AVUTIL_LIBRARIES}"
2020-02-09 01:49:10 +00:00
)
target_link_libraries(notcurses-static
PRIVATE
"${AVCODEC_STATIC_LIBRARIES}"
"${AVFORMAT_STATIC_LIBRARIES}"
"${SWSCALE_STATIC_LIBRARIES}"
"${AVUTIL_STATIC_LIBRARIES}"
2019-11-17 10:04:41 +00:00
)
target_link_directories(notcurses
PRIVATE
2020-02-07 03:55:55 +00:00
"${AVCODEC_LIBRARY_DIRS}"
"${AVFORMAT_LIBRARY_DIRS}"
"${SWSCALE_LIBRARY_DIRS}"
"${AVUTIL_LIBRARY_DIRS}"
)
2020-02-09 01:49:10 +00:00
target_link_directories(notcurses-static
PRIVATE
"${AVCODEC_STATIC_LIBRARY_DIRS}"
"${AVFORMAT_STATIC_LIBRARY_DIRS}"
"${SWSCALE_STATIC_LIBRARY_DIRS}"
"${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 OpenImageIO)
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
#######################################
# libnotcurses-ffi (ffi shared library)
if(${BUILD_FFI_LIBRARY})
file(GLOB NCFFISRCS CONFIGURE_DEPENDS src/libffi/*.c src/libffi/*.cpp)
add_library(notcurses-ffi SHARED ${NCFFISRCS})
target_compile_options(notcurses-ffi PUBLIC -fkeep-inline-functions)
target_compile_definitions(notcurses-ffi PUBLIC NOTCURSES_FFI)
# don't want these on freebsd/dragonfly/osx
if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
target_compile_definitions(notcurses-ffi
PUBLIC
_XOPEN_SOURCE=700 # wcwidth(3) requires _XOPEN_SOURCE, and is in our headers
PRIVATE
_GNU_SOURCE _DEFAULT_SOURCE
)
endif()
set_target_properties(notcurses-ffi PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
target_include_directories(notcurses-ffi
BEFORE
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_INCLUDE_DIRS}"
"${libdeflate_INCLUDE_DIRS}"
"${ZLIB_INCLUDE_DIRS}"
)
target_link_libraries(notcurses-ffi
PRIVATE
"${libdeflate}"
"${ZLIB_LIBRARIES}"
"${TERMINFO_LIBRARIES}"
"${LIBM}"
"${unistring}"
"${gpm}"
"notcurses-core"
PUBLIC
Threads::Threads
"${LIBRT}"
)
target_link_directories(notcurses-ffi
PRIVATE
"${TERMINFO_LIBRARY_DIRS}"
"${libdeflate_LIBRARY_DIRS}"
"${ZLIB_LIBRARY_DIRS}"
)
endif()
2021-12-13 05:53:31 +00:00
############################################################################
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
# libnotcurses++ (C++ wrappers)
2020-01-07 22:51:34 +00:00
set(NCPP_SOURCES
src/libcpp/FDPlane.cc
src/libcpp/Menu.cc
src/libcpp/MultiSelector.cc
2020-01-07 22:51:34 +00:00
src/libcpp/NotCurses.cc
src/libcpp/Plane.cc
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
src/libcpp/Selector.cc
src/libcpp/Subproc.cc
2020-01-07 22:51:34 +00:00
src/libcpp/Tablet.cc
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
OUTPUT_NAME notcurses++
2020-01-07 22:51:34 +00:00
)
set_target_properties(
notcurses++ PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
OUTPUT_NAME "notcurses++")
2020-01-07 22:51:34 +00:00
set(NCPP_INCLUDE_DIRS
"include"
"src"
2020-01-07 22:51:34 +00:00
"${PROJECT_BINARY_DIR}/include"
"${TERMINFO_INCLUDE_DIRS}"
)
target_include_directories(notcurses++
BEFORE
2020-01-07 22:51:34 +00:00
PRIVATE ${NCPP_INCLUDE_DIRS}
)
target_include_directories(notcurses++-static
BEFORE
2020-01-07 22:51:34 +00:00
PRIVATE ${NCPP_INCLUDE_DIRS}
)
target_link_libraries(notcurses++
PUBLIC
2020-01-07 22:51:34 +00:00
notcurses)
set(NCPP_COMPILE_OPTIONS
-Wnull-dereference
-Wunused
-Wno-c99-extensions
-fno-strict-aliasing
-ffunction-sections
-fno-rtti
)
set(NCPP_COMPILE_DEFINITIONS_PUBLIC
2020-06-16 22:39:08 +00:00
_GNU_SOURCE _DEFAULT_SOURCE
2020-01-07 22:51:34 +00:00
)
target_compile_options(notcurses++
PRIVATE
${NCPP_COMPILE_OPTIONS}
2021-12-28 05:34:53 +00:00
-fPIC
2020-01-07 22:51:34 +00:00
)
2021-12-28 05:34:53 +00:00
target_compile_options(notcurses-core
PRIVATE
-fPIC
)
target_compile_options(notcurses-core-static
PRIVATE
-fPIE
)
target_compile_options(notcurses
PRIVATE
-fPIC
)
target_compile_options(notcurses-static
PRIVATE
-fPIE
)
2020-01-07 22:51:34 +00:00
target_compile_options(notcurses++-static
PRIVATE
${NCPP_COMPILE_OPTIONS}
2021-12-28 05:34:53 +00:00
-fPIE
)
2020-01-07 22:51:34 +00:00
target_compile_definitions(notcurses++
PUBLIC
${NCPP_COMPILE_DEFINITIONS_PUBLIC}
2021-12-28 05:34:53 +00:00
)
2020-01-07 22:51:34 +00:00
target_compile_definitions(notcurses++-static
PUBLIC
${NCPP_COMPILE_DEFINITIONS_PUBLIC}
2021-12-28 05:34:53 +00:00
)
2020-01-07 22:51:34 +00:00
2020-04-10 19:59:13 +00:00
file(GLOB NOTCURSES_HEADERS
CONFIGURE_DEPENDS
LIST_DIRECTORIES false
2020-10-11 00:53:45 +00:00
${PROJECT_SOURCE_DIR}/include/notcurses/*.h
${CMAKE_CURRENT_BINARY_DIR}/include/version.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
${PROJECT_SOURCE_DIR}/include/ncpp/*.hh)
2020-01-07 22:51:34 +00:00
file(GLOB NCPP_INTERNAL_HEADERS
CONFIGURE_DEPENDS
LIST_DIRECTORIES false
${PROJECT_SOURCE_DIR}/include/ncpp/internal/*.hh)
endif()
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-12 09:52:59 +00:00
# tiny proofs of concept, one binary per source file
if(USE_POC)
2021-01-18 23:40:55 +00:00
file(GLOB POCSRCS CONFIGURE_DEPENDS src/poc/*.c)
2019-12-12 09:52:59 +00:00
foreach(f ${POCSRCS})
2021-01-18 23:40:55 +00:00
get_filename_component(fe "${f}" NAME_WE)
2021-08-26 12:41:32 +00:00
add_executable(${fe} ${f})
2021-01-18 23:40:55 +00:00
target_include_directories(${fe}
BEFORE
2021-01-18 23:40:55 +00:00
PRIVATE include src "${TERMINFO_INCLUDE_DIRS}"
"${PROJECT_BINARY_DIR}/include"
)
target_link_libraries(${fe}
PRIVATE notcurses "${TERMINFO_LIBRARIES}" "${LIBM}" "${LIBRT}"
2021-01-18 23:40:55 +00:00
)
target_link_directories(${fe}
PRIVATE "${TERMINFO_LIBRARY_DIRS}"
)
endforeach()
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
file(GLOB POCPPSRCS CONFIGURE_DEPENDS src/pocpp/*.cpp)
foreach(f ${POCPPSRCS})
get_filename_component(fe "${f}" NAME_WE)
add_executable(${fe} ${f})
target_include_directories(${fe}
BEFORE
PRIVATE include src "${TERMINFO_INCLUDE_DIRS}"
"${PROJECT_BINARY_DIR}/include"
)
target_link_libraries(${fe}
PRIVATE notcurses++ "${TERMINFO_LIBRARIES}" "${LIBM}" "${LIBRT}"
)
target_link_directories(${fe}
PRIVATE "${TERMINFO_LIBRARY_DIRS}"
)
endforeach()
endif()
endif()
2019-12-12 09:52:59 +00:00
2021-12-13 10:41:29 +00:00
# documentation source, processed by pandoc into XHTML and man pages. declare
# them here so that we can filter out man pages for binaries which aren't
# going to be installed.
file(GLOB MANSOURCE1 CONFIGURE_DEPENDS doc/man/man1/*.md)
file(GLOB MANSOURCE3 CONFIGURE_DEPENDS doc/man/man3/*.md)
2021-12-14 10:24:53 +00:00
if(BUILD_EXECUTABLES)
############################################################################
# notcurses-demo
file(GLOB DEMOSRCS CONFIGURE_DEPENDS src/demo/*.c)
add_executable(notcurses-demo ${DEMOSRCS} ${COMPATSRC})
target_compile_definitions(notcurses-demo
PRIVATE
_GNU_SOURCE
)
target_include_directories(notcurses-demo
BEFORE
2020-06-16 07:11:00 +00:00
PRIVATE
include
src
"${TERMINFO_INCLUDE_DIRS}"
"${CMAKE_REQUIRED_INCLUDES}"
2020-06-16 07:11:00 +00:00
"${PROJECT_BINARY_DIR}/include"
)
target_link_libraries(notcurses-demo
2020-06-16 07:11:00 +00:00
PRIVATE
notcurses
2021-07-12 23:04:54 +00:00
${LIBM}
${LIBRT}
Threads::Threads
2020-06-16 07:11:00 +00:00
)
############################################################################
# notcurses-info
file(GLOB INFOSRCS CONFIGURE_DEPENDS src/info/*.c)
add_executable(notcurses-info ${INFOSRCS} ${COMPATSRC})
target_compile_definitions(notcurses-info
PRIVATE
_GNU_SOURCE _DEFAULT_SOURCE
)
target_include_directories(notcurses-info
BEFORE
PRIVATE
src
include
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
2021-07-12 22:53:24 +00:00
"${TERMINFO_INCLUDE_DIRS}"
)
target_link_libraries(notcurses-info
PRIVATE
notcurses
"${LIBRT}"
)
############################################################################
2020-04-08 13:13:39 +00:00
# notcurses-input
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
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
BEFORE
2019-11-29 05:20:30 +00:00
PRIVATE
include
"${CMAKE_REQUIRED_INCLUDES}"
2019-11-29 05:20:30 +00:00
"${PROJECT_BINARY_DIR}/include"
)
target_link_libraries(notcurses-input
PRIVATE
2020-04-02 23:42:17 +00:00
notcurses++
"${LIBRT}"
2019-11-29 05:20:30 +00:00
)
############################################################################
2021-01-21 08:51:12 +00:00
# nctetris
file(GLOB TETRISSRC CONFIGURE_DEPENDS src/tetris/*.cpp src/compat/*.c)
2021-01-21 08:51:12 +00:00
add_executable(nctetris ${TETRISSRC})
target_include_directories(nctetris
BEFORE
2020-11-01 12:08:55 +00:00
PRIVATE
src
2020-11-01 12:08:55 +00:00
include
"${CMAKE_REQUIRED_INCLUDES}"
2020-11-01 12:08:55 +00:00
"${PROJECT_BINARY_DIR}/include"
)
2021-01-21 08:51:12 +00:00
target_link_libraries(nctetris
2020-11-01 12:08:55 +00:00
PRIVATE
notcurses++
"${LIBRT}"
2020-11-01 12:08:55 +00:00
)
endif()
2020-11-01 12:08:55 +00:00
2021-12-04 15:30:57 +00:00
############################################################################
# tfman
2021-12-04 17:10:21 +00:00
if(NOT WIN32)
2021-12-12 17:21:40 +00:00
file(GLOB TFMANSRCS CONFIGURE_DEPENDS src/man/*.c)
add_executable(tfman ${TFMANSRCS} ${COMPATSRC})
target_compile_definitions(tfman
PRIVATE
_GNU_SOURCE
)
target_include_directories(tfman
2021-12-04 15:30:57 +00:00
BEFORE
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
"${libdeflate_INCLUDE_DIRS}"
2021-12-06 06:10:14 +00:00
"${ZLIB_INCLUDE_DIRS}"
)
target_link_libraries(tfman
2021-12-04 15:30:57 +00:00
PRIVATE
notcurses-core
"${libdeflate}"
2021-12-06 06:10:14 +00:00
"${ZLIB_LIBRARIES}"
2021-12-04 15:30:57 +00:00
)
2021-12-04 17:10:21 +00:00
endif()
2021-12-04 15:30:57 +00:00
############################################################################
# ncneofetch
file(GLOB FETCHSRCS CONFIGURE_DEPENDS src/fetch/*.c src/compat/*.c)
add_executable(ncneofetch ${FETCHSRCS} ${COMPATSRC})
target_include_directories(ncneofetch
BEFORE
PRIVATE
include
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
src
)
target_link_libraries(ncneofetch
PRIVATE
notcurses
"${LIBRT}"
)
# all further binaries require multimedia and C++ support
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
if(${USE_MULTIMEDIA} STREQUAL "none")
list(FILTER MANSOURCE1 EXCLUDE REGEX "ncls.1.md")
list(FILTER MANSOURCE1 EXCLUDE REGEX "ncplayer.1.md")
else()
############################################################################
# ncls
file(GLOB LSSRC CONFIGURE_DEPENDS src/ls/*.cpp)
add_executable(ncls ${LSSRC})
target_include_directories(ncls
BEFORE
PRIVATE
include
2021-08-13 19:08:10 +00:00
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
)
target_link_libraries(ncls
PRIVATE
notcurses++
)
############################################################################
# ncplayer
file(GLOB PLAYERSRCS CONFIGURE_DEPENDS src/player/*.cpp)
add_executable(ncplayer ${PLAYERSRCS} ${COMPATSRC})
target_include_directories(ncplayer
BEFORE
2019-11-27 21:22:50 +00:00
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
2019-11-27 21:22:50 +00:00
"${PROJECT_BINARY_DIR}/include"
)
target_link_libraries(ncplayer
2019-11-27 20:22:54 +00:00
PRIVATE
2020-04-02 23:42:17 +00:00
notcurses++
2019-11-27 20:22:54 +00:00
)
2019-12-27 06:29:45 +00:00
endif()
endif()
else()
set(MANSOURCE1 "") # no executables were built
2021-12-14 10:24:53 +00:00
endif() # BUILD_EXECUTABLES
2019-11-27 20:22:54 +00:00
############################################################################
# testing
if(${BUILD_TESTING})
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
2021-03-12 04:51:54 +00:00
#set(CMAKE_CTEST_ARGUMENTS "-V")
if(${USE_DOCTEST})
file(GLOB TESTSRCS CONFIGURE_DEPENDS src/tests/*.cpp src/compat/*.c)
add_executable(notcurses-tester ${TESTSRCS})
target_include_directories(notcurses-tester
BEFORE
PRIVATE
include
src
"${CMAKE_REQUIRED_INCLUDES}"
"${PROJECT_BINARY_DIR}/include"
2021-07-12 22:53:24 +00:00
"${TERMINFO_INCLUDE_DIRS}"
)
target_link_libraries(notcurses-tester
PRIVATE
notcurses++
"${unistring}"
"${TERMINFO_LIBRARIES}"
)
2021-07-12 22:53:24 +00:00
target_link_directories(notcurses-tester
PRIVATE
"${TERMINFO_LIBRARY_DIRS}"
)
add_test(
NAME notcurses-tester
COMMAND notcurses-tester -p ${CMAKE_CURRENT_SOURCE_DIR}/data --abort-after=1
)
set_tests_properties(notcurses-tester PROPERTIES RUN_SERIAL TRUE)
install(TARGETS notcurses-tester DESTINATION bin)
else()
list(FILTER MANSOURCE1 EXCLUDE REGEX "notcurses-tester.1.md")
endif()
endif()
2019-11-17 10:04:41 +00:00
enable_testing()
# the accursed Ubuntu buildd sets "TERM=unknown" for unfathomable reasons
if(DEFINED ENV{TERM} AND NOT $ENV{TERM} STREQUAL "unknown" AND USE_POC)
2021-06-22 22:26:23 +00:00
add_test(
NAME notcurses-info
COMMAND notcurses-info
)
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
add_test(
NAME ncpp_build
COMMAND ncpp_build
)
add_test(
NAME ncpp_build_exceptions
COMMAND ncpp_build_exceptions
)
# provide an empty source
2022-01-05 01:42:34 +00:00
add_test(
NAME input-devnull
COMMAND sh -c "./notcurses-input -v < /dev/null"
2022-01-05 01:42:34 +00:00
)
# provide an ASCII file
add_test(
NAME input-text
COMMAND sh -c "./notcurses-input < ${CMAKE_SOURCE_DIR}/COPYRIGHT"
)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} DEPENDS notcurses-input)
LIST(APPEND TESTBINS ncpp_build ncpp_build_exceptions input-devnull input-text)
endif()
2021-08-08 03:57:48 +00:00
add_test(
NAME sgr-direct
COMMAND sgr-direct
)
add_test(
NAME sgr-full
COMMAND sgr-full
)
add_test(
NAME rgb
COMMAND rgb
)
add_test(
NAME rgbbg
COMMAND rgbbg
)
LIST(APPEND TESTBINS notcurses-info sgr-direct sgr-full rgb rgbbg)
if(${USE_QRCODEGEN})
add_test(
NAME qrcode
COMMAND qrcode
)
endif()
2021-08-08 08:16:14 +00:00
set_tests_properties(
${TESTBINS} PROPERTIES RUN_SERIAL TRUE
2020-07-22 02:47:03 +00:00
)
endif()
else()
list(FILTER MANSOURCE1 EXCLUDE REGEX "notcurses-tester.1.md")
endif()
2019-11-17 10:04:41 +00:00
# Pandoc documentation (man pages, HTML reference)
if(USE_PANDOC)
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 --from markdown-smart ${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 --from markdown-smart ${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)
LIST(APPEND MANPAGES3 ${CMAKE_CURRENT_BINARY_DIR}/${me})
endforeach()
foreach(m ${MANSOURCE1})
get_filename_component(me ${m} NAME_WLE)
LIST(APPEND MANPAGES1 ${CMAKE_CURRENT_BINARY_DIR}/${me})
endforeach()
endif()
endif()
# Doxygen / diagrams
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
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
DEPENDS ${DOXYFILE}
COMMAND Doxygen::doxygen
ARGS ${DOXYFILE}
COMMENT "Running doxygen"
)
add_custom_target(doxygen
ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/index.html"
)
set(MODELDOT ${CMAKE_CURRENT_SOURCE_DIR}/doc/model.dot)
add_custom_command(
OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/model.png"
DEPENDS ${MODELDOT}
COMMAND Doxygen::dot
ARGS -Tpng ${MODELDOT} -o "${CMAKE_CURRENT_BINARY_DIR}/model.png"
COMMENT "Running dot"
)
add_custom_target(dot
ALL DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/model.png"
)
endif()
endif()
2020-12-03 06:47:40 +00:00
add_custom_target(demo
COMMAND ./notcurses-demo -p ${CMAKE_CURRENT_SOURCE_DIR}/data -c
DEPENDS notcurses-demo
)
2019-12-27 12:36:42 +00:00
# pkg-config support
configure_file(tools/notcurses-core.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses-core.pc
@ONLY
)
2019-11-17 10:04:41 +00:00
configure_file(tools/notcurses.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
@ONLY
)
if(${BUILD_FFI_LIBRARY})
2021-12-19 13:40:55 +00:00
configure_file(tools/notcurses-ffi.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses-ffi.pc
@ONLY
)
2022-01-03 00:42:45 +00:00
endif()
2020-01-07 22:51:34 +00:00
configure_file(tools/notcurses++.pc.in
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
@ONLY
)
2020-01-07 22:51:34 +00:00
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)
2020-10-11 00:53:45 +00:00
configure_file(tools/builddef.h.in include/builddef.h)
2020-01-05 09:53:43 +00:00
configure_package_config_file(tools/NotcursesConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/NotcursesConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/NotcursesCoreConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(tools/NotcursesCoreConfig.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/NotcursesCoreConfig.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/NotcursesCore
)
2019-11-17 10:04:41 +00:00
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/NotcursesConfigVersion.cmake
2019-11-17 10:04:41 +00:00
COMPATIBILITY SameMajorVersion
)
configure_package_config_file(tools/Notcurses++Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/Notcurses++Config.cmake
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses++
)
write_basic_package_version_file(
${CMAKE_CURRENT_BINARY_DIR}/Notcurses++ConfigVersion.cmake
COMPATIBILITY SameMajorVersion
)
2019-12-27 12:36:42 +00:00
# Installation
install(FILES
"${CMAKE_CURRENT_BINARY_DIR}/NotcursesCoreConfig.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/NotcursesCoreConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/NotcursesCore"
)
2019-11-17 10:04:41 +00:00
install(FILES
"${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++Config.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/Notcurses++ConfigVersion.cmake"
DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Notcurses++"
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses-core.pc
DESTINATION ${PKGCONFIG_DIR}
)
2019-11-17 10:04:41 +00:00
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses.pc
DESTINATION ${PKGCONFIG_DIR}
2019-11-17 10:04:41 +00:00
)
if(${BUILD_FFI_LIBRARY})
2021-12-19 13:40:55 +00:00
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses-ffi.pc
DESTINATION ${PKGCONFIG_DIR}
)
endif()
2021-12-19 13:40:55 +00:00
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/notcurses++.pc
DESTINATION ${PKGCONFIG_DIR}
)
if(NOT ${USE_MULTIMEDIA} STREQUAL "none")
file(GLOB TESTDATA CONFIGURE_DEPENDS data/*)
# 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$")
install(FILES ${TESTDATA} DESTINATION ${CMAKE_INSTALL_DATADIR}/notcurses)
endif()
2019-12-01 20:27:17 +00:00
install(FILES ${MANPAGES1} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man1)
install(FILES ${MANPAGES3} DESTINATION ${CMAKE_INSTALL_DATADIR}/man/man3)
file(GLOB MARKDOWN CONFIGURE_DEPENDS *.md)
2021-01-22 00:15:09 +00:00
list(FILTER MARKDOWN EXCLUDE REGEX "INSTALL.md")
install(FILES ${MARKDOWN} DESTINATION ${CMAKE_INSTALL_DOCDIR})
2019-12-05 15:12:47 +00:00
2021-12-14 10:24:53 +00:00
if(BUILD_EXECUTABLES)
2019-11-17 10:04:41 +00:00
install(TARGETS notcurses-demo DESTINATION bin)
install(TARGETS notcurses-info DESTINATION bin)
install(TARGETS ncneofetch DESTINATION bin)
if(NOT WIN32)
install(TARGETS tfman DESTINATION bin)
endif()
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
install(TARGETS notcurses-input DESTINATION bin)
install(TARGETS nctetris DESTINATION bin)
if(NOT ${USE_MULTIMEDIA} STREQUAL "none")
install(TARGETS ncls DESTINATION bin)
install(TARGETS ncplayer DESTINATION bin)
2019-12-25 07:00:53 +00:00
endif()
endif()
2021-12-14 10:24:53 +00:00
endif() # BUILD_EXECUTABLES
if(${BUILD_FFI_LIBRARY})
2022-01-03 00:42:45 +00:00
LIST(APPEND INSTLIBS notcurses-ffi)
endif()
2022-01-03 00:42:45 +00:00
LIST(APPEND INSTLIBS notcurses-core notcurses)
if(${USE_STATIC})
LIST(APPEND INSTLIBS notcurses-core-static notcurses-static)
endif()
2021-12-10 09:45:00 +00:00
if(${USE_CXX})
LIST(APPEND INSTLIBS notcurses++)
if(${USE_STATIC})
LIST(APPEND INSTLIBS notcurses++-static)
endif()
endif()
install(TARGETS ${INSTLIBS}
LIBRARY
DESTINATION ${CMAKE_INSTALL_LIBDIR}
COMPONENT Libraries
NAMELINK_COMPONENT Development
)
option(DUMMY_PYTHON "Build dummy python module used for compile check and Clangd" OFF)
if(${DUMMY_PYTHON})
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_subdirectory("./python")
endif()