diff options
Diffstat (limited to 'vcpkg/ports/libyuv')
| -rw-r--r-- | vcpkg/ports/libyuv/cmake.diff | 60 | ||||
| -rw-r--r-- | vcpkg/ports/libyuv/libyuv-config.cmake | 5 | ||||
| -rw-r--r-- | vcpkg/ports/libyuv/portfile.cmake | 51 | ||||
| -rw-r--r-- | vcpkg/ports/libyuv/usage | 5 | ||||
| -rw-r--r-- | vcpkg/ports/libyuv/vcpkg.json | 28 |
5 files changed, 149 insertions, 0 deletions
diff --git a/vcpkg/ports/libyuv/cmake.diff b/vcpkg/ports/libyuv/cmake.diff new file mode 100644 index 0000000..fdb8953 --- /dev/null +++ b/vcpkg/ports/libyuv/cmake.diff @@ -0,0 +1,60 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c6cce8a6..799cabde 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,6 +4,7 @@ + + cmake_minimum_required( VERSION 3.16 ) + project ( YUV C CXX ) # "C" is required even for C++ projects ++option( BUILD_TOOLS "Build tools" OFF ) + option( UNIT_TEST "Built unit tests" OFF ) + + include(CheckCSourceCompiles) +@@ -184,6 +185,8 @@ if(WIN32) + set_target_properties( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) + endif() + ++if (BUILD_TOOLS) ++ + # this creates the cpuid tool + add_executable ( cpuid ${ly_base_dir}/util/cpuid.c ) + target_link_libraries ( cpuid ${ly_lib_static} ) +@@ -196,10 +199,13 @@ target_link_libraries ( yuvconvert ${ly_lib_static} ) + add_executable ( yuvconstants ${ly_base_dir}/util/yuvconstants.c ) + target_link_libraries ( yuvconstants ${ly_lib_static} ) + ++endif() ++ + find_package ( JPEG ) + if (JPEG_FOUND) + include_directories( ${JPEG_INCLUDE_DIR} ) +- target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) ++ target_link_libraries( ${ly_lib_static} PRIVATE JPEG::JPEG ) ++ target_link_libraries( ${ly_lib_shared} PRIVATE JPEG::JPEG ) + add_definitions( -DHAVE_JPEG ) + endif() + +@@ -246,9 +252,20 @@ endif() + + + # install the conversion tool, .so, .a, and all the header files +-install ( TARGETS yuvconvert DESTINATION bin ) +-install ( TARGETS ${ly_lib_static} DESTINATION lib ) +-install ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ARCHIVE DESTINATION lib ) ++if (BUILD_TOOLS) ++ install(TARGETS yuvconvert yuvconstants) ++endif() ++if(BUILD_SHARED_LIBS) ++ target_include_directories(${ly_lib_shared} PUBLIC $<INSTALL_INTERFACE:include>) ++ install(TARGETS ${ly_lib_shared} EXPORT libyuv-targets) ++ set_target_properties(${ly_lib_shared} PROPERTIES EXPORT_NAME "${ly_lib_static}") # vcpkg legacy ++ add_definitions(-DLIBYUV_BUILDING_SHARED_LIBRARY) ++else() ++ target_include_directories(${ly_lib_static} PUBLIC $<INSTALL_INTERFACE:include>) ++ install(TARGETS ${ly_lib_static} EXPORT libyuv-targets) ++ set_target_properties(${ly_lib_shared} PROPERTIES EXCLUDE_FROM_ALL 1) ++endif() ++install(EXPORT libyuv-targets DESTINATION share/libyuv) + install ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack diff --git a/vcpkg/ports/libyuv/libyuv-config.cmake b/vcpkg/ports/libyuv/libyuv-config.cmake new file mode 100644 index 0000000..7031edd --- /dev/null +++ b/vcpkg/ports/libyuv/libyuv-config.cmake @@ -0,0 +1,5 @@ +include(CMakeFindDependencyMacro)
+find_dependency(JPEG)
+
+set(libyuv_INCLUDE_DIRS "${CMAKE_CURRENT_LIST_DIR}/../../include")
+include("${CMAKE_CURRENT_LIST_DIR}/libyuv-targets.cmake")
diff --git a/vcpkg/ports/libyuv/portfile.cmake b/vcpkg/ports/libyuv/portfile.cmake new file mode 100644 index 0000000..ee4b500 --- /dev/null +++ b/vcpkg/ports/libyuv/portfile.cmake @@ -0,0 +1,51 @@ +vcpkg_from_git(
+ OUT_SOURCE_PATH SOURCE_PATH
+ URL https://chromium.googlesource.com/libyuv/libyuv
+ REF d98915a654d3564e4802a0004add46221c4e4348
+ # Check https://chromium.googlesource.com/libyuv/libyuv/+/refs/heads/main/include/libyuv/version.h for a version!
+ PATCHES
+ cmake.diff
+)
+
+vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
+ FEATURES
+ tools BUILD_TOOLS
+)
+
+vcpkg_cmake_configure(
+ SOURCE_PATH "${SOURCE_PATH}"
+ OPTIONS
+ ${FEATURE_OPTIONS}
+ OPTIONS_DEBUG
+ -DBUILD_TOOLS=OFF
+)
+
+vcpkg_cmake_install()
+vcpkg_cmake_config_fixup()
+if("tools" IN_LIST FEATURES)
+ vcpkg_copy_tools(TOOL_NAMES yuvconvert yuvconstants AUTO_CLEAN)
+endif()
+
+if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/libyuv/basic_types.h" "defined(LIBYUV_USING_SHARED_LIBRARY)" "1")
+endif()
+
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/share")
+
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/libyuv-config.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+file(COPY "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
+
+vcpkg_cmake_get_vars(cmake_vars_file)
+include("${cmake_vars_file}")
+if(VCPKG_DETECTED_CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
+ file(APPEND "${CURRENT_PACKAGES_DIR}/share/${PORT}/usage" [[
+
+Attention:
+You are using MSVC to compile libyuv. This build won't compile any
+of the acceleration codes, which results in a very slow library.
+See workarounds: https://github.com/microsoft/vcpkg/issues/28446
+]])
+endif()
+
+vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
diff --git a/vcpkg/ports/libyuv/usage b/vcpkg/ports/libyuv/usage new file mode 100644 index 0000000..b4c7d12 --- /dev/null +++ b/vcpkg/ports/libyuv/usage @@ -0,0 +1,5 @@ +libyuv provides CMake targets:
+
+ # Unofficial config package and target from vcpkg
+ find_package(libyuv CONFIG REQUIRED)
+ target_link_libraries(main PRIVATE yuv)
diff --git a/vcpkg/ports/libyuv/vcpkg.json b/vcpkg/ports/libyuv/vcpkg.json new file mode 100644 index 0000000..1b77f94 --- /dev/null +++ b/vcpkg/ports/libyuv/vcpkg.json @@ -0,0 +1,28 @@ +{ + "name": "libyuv", + "version": "1916", + "description": "libyuv is an open source project that includes YUV scaling and conversion functionality", + "homepage": "https://chromium.googlesource.com/libyuv/libyuv", + "license": null, + "dependencies": [ + "libjpeg-turbo", + { + "name": "vcpkg-cmake", + "host": true + }, + { + "name": "vcpkg-cmake-config", + "host": true + }, + { + "name": "vcpkg-cmake-get-vars", + "host": true + } + ], + "features": { + "tools": { + "description": "build command line tool", + "supports": "!android & !ios & !xbox & !wasm32" + } + } +} |