add USE_STATIC option to CMake #625

This commit is contained in:
nick black 2020-05-21 23:46:25 -04:00
parent 7215bf92ad
commit 00d63c0b69
No known key found for this signature in database
GPG Key ID: 5F43400C21CBFACC
2 changed files with 13 additions and 11 deletions

View File

@ -20,6 +20,7 @@ option(USE_PANDOC "Build man pages and HTML reference with pandoc" ON)
option(USE_PYTHON "Build Python wrappers" ON)
option(USE_QRCODEGEN "Disable libqrcodegen QR code support" ON)
option(USE_RUST "Build Rust wrappers (experimental)" OFF)
option(USE_STATIC "Build static libraries (in addition to shared)" ON)
option(USE_TESTS "Build doctest unit tests" 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)
@ -86,7 +87,11 @@ endif()
# libnotcurses (core shared library and static library)
file(GLOB NCSRCS CONFIGURE_DEPENDS src/lib/*.c src/lib/*.cpp)
add_library(notcurses SHARED ${NCSRCS})
if(${USE_STATIC})
add_library(notcurses-static STATIC ${NCSRCS})
else()
add_library(notcurses-static STATIC EXCLUDE_FROM_ALL ${NCSRCS})
endif()
set_target_properties(
notcurses-static PROPERTIES
OUTPUT_NAME notcurses
@ -225,17 +230,12 @@ set(NCPP_SOURCES
src/libcpp/Visual.cc
)
add_library(
notcurses++
SHARED
${NCPP_SOURCES}
)
add_library(
notcurses++-static
STATIC
${NCPP_SOURCES}
)
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()
set_target_properties(
notcurses++-static PROPERTIES
OUTPUT_NAME notcurses++

View File

@ -2,6 +2,8 @@ This document attempts to list user-visible changes and any major internal
rearrangements of Notcurses.
* 1.4.2.4 (2020-05-20)
* Added `USE_STATIC` CMake option, defaulting to `ON`. If turned `OFF`,
static libraries will not be built.
* Removed `ncplane_move_above_unsafe()` and `ncplane_move_below_unsafe()`;
all z-axis moves are now safe. Z-axis moves are all now O(1), rather
than the previous O(N).