add avdict

This commit is contained in:
2022-03-18 12:37:04 +08:00
parent e348a29c28
commit 8ef00def87
20 changed files with 756 additions and 13 deletions

29
cmake/FindAVUTIL.cmake Normal file
View File

@@ -0,0 +1,29 @@
find_package(PkgConfig)
if (PkgConfig_FOUND)
pkg_check_modules(PC_AVUTIL QUIET IMPORTED_TARGET GLOBAL libavutil)
endif()
if (PC_AVUTIL_FOUND)
set(AVUTIL_FOUND TRUE)
set(AVUTIL_VERSION ${PC_AVUTIL_VERSION})
set(AVUTIL_VERSION_STRING ${PC_AVUTIL_STRING})
set(AVUTIL_LIBRARYS ${PC_AVUTIL_LIBRARIES})
if (USE_STATIC_LIBS)
set(AVUTIL_INCLUDE_DIRS ${PC_AVUTIL_STATIC_INCLUDE_DIRS})
else()
set(AVUTIL_INCLUDE_DIRS ${PC_AVUTIL_INCLUDE_DIRS})
endif()
if (NOT TARGET AVUTIL::AVUTIL)
add_library(AVUTIL::AVUTIL ALIAS PkgConfig::PC_AVUTIL)
endif()
else()
message(FATAL_ERROR "failed to find libavutil.")
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(AVUTIL
FOUND_VAR AVUTIL_FOUND
REQUIRED_VARS
AVUTIL_LIBRARYS
VERSION_VAR AVUTIL_VERSION
)

34
cmake/FindExiv2.cmake Normal file
View File

@@ -0,0 +1,34 @@
find_path(Exiv2_INCLUDE_DIR
NAMES exiv2/exiv2.hpp
)
find_library(Exiv2_LIBRARY
NAMES exiv2
)
if (Exiv2_INCLUDE_DIR)
if (EXISTS "${Exiv2_INCLUDE_DIR}/exiv2/exv_conf.h")
file(STRINGS "${Exiv2_INCLUDE_DIR}/exiv2/exv_conf.h" EXV_CONF_H)
foreach(LINE IN LISTS EXV_CONF_H)
string(REGEX MATCH "^#define EXV_PACKAGE_VERSION \"([^\"]+)\"" OUTPUT "${LINE}")
if (OUTPUT)
set(EXIV2_VERSION "${CMAKE_MATCH_1}")
endif()
endforeach()
endif()
endif()
if (Exiv2_INCLUDE_DIR AND Exiv2_LIBRARY)
set(Exiv2_FOUND TRUE)
endif()
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(Exiv2
FOUND_VAR Exiv2_FOUND
REQUIRED_VARS
Exiv2_LIBRARY
Exiv2_INCLUDE_DIR
VERSION_VAR
EXIV2_VERSION
)
set(Exiv2_INCLUDE_DIRS "${Exiv2_INCLUDE_DIR}")
set(Exiv2_LIBRARIES "${Exiv2_LIBRARY}")

View File

@@ -0,0 +1,31 @@
function(get_link_libraries OUTPUT_LIST TARGET)
get_target_property(IMPORTED ${TARGET} IMPORTED)
list(APPEND VISITED_TARGETS ${TARGET})
if (IMPORTED)
get_target_property(LIBS ${TARGET} INTERFACE_LINK_LIBRARIES)
else()
get_target_property(LIBS ${TARGET} LINK_LIBRARIES)
endif()
set(LIB_FILES "")
foreach(LIB ${LIBS})
if (TARGET ${LIB})
list(FIND VISITED_TARGETS ${LIB} VISITED)
if (${VISITED} EQUAL -1)
get_target_property(LIB_FILE ${LIB} LOCATION)
if (NOT LIB_FILE)
get_target_property(LIB_FILE ${LIB} IMPORTED_LOCATION)
endif()
if (NOT LIB_FILE)
get_target_property(LIB_FILE ${LIB} IMPORTED_IMPLIB)
endif()
if (NOT LIB_FILE)
get_target_property(LIB_FILE ${LIB} INTERFACE_LINK_LIBRARIES)
endif()
get_link_libraries(LINK_LIB_FILES ${LIB})
list(APPEND LIB_FILES ${LIB_FILE} ${LINK_LIB_FILES})
endif()
endif()
endforeach()
set(VISITED_TARGETS ${VISITED_TARGETS} PARENT_SCOPE)
set(${OUTPUT_LIST} ${LIB_FILES} PARENT_SCOPE)
endfunction()