diff --git a/CMakeLists.txt b/CMakeLists.txt index 3e9736675..0bece0ad0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,8 @@ pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0) pkg_check_modules(AVFORMAT REQUIRED libavformat>=57.0) pkg_check_modules(AVUTIL REQUIRED libavutil>=56.0) pkg_check_modules(SWSCALE REQUIRED libswscale>=5.0) +elseif(${USE_OIIO}) +pkg_check_modules(OIIO REQUIRED OpenImageIO>=2.0.7) endif() find_library(LIBRT rt) if(${USE_TESTS}) @@ -150,6 +152,13 @@ target_link_directories(notcurses-static PUBLIC "${AVUTIL_STATIC_LIBRARY_DIRS}" ) +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}) endif() if(CMAKE_BUILD_TYPE STREQUAL Debug) diff --git a/include/notcurses/ncerrs.h b/include/notcurses/ncerrs.h new file mode 100644 index 000000000..4c9c37218 --- /dev/null +++ b/include/notcurses/ncerrs.h @@ -0,0 +1,33 @@ +#ifndef NOTCURSES_NCERRS +#define NOTCURSES_NCERRS + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +// Error values for more granular problem indication. We map to POSIX error +// codes when possible. We need at least the union of POSIX (errno) and FFMpeg +// (AVERROR) codes that we might see. +typedef enum { + NCERR_SUCCESS = 0, + NCERR_NOMEM = ENOMEM, + NCERR_EOF = 0x464f45, // matches AVERROR_EOF +} nc_err_e; + +static inline const char* +nc_strerror(nc_err_e ncerr){ + switch(ncerr){ + case NCERR_SUCCESS: return "success"; + case NCERR_NOMEM: return strerror(ENOMEM); + case NCERR_EOF: return "end of file"; + }; + return "unknown error"; +} + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif