diff options
| author | Marc Bertola <5149167+marcbertola@users.noreply.github.com> | 2020-03-24 16:00:09 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2020-03-24 13:00:09 -0700 |
| commit | 78a2116a4ad58a96d23146ffa8f8ca4d998a3a5a (patch) | |
| tree | 9f9d629fdc040b796ada59006156667c4476b02d | |
| parent | 2d9a32b46fc82d50aa7714a1a4bedc8f0d153dcc (diff) | |
| download | vcpkg-78a2116a4ad58a96d23146ffa8f8ca4d998a3a5a.tar.gz vcpkg-78a2116a4ad58a96d23146ffa8f8ca4d998a3a5a.zip | |
[ffmpeg] Add NVIDIA Codec feature for Windows and Linux (#9171)
* Add NVIDIA Codec support for Windows, Linux and Linux for Tegra
* [ffnvcodec] Fix typos, add/remove comments
* Bump nvcodec version to 9.1.23.1
* Update version number as per change request
* Use PORT variable instead of hardcoded portname
* Identify the release the hash pertains to
* Find nvcodec in 'installed' instead of 'packages'
* Force FFmpeg to look for nvcodec headers in the installed directory instead of /usr/lib/pkgconfig.
* Use p option on cygpath to convert full path in case it contains more than one entry
| -rw-r--r-- | ports/ffmpeg/CONTROL | 4 | ||||
| -rw-r--r-- | ports/ffmpeg/build.sh | 1 | ||||
| -rw-r--r-- | ports/ffmpeg/build_linux.sh | 1 | ||||
| -rw-r--r-- | ports/ffmpeg/portfile.cmake | 7 | ||||
| -rw-r--r-- | ports/ffnvcodec/CONTROL | 8 | ||||
| -rw-r--r-- | ports/ffnvcodec/build.sh | 18 | ||||
| -rw-r--r-- | ports/ffnvcodec/copyright | 26 | ||||
| -rw-r--r-- | ports/ffnvcodec/portfile.cmake | 66 |
8 files changed, 114 insertions, 17 deletions
diff --git a/ports/ffmpeg/CONTROL b/ports/ffmpeg/CONTROL index 9b08398db..ef26c4d97 100644 --- a/ports/ffmpeg/CONTROL +++ b/ports/ffmpeg/CONTROL @@ -53,3 +53,7 @@ Description: upgrade (L)GPL to version 3 Feature: avresample Description: Libav audio resampling library support in ffmpeg + +Feature: nvcodec +Build-Depends: ffnvcodec, cuda +Description: Hardware accelerated codecs
\ No newline at end of file diff --git a/ports/ffmpeg/build.sh b/ports/ffmpeg/build.sh index 048d9ec08..40f1797cd 100644 --- a/ports/ffmpeg/build.sh +++ b/ports/ffmpeg/build.sh @@ -1,6 +1,7 @@ #!/usr/bin/bash set -e export PATH=/usr/bin:$PATH +export PKG_CONFIG_PATH="`cygpath -p ${PKG_CONFIG_PATH}`" # Export HTTP(S)_PROXY as http(s)_proxy: if [ "$HTTP_PROXY" ]; then export http_proxy=$HTTP_PROXY diff --git a/ports/ffmpeg/build_linux.sh b/ports/ffmpeg/build_linux.sh index b24be1346..d7360ce1d 100644 --- a/ports/ffmpeg/build_linux.sh +++ b/ports/ffmpeg/build_linux.sh @@ -16,6 +16,7 @@ PATH_TO_PACKAGE_DIR=$3 cd "$PATH_TO_BUILD_DIR" echo "=== CONFIGURING ===" +chmod a+x "$PATH_TO_SRC_DIR/configure" "$PATH_TO_SRC_DIR/configure" "--prefix=$PATH_TO_PACKAGE_DIR" $4 echo "=== BUILDING ===" make -j6 diff --git a/ports/ffmpeg/portfile.cmake b/ports/ffmpeg/portfile.cmake index b1ddd0ddf..6e861a051 100644 --- a/ports/ffmpeg/portfile.cmake +++ b/ports/ffmpeg/portfile.cmake @@ -131,6 +131,12 @@ if("avresample" IN_LIST FEATURES) set(OPTIONS "${OPTIONS} --enable-avresample") endif() +if("nvcodec" IN_LIST FEATURES) + set(OPTIONS "${OPTIONS} --enable-cuda --enable-nvenc --enable-cuvid --disable-libnpp") +else() + set(OPTIONS "${OPTIONS} --disable-cuda --disable-nvenc --disable-cuvid --disable-libnpp") +endif() + set(OPTIONS_CROSS "") if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64") @@ -177,6 +183,7 @@ if(VCPKG_TARGET_IS_WINDOWS) endif() set(ENV_LIB_PATH "$ENV{${LIB_PATH_VAR}}") +set(ENV{PKG_CONFIG_PATH} "${CURRENT_INSTALLED_DIR}/lib/pkgconfig") message(STATUS "Building Options: ${OPTIONS}") diff --git a/ports/ffnvcodec/CONTROL b/ports/ffnvcodec/CONTROL index 5cc6cb19b..5779ec9e3 100644 --- a/ports/ffnvcodec/CONTROL +++ b/ports/ffnvcodec/CONTROL @@ -1,4 +1,4 @@ -Source: ffnvcodec
-Version: 9.1.23.0
-Homepage: https://github.com/FFmpeg/nv-codec-headers
-Description: FFmpeg version of Nvidia Codec SDK headers.
\ No newline at end of file +Source: ffnvcodec +Version: 9.1.23.1 +Homepage: https://github.com/FFmpeg/nv-codec-headers +Description: FFmpeg version of Nvidia Codec SDK headers. diff --git a/ports/ffnvcodec/build.sh b/ports/ffnvcodec/build.sh new file mode 100644 index 000000000..416c6bd8f --- /dev/null +++ b/ports/ffnvcodec/build.sh @@ -0,0 +1,18 @@ +#!/usr/bin/bash
+
+# Deploys the ffnvcodec.pc file to the MSYS rootfs so that pkgconfig can find it.
+
+set -e
+export PATH=/usr/bin:$PATH
+
+SOURCE_PATH="$1"
+CURRENT_PACKAGES_DIR="$2"
+
+pushd ${SOURCE_PATH}
+
+# Create ffnvcodec.pc
+make PREFIX=${CURRENT_PACKAGES_DIR}
+make install PREFIX=${CURRENT_PACKAGES_DIR}
+
+
+popd
diff --git a/ports/ffnvcodec/copyright b/ports/ffnvcodec/copyright new file mode 100644 index 000000000..07c1bc4d7 --- /dev/null +++ b/ports/ffnvcodec/copyright @@ -0,0 +1,26 @@ +/* + * This copyright notice applies to this header file only: + * + * Copyright (c) 2010-2019 NVIDIA Corporation + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the software, and to permit persons to whom the + * software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ diff --git a/ports/ffnvcodec/portfile.cmake b/ports/ffnvcodec/portfile.cmake index c6f13e711..66d8bcb18 100644 --- a/ports/ffnvcodec/portfile.cmake +++ b/ports/ffnvcodec/portfile.cmake @@ -1,13 +1,53 @@ -# Header-only-library
-vcpkg_from_github(
- OUT_SOURCE_PATH SOURCE_PATH
- REPO FFmpeg/nv-codec-headers
- REF n9.1.23.0
- SHA512 d9cb1ad496d971da31165e643c6c4f433561a856050503783051604f24ea5f9997859b05695632ea94ce9659966915789e6d7f7d536764804c9f673d1c8c63e4
- HEAD_REF master
-)
-
-file(COPY ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR})
-
-#Handle copyright
-file(INSTALL ${CMAKE_CURRENT_LIST_DIR}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
\ No newline at end of file +# Get nvcodec +vcpkg_from_github( + OUT_SOURCE_PATH SOURCE_PATH + REPO FFmpeg/nv-codec-headers + REF 4a0bbfd58724d6d19851cd8a6f7a9098dde9ab77 # 9.1.23.1 + SHA512 39b643c6925558428f2e814fc3441878a906f324163396b8c6139ce48f62308c3dc2416b9c995eaed890338919ca0dfc9437fbb6b6d078f7a6f1b9675104c223 + HEAD_REF master +) + +# ==================================================== +# Install the pkgconfig info for the `nvcodec` package +# ==================================================== + +# Windows +if(NOT VCPKG_CMAKE_SYSTEM_NAME OR VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore") + set(BUILD_SCRIPT ${CMAKE_CURRENT_LIST_DIR}\\build.sh) + vcpkg_acquire_msys(MSYS_ROOT PACKAGES make pkg-config) + set(BASH ${MSYS_ROOT}/usr/bin/bash.exe) + + message(STATUS "Building ${_csc_PROJECT_PATH} for Release") + file(MAKE_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}) + + # Make and deploy the ffnvcodec.pc file using MSYS + # (so that FFmpeg can find it in the MSYS rootfs) + vcpkg_execute_required_process( + COMMAND ${BASH} --noprofile --norc "${BUILD_SCRIPT}" + "${SOURCE_PATH}" + "${CURRENT_PACKAGES_DIR}" + WORKING_DIRECTORY ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET} + LOGNAME build-${TARGET_TRIPLET} + ) + +# Linux, etc. +else() + FIND_PROGRAM(MAKE make) + IF (NOT MAKE) + MESSAGE(FATAL_ERROR "MAKE not found") + ENDIF () + + vcpkg_execute_required_process( + COMMAND make PREFIX=$${CURRENT_PACKAGES_DIR} + WORKING_DIRECTORY ${SOURCE_PATH} + LOGNAME make-${TARGET_TRIPLET} + ) + + # FFmpeg uses pkgconfig to find ffnvcodec.pc, so install it where + # FFMpeg's call to pkgconfig expects to find it. + file(INSTALL ${SOURCE_PATH}/ffnvcodec.pc DESTINATION ${CURRENT_PACKAGES_DIR}/lib/pkgconfig) +endif() + +# Install the files to their default vcpkg locations +file(INSTALL ${SOURCE_PATH}/include DESTINATION ${CURRENT_PACKAGES_DIR}) +file(INSTALL ${CURRENT_PORT_DIR}/copyright DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT}) |
