mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
cmake: add USE_STATIC_BINARIES option
based off @data-man's work in #2664, add a USE_STATIC_BINARIES option to CMake, dependent on USE_STATIC being set. when this option is used, link the notcurses binaries against the static versions of notcurses. i've done ncman and nctetris thus far. also, move to pkgconf for libdeflate, requiring at least version 1.9 (that's when i added the pkgconfig code upstream).
This commit is contained in:
parent
11b45d4c27
commit
0fda32f982
@ -28,7 +28,10 @@ option(BUILD_FFI_LIBRARY "Build ffi library (containing all symbols which are st
|
|||||||
option(USE_POC "Build small, uninstalled proof-of-concept binaries" ON)
|
option(USE_POC "Build small, uninstalled proof-of-concept binaries" ON)
|
||||||
option(USE_QRCODEGEN "Enable libqrcodegen QR code support" OFF)
|
option(USE_QRCODEGEN "Enable libqrcodegen QR code support" OFF)
|
||||||
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
|
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
|
||||||
option(USE_TFMAN_STATIC "Link tfman with notcurses statically" ON)
|
cmake_dependent_option(
|
||||||
|
USE_STATIC_BINARIES "Link binaries statically (requires USE_STATIC)" OFF
|
||||||
|
"USE_STATIC" ON
|
||||||
|
)
|
||||||
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
set(USE_MULTIMEDIA "ffmpeg" CACHE STRING "Multimedia engine, one of 'ffmpeg', 'oiio', or 'none'")
|
||||||
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
set_property(CACHE USE_MULTIMEDIA PROPERTY STRINGS ffmpeg oiio none)
|
||||||
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
|
||||||
@ -106,6 +109,14 @@ pkg_search_module(TERMINFO REQUIRED tinfo>=6.1 ncursesw>=6.1)
|
|||||||
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND terminfo)
|
set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND terminfo)
|
||||||
set_package_properties(terminfo PROPERTIES TYPE REQUIRED)
|
set_package_properties(terminfo PROPERTIES TYPE REQUIRED)
|
||||||
set(PKGCONF_REQ_PRIV "${TERMINFO_LIBRARIES}")
|
set(PKGCONF_REQ_PRIV "${TERMINFO_LIBRARIES}")
|
||||||
|
|
||||||
|
if(${USE_DEFLATE})
|
||||||
|
pkg_check_modules(DEFLATE REQUIRED libdeflate>=1.9)
|
||||||
|
else()
|
||||||
|
find_package(ZLIB)
|
||||||
|
set_package_properties(ZLIB PROPERTIES TYPE REQUIRED)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(${USE_FFMPEG})
|
if(${USE_FFMPEG})
|
||||||
pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0)
|
pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0)
|
||||||
pkg_check_modules(AVDEVICE REQUIRED libavdevice>=57.0)
|
pkg_check_modules(AVDEVICE REQUIRED libavdevice>=57.0)
|
||||||
@ -179,20 +190,6 @@ set_property(GLOBAL APPEND PROPERTY PACKAGES_FOUND libunistring)
|
|||||||
set_package_properties(libunistring PROPERTIES TYPE REQUIRED)
|
set_package_properties(libunistring PROPERTIES TYPE REQUIRED)
|
||||||
|
|
||||||
# optional dependencies lacking pkg-config support
|
# 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()
|
|
||||||
|
|
||||||
if(${USE_GPM}) # no pkgconfig from gpm
|
if(${USE_GPM}) # no pkgconfig from gpm
|
||||||
unset(HAVE_GPM_H CACHE)
|
unset(HAVE_GPM_H CACHE)
|
||||||
check_include_file("gpm.h" HAVE_GPM_H)
|
check_include_file("gpm.h" HAVE_GPM_H)
|
||||||
@ -257,7 +254,7 @@ target_include_directories(notcurses-core
|
|||||||
"${CMAKE_REQUIRED_INCLUDES}"
|
"${CMAKE_REQUIRED_INCLUDES}"
|
||||||
"${PROJECT_BINARY_DIR}/include"
|
"${PROJECT_BINARY_DIR}/include"
|
||||||
"${TERMINFO_INCLUDE_DIRS}"
|
"${TERMINFO_INCLUDE_DIRS}"
|
||||||
"${libdeflate_INCLUDE_DIRS}"
|
"${DEFLATE_INCLUDE_DIRS}"
|
||||||
"${ZLIB_INCLUDE_DIRS}"
|
"${ZLIB_INCLUDE_DIRS}"
|
||||||
)
|
)
|
||||||
target_include_directories(notcurses-core-static
|
target_include_directories(notcurses-core-static
|
||||||
@ -268,12 +265,12 @@ target_include_directories(notcurses-core-static
|
|||||||
"${CMAKE_REQUIRED_INCLUDES}"
|
"${CMAKE_REQUIRED_INCLUDES}"
|
||||||
"${PROJECT_BINARY_DIR}/include"
|
"${PROJECT_BINARY_DIR}/include"
|
||||||
"${TERMINFO_STATIC_INCLUDE_DIRS}"
|
"${TERMINFO_STATIC_INCLUDE_DIRS}"
|
||||||
"${libdeflate_STATIC_INCLUDE_DIRS}"
|
"${DEFLATE_STATIC_INCLUDE_DIRS}"
|
||||||
"${ZLIB_STATIC_INCLUDE_DIRS}"
|
"${ZLIB_STATIC_INCLUDE_DIRS}"
|
||||||
)
|
)
|
||||||
target_link_libraries(notcurses-core
|
target_link_libraries(notcurses-core
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${libdeflate}"
|
"${DEFLATE_LIBRARIES}"
|
||||||
"${ZLIB_LIBRARIES}"
|
"${ZLIB_LIBRARIES}"
|
||||||
"${TERMINFO_LIBRARIES}"
|
"${TERMINFO_LIBRARIES}"
|
||||||
"${LIBM}"
|
"${LIBM}"
|
||||||
@ -285,7 +282,7 @@ target_link_libraries(notcurses-core
|
|||||||
)
|
)
|
||||||
target_link_libraries(notcurses-core-static
|
target_link_libraries(notcurses-core-static
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${libdeflate_STATIC_LIBRARIES}"
|
"${DEFLATE_STATIC_LIBRARIES}"
|
||||||
"${ZLIB_STATIC_LIBRARIES}"
|
"${ZLIB_STATIC_LIBRARIES}"
|
||||||
"${TERMINFO_STATIC_LIBRARIES}"
|
"${TERMINFO_STATIC_LIBRARIES}"
|
||||||
"${LIBM}"
|
"${LIBM}"
|
||||||
@ -297,13 +294,13 @@ target_link_libraries(notcurses-core-static
|
|||||||
target_link_directories(notcurses-core
|
target_link_directories(notcurses-core
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${TERMINFO_LIBRARY_DIRS}"
|
"${TERMINFO_LIBRARY_DIRS}"
|
||||||
"${libdeflate_LIBRARY_DIRS}"
|
"${DEFLATE_LIBRARY_DIRS}"
|
||||||
"${ZLIB_LIBRARY_DIRS}"
|
"${ZLIB_LIBRARY_DIRS}"
|
||||||
)
|
)
|
||||||
target_link_directories(notcurses-core-static
|
target_link_directories(notcurses-core-static
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${TERMINFO_STATIC_LIBRARY_DIRS}"
|
"${TERMINFO_STATIC_LIBRARY_DIRS}"
|
||||||
"${libdeflate_STATIC_LIBRARY_DIRS}"
|
"${DEFLATE_STATIC_LIBRARY_DIRS}"
|
||||||
"${ZLIB_STATIC_LIBRARY_DIRS}"
|
"${ZLIB_STATIC_LIBRARY_DIRS}"
|
||||||
)
|
)
|
||||||
if(${USE_QRCODEGEN})
|
if(${USE_QRCODEGEN})
|
||||||
@ -448,13 +445,13 @@ target_include_directories(notcurses-ffi
|
|||||||
"${CMAKE_REQUIRED_INCLUDES}"
|
"${CMAKE_REQUIRED_INCLUDES}"
|
||||||
"${PROJECT_BINARY_DIR}/include"
|
"${PROJECT_BINARY_DIR}/include"
|
||||||
"${TERMINFO_INCLUDE_DIRS}"
|
"${TERMINFO_INCLUDE_DIRS}"
|
||||||
"${libdeflate_INCLUDE_DIRS}"
|
"${DEFLATE_INCLUDE_DIRS}"
|
||||||
"${ZLIB_INCLUDE_DIRS}"
|
"${ZLIB_INCLUDE_DIRS}"
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(notcurses-ffi
|
target_link_libraries(notcurses-ffi
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${libdeflate}"
|
"${DEFLATE_LIBRARIES}"
|
||||||
"${ZLIB_LIBRARIES}"
|
"${ZLIB_LIBRARIES}"
|
||||||
"${TERMINFO_LIBRARIES}"
|
"${TERMINFO_LIBRARIES}"
|
||||||
"${LIBM}"
|
"${LIBM}"
|
||||||
@ -469,7 +466,7 @@ target_link_libraries(notcurses-ffi
|
|||||||
target_link_directories(notcurses-ffi
|
target_link_directories(notcurses-ffi
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"${TERMINFO_LIBRARY_DIRS}"
|
"${TERMINFO_LIBRARY_DIRS}"
|
||||||
"${libdeflate_LIBRARY_DIRS}"
|
"${DEFLATE_LIBRARY_DIRS}"
|
||||||
"${ZLIB_LIBRARY_DIRS}"
|
"${ZLIB_LIBRARY_DIRS}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@ -770,21 +767,21 @@ target_include_directories(tfman
|
|||||||
src
|
src
|
||||||
"${CMAKE_REQUIRED_INCLUDES}"
|
"${CMAKE_REQUIRED_INCLUDES}"
|
||||||
"${PROJECT_BINARY_DIR}/include"
|
"${PROJECT_BINARY_DIR}/include"
|
||||||
"${libdeflate_INCLUDE_DIRS}"
|
"${DEFLATE_INCLUDE_DIRS}"
|
||||||
"${ZLIB_INCLUDE_DIRS}"
|
"${ZLIB_INCLUDE_DIRS}"
|
||||||
)
|
)
|
||||||
if(USE_TFMAN_STATIC AND USE_STATIC)
|
if(USE_STATIC_BINARIES)
|
||||||
target_link_libraries(tfman
|
target_link_libraries(tfman
|
||||||
PRIVATE
|
PRIVATE
|
||||||
notcurses-core-static
|
notcurses-core-static
|
||||||
"${libdeflate}"
|
"${DEFLATE_LIBRARIES}"
|
||||||
"${ZLIB_LIBRARIES}"
|
"${ZLIB_LIBRARIES}"
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(tfman
|
target_link_libraries(tfman
|
||||||
PRIVATE
|
PRIVATE
|
||||||
notcurses-core
|
notcurses-core
|
||||||
"${libdeflate}"
|
"${DEFLATE_LIBRARIES}"
|
||||||
"${ZLIB_LIBRARIES}"
|
"${ZLIB_LIBRARIES}"
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
@ -808,7 +805,6 @@ target_link_libraries(ncneofetch
|
|||||||
"${LIBRT}"
|
"${LIBRT}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
# all further binaries require multimedia and C++ support
|
# all further binaries require multimedia and C++ support
|
||||||
if(${USE_CXX})
|
if(${USE_CXX})
|
||||||
if(${USE_MULTIMEDIA} STREQUAL "none")
|
if(${USE_MULTIMEDIA} STREQUAL "none")
|
||||||
|
3
NEWS.md
3
NEWS.md
@ -11,6 +11,9 @@ rearrangements of Notcurses.
|
|||||||
used for `NCBLIT_DEFAULT` when used with `NCSCALE_NONE_HIRES`,
|
used for `NCBLIT_DEFAULT` when used with `NCSCALE_NONE_HIRES`,
|
||||||
`NCSCALE_SCALE_HIRES`, or `NCSCALE_STRETCH`. Thanks, eschnett! Note
|
`NCSCALE_SCALE_HIRES`, or `NCSCALE_STRETCH`. Thanks, eschnett! Note
|
||||||
that octants are not supported by GNU libc until 2.41.
|
that octants are not supported by GNU libc until 2.41.
|
||||||
|
* We now depend on at least version 1.9 of libdeflate, when libdeflate
|
||||||
|
is being used. This was released 2022-01-12, and hopefully won't
|
||||||
|
cause any problems for anyone.
|
||||||
|
|
||||||
* 3.0.11 (2024-10-02)
|
* 3.0.11 (2024-10-02)
|
||||||
* We now normalize the return of `nl_langinfo()` according to the behavior
|
* We now normalize the return of `nl_langinfo()` according to the behavior
|
||||||
|
Loading…
x
Reference in New Issue
Block a user