mirror of
https://github.com/dankamongmen/notcurses
synced 2025-03-09 17:19:03 -04:00
cmake: openimageio discovery #453
This commit is contained in:
parent
ad0685aa1b
commit
6ffbef3d74
@ -40,6 +40,8 @@ pkg_check_modules(AVCODEC REQUIRED libavcodec>=57.0)
|
|||||||
pkg_check_modules(AVFORMAT REQUIRED libavformat>=57.0)
|
pkg_check_modules(AVFORMAT REQUIRED libavformat>=57.0)
|
||||||
pkg_check_modules(AVUTIL REQUIRED libavutil>=56.0)
|
pkg_check_modules(AVUTIL REQUIRED libavutil>=56.0)
|
||||||
pkg_check_modules(SWSCALE REQUIRED libswscale>=5.0)
|
pkg_check_modules(SWSCALE REQUIRED libswscale>=5.0)
|
||||||
|
elseif(${USE_OIIO})
|
||||||
|
pkg_check_modules(OIIO REQUIRED OpenImageIO>=2.0.7)
|
||||||
endif()
|
endif()
|
||||||
find_library(LIBRT rt)
|
find_library(LIBRT rt)
|
||||||
if(${USE_TESTS})
|
if(${USE_TESTS})
|
||||||
@ -150,6 +152,13 @@ target_link_directories(notcurses-static
|
|||||||
PUBLIC
|
PUBLIC
|
||||||
"${AVUTIL_STATIC_LIBRARY_DIRS}"
|
"${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()
|
endif()
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
if(CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
33
include/notcurses/ncerrs.h
Normal file
33
include/notcurses/ncerrs.h
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#ifndef NOTCURSES_NCERRS
|
||||||
|
#define NOTCURSES_NCERRS
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
// 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
|
Loading…
x
Reference in New Issue
Block a user