aboutsummaryrefslogtreecommitdiff
path: root/vcpkg-ports/libvpx
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /vcpkg-ports/libvpx
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'vcpkg-ports/libvpx')
-rw-r--r--vcpkg-ports/libvpx/0002-Fix-nasm-debug-format-flag.patch21
-rw-r--r--vcpkg-ports/libvpx/0003-add-uwp-v142-and-v143-support.patch160
-rw-r--r--vcpkg-ports/libvpx/0004-remove-library-suffixes.patch13
-rw-r--r--vcpkg-ports/libvpx/portfile.cmake283
-rw-r--r--vcpkg-ports/libvpx/unofficial-libvpx-config.cmake.in49
-rw-r--r--vcpkg-ports/libvpx/vcpkg.json15
-rw-r--r--vcpkg-ports/libvpx/vpx.pc.in13
7 files changed, 554 insertions, 0 deletions
diff --git a/vcpkg-ports/libvpx/0002-Fix-nasm-debug-format-flag.patch b/vcpkg-ports/libvpx/0002-Fix-nasm-debug-format-flag.patch
new file mode 100644
index 00000000..5f4749ae
--- /dev/null
+++ b/vcpkg-ports/libvpx/0002-Fix-nasm-debug-format-flag.patch
@@ -0,0 +1,21 @@
+diff --git a/build/make/configure.sh b/build/make/configure.sh
+index 81d30a1..325017e 100644
+--- a/build/make/configure.sh
++++ b/build/make/configure.sh
+@@ -1370,12 +1370,14 @@ EOF
+ case ${tgt_os} in
+ win32)
+ add_asflags -f win32
+- enabled debug && add_asflags -g cv8
++ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
++ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8
+ EXE_SFX=.exe
+ ;;
+ win64)
+ add_asflags -f win64
+- enabled debug && add_asflags -g cv8
++ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
++ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8
+ EXE_SFX=.exe
+ ;;
+ linux*|solaris*|android*)
diff --git a/vcpkg-ports/libvpx/0003-add-uwp-v142-and-v143-support.patch b/vcpkg-ports/libvpx/0003-add-uwp-v142-and-v143-support.patch
new file mode 100644
index 00000000..ce323c49
--- /dev/null
+++ b/vcpkg-ports/libvpx/0003-add-uwp-v142-and-v143-support.patch
@@ -0,0 +1,160 @@
+diff --git a/build/make/configure.sh b/build/make/configure.sh
+index 119d206..41bac75 100644
+--- a/build/make/configure.sh
++++ b/build/make/configure.sh
+@@ -1038,7 +1038,7 @@ EOF
+ # A number of ARM-based Windows platforms are constrained by their
+ # respective SDKs' limitations. Fortunately, these are all 32-bit ABIs
+ # and so can be selected as 'win32'.
+- if [ ${tgt_os} = "win32" ]; then
++ if [ ${tgt_os} = "win32" ] || [ ${tgt_isa} = "armv7" ]; then
+ asm_conversion_cmd="${source_path_mk}/build/make/ads2armasm_ms.pl"
+ AS_SFX=.S
+ msvs_arch_dir=arm-msvs
+@@ -1272,6 +1272,9 @@ EOF
+ android)
+ soft_enable realtime_only
+ ;;
++ uwp)
++ enabled gcc && add_cflags -fno-common
++ ;;
+ win*)
+ enabled gcc && add_cflags -fno-common
+ ;;
+@@ -1390,6 +1393,16 @@ EOF
+ fi
+ AS_SFX=.asm
+ case ${tgt_os} in
++ uwp)
++ if [ {$tgt_isa} = "x86" ] || [ {$tgt_isa} = "armv7" ]; then
++ add_asflags -f win32
++ else
++ add_asflags -f win64
++ fi
++ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
++ enabled debug && [ "${AS}" = nasm ] && add_asflags -gcv8
++ EXE_SFX=.exe
++ ;;
+ win32)
+ add_asflags -f win32
+ enabled debug && [ "${AS}" = yasm ] && add_asflags -g cv8
+@@ -1519,6 +1532,8 @@ EOF
+ # Almost every platform uses pthreads.
+ if enabled multithread; then
+ case ${toolchain} in
++ *-uwp-vs*)
++ ;;
+ *-win*-vs*)
+ ;;
+ *-android-gcc)
+diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh
+index 58bb66b..b4cad6c 100644
+--- a/build/make/gen_msvs_vcxproj.sh
++++ b/build/make/gen_msvs_vcxproj.sh
+@@ -296,7 +296,22 @@ generate_vcxproj() {
+ tag_content ProjectGuid "{${guid}}"
+ tag_content RootNamespace ${name}
+ tag_content Keyword ManagedCProj
+- if [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
++ if [ $vs_ver -ge 16 ]; then
++ if [[ $target =~ [^-]*-uwp-.* ]]; then
++ # Universal Windows Applications
++ tag_content AppContainerApplication true
++ tag_content ApplicationType "Windows Store"
++ tag_content ApplicationTypeRevision 10.0
++ fi
++ if [[ $target =~ [^-]*-uwp-.* ]] || [ "${platforms[0]}" = "ARM" ] || [ "${platforms[0]}" = "ARM64" ]; then
++ # Default to the latest Windows 10 SDK
++ tag_content WindowsTargetPlatformVersion 10.0
++ else
++ # Minimum supported version of Windows for the desktop
++ tag_content WindowsTargetPlatformVersion 8.1
++ fi
++ tag_content MinimumVisualStudioVersion 16.0
++ elif [ $vs_ver -ge 12 ] && [ "${platforms[0]}" = "ARM" ]; then
+ tag_content AppContainerApplication true
+ # The application type can be one of "Windows Store",
+ # "Windows Phone" or "Windows Phone Silverlight". The
+@@ -394,7 +409,7 @@ generate_vcxproj() {
+ Condition="'\$(Configuration)|\$(Platform)'=='$config|$plat'"
+ if [ "$name" == "vpx" ]; then
+ hostplat=$plat
+- if [ "$hostplat" == "ARM" ]; then
++ if [ "$hostplat" == "ARM" ] && [ $vs_ver -le 15 ]; then
+ hostplat=Win32
+ fi
+ fi
+diff --git a/configure b/configure
+index beea650..91ae3c8 100644
+--- a/configure
++++ b/configure
+@@ -102,16 +102,24 @@ all_platforms="${all_platforms} arm64-darwin-gcc"
+ all_platforms="${all_platforms} arm64-darwin20-gcc"
+ all_platforms="${all_platforms} arm64-darwin21-gcc"
+ all_platforms="${all_platforms} arm64-linux-gcc"
++all_platforms="${all_platforms} arm64-uwp-vs16"
++all_platforms="${all_platforms} arm64-uwp-vs17"
+ all_platforms="${all_platforms} arm64-win64-gcc"
+ all_platforms="${all_platforms} arm64-win64-vs15"
++all_platforms="${all_platforms} arm64-win64-vs16"
++all_platforms="${all_platforms} arm64-win64-vs17"
+ all_platforms="${all_platforms} armv7-android-gcc" #neon Cortex-A8
+ all_platforms="${all_platforms} armv7-darwin-gcc" #neon Cortex-A8
+ all_platforms="${all_platforms} armv7-linux-rvct" #neon Cortex-A8
+ all_platforms="${all_platforms} armv7-linux-gcc" #neon Cortex-A8
+ all_platforms="${all_platforms} armv7-none-rvct" #neon Cortex-A8
++all_platforms="${all_platforms} armv7-uwp-vs16"
++all_platforms="${all_platforms} armv7-uwp-vs17"
+ all_platforms="${all_platforms} armv7-win32-gcc"
+ all_platforms="${all_platforms} armv7-win32-vs14"
+ all_platforms="${all_platforms} armv7-win32-vs15"
++all_platforms="${all_platforms} armv7-win32-vs16"
++all_platforms="${all_platforms} armv7-win32-vs17"
+ all_platforms="${all_platforms} armv7s-darwin-gcc"
+ all_platforms="${all_platforms} armv8-linux-gcc"
+ all_platforms="${all_platforms} loongarch32-linux-gcc"
+@@ -138,6 +146,8 @@ all_platforms="${all_platforms} x86-linux-gcc"
+ all_platforms="${all_platforms} x86-linux-icc"
+ all_platforms="${all_platforms} x86-os2-gcc"
+ all_platforms="${all_platforms} x86-solaris-gcc"
++all_platforms="${all_platforms} x86-uwp-vs16"
++all_platforms="${all_platforms} x86-uwp-vs17"
+ all_platforms="${all_platforms} x86-win32-gcc"
+ all_platforms="${all_platforms} x86-win32-vs14"
+ all_platforms="${all_platforms} x86-win32-vs15"
+@@ -161,6 +171,8 @@ all_platforms="${all_platforms} x86_64-iphonesimulator-gcc"
+ all_platforms="${all_platforms} x86_64-linux-gcc"
+ all_platforms="${all_platforms} x86_64-linux-icc"
+ all_platforms="${all_platforms} x86_64-solaris-gcc"
++all_platforms="${all_platforms} x86_64-uwp-vs16"
++all_platforms="${all_platforms} x86_64-uwp-vs17"
+ all_platforms="${all_platforms} x86_64-win64-gcc"
+ all_platforms="${all_platforms} x86_64-win64-vs14"
+ all_platforms="${all_platforms} x86_64-win64-vs15"
+@@ -485,11 +497,10 @@ process_targets() {
+ ! enabled multithread && DIST_DIR="${DIST_DIR}-nomt"
+ ! enabled install_docs && DIST_DIR="${DIST_DIR}-nodocs"
+ DIST_DIR="${DIST_DIR}-${tgt_isa}-${tgt_os}"
+- case "${tgt_os}" in
+- win*) enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
+- DIST_DIR="${DIST_DIR}-${tgt_cc}"
+- ;;
+- esac
++ if [[ ${tgt_os} =~ win.* ]] || [ "${tgt_os}" = "uwp" ]; then
++ enabled static_msvcrt && DIST_DIR="${DIST_DIR}mt" || DIST_DIR="${DIST_DIR}md"
++ DIST_DIR="${DIST_DIR}-${tgt_cc}"
++ fi
+ if [ -f "${source_path}/build/make/version.sh" ]; then
+ ver=`"$source_path/build/make/version.sh" --bare "$source_path"`
+ DIST_DIR="${DIST_DIR}-${ver}"
+@@ -578,6 +589,10 @@ process_detect() {
+
+ # Specialize windows and POSIX environments.
+ case $toolchain in
++ *-uwp-*)
++ # Don't check for any headers in UWP builds.
++ false
++ ;;
+ *-win*-*)
+ # Don't check for any headers in Windows builds.
+ false
diff --git a/vcpkg-ports/libvpx/0004-remove-library-suffixes.patch b/vcpkg-ports/libvpx/0004-remove-library-suffixes.patch
new file mode 100644
index 00000000..e7f827d7
--- /dev/null
+++ b/vcpkg-ports/libvpx/0004-remove-library-suffixes.patch
@@ -0,0 +1,13 @@
+diff --git a/build/make/gen_msvs_vcxproj.sh b/build/make/gen_msvs_vcxproj.sh
+index 916851662..e60405bc9 100755
+--- a/build/make/gen_msvs_vcxproj.sh
++++ b/build/make/gen_msvs_vcxproj.sh
+@@ -394,7 +394,7 @@ generate_vcxproj() {
+ else
+ config_suffix=""
+ fi
+- tag_content TargetName "${name}${lib_sfx}${config_suffix}"
++ tag_content TargetName "${name}"
+ fi
+ close_tag PropertyGroup
+ done
diff --git a/vcpkg-ports/libvpx/portfile.cmake b/vcpkg-ports/libvpx/portfile.cmake
new file mode 100644
index 00000000..478fadbf
--- /dev/null
+++ b/vcpkg-ports/libvpx/portfile.cmake
@@ -0,0 +1,283 @@
+vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
+
+set(LIBVPX_VERSION 1.12.0)
+
+vcpkg_from_github(
+ OUT_SOURCE_PATH SOURCE_PATH
+ REPO webmproject/libvpx
+ REF v${LIBVPX_VERSION}
+ SHA512 dc059bc3102b75524ae29989372334b3e0f2acf1520e5a4daa4073831bb55949d82897c498fb9d2d38b59f1a66bb0ad24407d0d086b1e3a8394a4933f04f2ed0
+ HEAD_REF master
+ PATCHES
+ 0002-Fix-nasm-debug-format-flag.patch
+ 0003-add-uwp-v142-and-v143-support.patch
+ 0004-remove-library-suffixes.patch
+)
+
+vcpkg_find_acquire_program(PERL)
+
+get_filename_component(PERL_EXE_PATH ${PERL} DIRECTORY)
+
+if(CMAKE_HOST_WIN32)
+ vcpkg_acquire_msys(MSYS_ROOT PACKAGES make)
+ set(BASH ${MSYS_ROOT}/usr/bin/bash.exe)
+ set(ENV{PATH} "${MSYS_ROOT}/usr/bin;$ENV{PATH};${PERL_EXE_PATH}")
+else()
+ set(BASH /bin/bash)
+ set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}")
+endif()
+
+vcpkg_find_acquire_program(NASM)
+get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
+vcpkg_add_to_path(${NASM_EXE_PATH})
+
+if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
+
+ file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
+
+ if(VCPKG_CRT_LINKAGE STREQUAL static)
+ set(LIBVPX_CRT_LINKAGE --enable-static-msvcrt)
+ set(LIBVPX_CRT_SUFFIX mt)
+ else()
+ set(LIBVPX_CRT_SUFFIX md)
+ endif()
+
+ if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL WindowsStore AND (VCPKG_PLATFORM_TOOLSET STREQUAL v142 OR VCPKG_PLATFORM_TOOLSET STREQUAL v143))
+ set(LIBVPX_TARGET_OS "uwp")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x86 OR VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
+ set(LIBVPX_TARGET_OS "win32")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64 OR VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
+ set(LIBVPX_TARGET_OS "win64")
+ endif()
+
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
+ set(LIBVPX_TARGET_ARCH "x86-${LIBVPX_TARGET_OS}")
+ set(LIBVPX_ARCH_DIR "Win32")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
+ set(LIBVPX_TARGET_ARCH "x86_64-${LIBVPX_TARGET_OS}")
+ set(LIBVPX_ARCH_DIR "x64")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
+ set(LIBVPX_TARGET_ARCH "arm64-${LIBVPX_TARGET_OS}")
+ set(LIBVPX_ARCH_DIR "ARM64")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
+ set(LIBVPX_TARGET_ARCH "armv7-${LIBVPX_TARGET_OS}")
+ set(LIBVPX_ARCH_DIR "ARM")
+ endif()
+
+ if(VCPKG_PLATFORM_TOOLSET STREQUAL v143)
+ set(LIBVPX_TARGET_VS "vs17")
+ elseif(VCPKG_PLATFORM_TOOLSET STREQUAL v142)
+ set(LIBVPX_TARGET_VS "vs16")
+ else()
+ set(LIBVPX_TARGET_VS "vs15")
+ endif()
+
+ set(OPTIONS "--disable-examples --disable-tools --disable-docs --enable-pic")
+
+ if("realtime" IN_LIST FEATURES)
+ set(OPTIONS "${OPTIONS} --enable-realtime-only")
+ endif()
+
+ if("highbitdepth" IN_LIST FEATURES)
+ set(OPTIONS "${OPTIONS} --enable-vp9-highbitdepth")
+ endif()
+
+ message(STATUS "Generating makefile")
+ file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc
+ "${SOURCE_PATH}/configure"
+ --target=${LIBVPX_TARGET_ARCH}-${LIBVPX_TARGET_VS}
+ ${LIBVPX_CRT_LINKAGE}
+ ${OPTIONS}
+ --as=nasm
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}"
+ LOGNAME configure-${TARGET_TRIPLET})
+
+ message(STATUS "Generating MSBuild projects")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc -c "make dist"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}"
+ LOGNAME generate-${TARGET_TRIPLET})
+
+ vcpkg_build_msbuild(
+ PROJECT_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx.vcxproj"
+ OPTIONS /p:UseEnv=True
+ )
+
+ # note: pdb file names are hardcoded in the lib file, cannot rename
+ set(LIBVPX_OUTPUT_PREFIX "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/${LIBVPX_ARCH_DIR}")
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ file(INSTALL "${LIBVPX_OUTPUT_PREFIX}/Release/vpx.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
+ if (EXISTS "${LIBVPX_OUTPUT_PREFIX}/Release/vpx.pdb")
+ file(INSTALL "${LIBVPX_OUTPUT_PREFIX}/Release/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
+ else()
+ file(INSTALL "${LIBVPX_OUTPUT_PREFIX}/Release/vpx/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
+ endif()
+ endif()
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ file(INSTALL "${LIBVPX_OUTPUT_PREFIX}/Debug/vpx.lib" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
+ if (EXISTS "${LIBVPX_OUTPUT_PREFIX}/Debug/vpx.pdb")
+ file(INSTALL "${LIBVPX_OUTPUT_PREFIX}/Debug/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
+ else()
+ file(INSTALL "${LIBVPX_OUTPUT_PREFIX}/Debug/vpx/vpx.pdb" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
+ endif()
+ endif()
+
+ if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
+ set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
+ elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
+ set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
+ else()
+ set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${LIBVPX_VERSION}/include/vpx")
+ endif()
+ file(
+ INSTALL
+ "${LIBVPX_INCLUDE_DIR}"
+ DESTINATION
+ "${CURRENT_PACKAGES_DIR}/include"
+ RENAME
+ "vpx")
+ if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ set(LIBVPX_PREFIX "${CURRENT_INSTALLED_DIR}")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/vpx.pc.in" "${CURRENT_PACKAGES_DIR}/lib/pkgconfig/vpx.pc" @ONLY)
+ endif()
+
+ if (NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ set(LIBVPX_PREFIX "${CURRENT_INSTALLED_DIR}/debug")
+ configure_file("${CMAKE_CURRENT_LIST_DIR}/vpx.pc.in" "${CURRENT_PACKAGES_DIR}/debug/lib/pkgconfig/vpx.pc" @ONLY)
+ endif()
+
+else()
+
+ set(OPTIONS "--disable-examples --disable-tools --disable-docs --disable-unit-tests --enable-pic")
+
+ set(OPTIONS_DEBUG "--enable-debug-libs --enable-debug --prefix=${CURRENT_PACKAGES_DIR}/debug")
+ set(OPTIONS_RELEASE "--prefix=${CURRENT_PACKAGES_DIR}")
+
+ if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
+ set(OPTIONS "${OPTIONS} --disable-static --enable-shared")
+ else()
+ set(OPTIONS "${OPTIONS} --enable-static --disable-shared")
+ endif()
+
+ if("realtime" IN_LIST FEATURES)
+ set(OPTIONS "${OPTIONS} --enable-realtime-only")
+ endif()
+
+ if("highbitdepth" IN_LIST FEATURES)
+ set(OPTIONS "${OPTIONS} --enable-vp9-highbitdepth")
+ endif()
+
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
+ set(LIBVPX_TARGET_ARCH "x86")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
+ set(LIBVPX_TARGET_ARCH "x86_64")
+ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
+ set(LIBVPX_TARGET_ARCH "arm64")
+ else()
+ message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE}")
+ endif()
+
+ if(VCPKG_TARGET_IS_MINGW)
+ if(LIBVPX_TARGET_ARCH STREQUAL "x86")
+ set(LIBVPX_TARGET "x86-win32-gcc")
+ else()
+ set(LIBVPX_TARGET "x86_64-win64-gcc")
+ endif()
+ elseif(VCPKG_TARGET_IS_LINUX)
+ set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-linux-gcc")
+ elseif(VCPKG_TARGET_IS_OSX)
+ if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
+ set(LIBVPX_TARGET "arm64-darwin20-gcc")
+ else()
+ set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-darwin17-gcc") # enable latest CPU instructions for best performance and less CPU usage on MacOS
+ endif()
+ else()
+ set(LIBVPX_TARGET "generic-gnu") # use default target
+ endif()
+
+ message(STATUS "Build info. Target: ${LIBVPX_TARGET}; Options: ${OPTIONS}")
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
+ message(STATUS "Configuring libvpx for Release")
+ file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc
+ "${SOURCE_PATH}/configure"
+ --target=${LIBVPX_TARGET}
+ ${OPTIONS}
+ ${OPTIONS_RELEASE}
+ --as=nasm
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
+ LOGNAME configure-${TARGET_TRIPLET}-rel)
+
+ message(STATUS "Building libvpx for Release")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc -c "make -j8"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
+ LOGNAME build-${TARGET_TRIPLET}-rel
+ )
+
+ message(STATUS "Installing libvpx for Release")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc -c "make install"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
+ LOGNAME install-${TARGET_TRIPLET}-rel
+ )
+ endif()
+
+ # --- --- ---
+
+ if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ message(STATUS "Configuring libvpx for Debug")
+ file(MAKE_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc
+ "${SOURCE_PATH}/configure"
+ --target=${LIBVPX_TARGET}
+ ${OPTIONS}
+ ${OPTIONS_DEBUG}
+ --as=nasm
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
+ LOGNAME configure-${TARGET_TRIPLET}-dbg)
+
+ message(STATUS "Building libvpx for Debug")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc -c "make -j8"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
+ LOGNAME build-${TARGET_TRIPLET}-dbg
+ )
+
+ message(STATUS "Installing libvpx for Debug")
+ vcpkg_execute_required_process(
+ COMMAND
+ ${BASH} --noprofile --norc -c "make install"
+ WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
+ LOGNAME install-${TARGET_TRIPLET}-dbg
+ )
+
+ file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
+ file(REMOVE "${CURRENT_PACKAGES_DIR}/debug/lib/libvpx_g.a")
+ endif()
+endif()
+
+vcpkg_fixup_pkgconfig()
+
+if(NOT DEFINED VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
+ set(LIBVPX_CONFIG_DEBUG ON)
+else()
+ set(LIBVPX_CONFIG_DEBUG OFF)
+endif()
+
+configure_file("${CMAKE_CURRENT_LIST_DIR}/unofficial-libvpx-config.cmake.in" "${CURRENT_PACKAGES_DIR}/share/unofficial-libvpx/unofficial-libvpx-config.cmake" @ONLY)
+
+file(INSTALL "${SOURCE_PATH}/LICENSE" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
diff --git a/vcpkg-ports/libvpx/unofficial-libvpx-config.cmake.in b/vcpkg-ports/libvpx/unofficial-libvpx-config.cmake.in
new file mode 100644
index 00000000..d3844d36
--- /dev/null
+++ b/vcpkg-ports/libvpx/unofficial-libvpx-config.cmake.in
@@ -0,0 +1,49 @@
+if(NOT TARGET unofficial::libvpx::libvpx)
+ # Compute the installation prefix relative to this file.
+ get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+ get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+
+ # Add library target (note: vpx always has a static build in vcpkg).
+ add_library(unofficial::libvpx::libvpx STATIC IMPORTED)
+
+ # Add interface include directories and link interface languages (applies to all configurations).
+ set_target_properties(unofficial::libvpx::libvpx PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
+ IMPORTED_LINK_INTERFACE_LANGUAGES "C"
+ )
+ list(APPEND _IMPORT_CHECK_FILES "${_IMPORT_PREFIX}/include/vpx/vpx_codec.h")
+
+ # Add release configuration properties.
+ find_library(_LIBFILE_RELEASE NAMES vpx PATHS "${_IMPORT_PREFIX}/lib/" NO_DEFAULT_PATH)
+ set_property(TARGET unofficial::libvpx::libvpx
+ APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE)
+ set_target_properties(unofficial::libvpx::libvpx PROPERTIES
+ IMPORTED_LOCATION_RELEASE ${_LIBFILE_RELEASE})
+ list(APPEND _IMPORT_CHECK_FILES ${_LIBFILE_RELEASE})
+ unset(_LIBFILE_RELEASE CACHE)
+
+ # Add debug configuration properties.
+ if(@LIBVPX_CONFIG_DEBUG@)
+ find_library(_LIBFILE_DEBUG NAMES vpx PATHS "${_IMPORT_PREFIX}/debug/lib/" NO_DEFAULT_PATH)
+ set_property(TARGET unofficial::libvpx::libvpx
+ APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG)
+ set_target_properties(unofficial::libvpx::libvpx PROPERTIES
+ IMPORTED_LOCATION_DEBUG ${_LIBFILE_DEBUG})
+ list(APPEND _IMPORT_CHECK_FILES ${_LIBFILE_DEBUG})
+ unset(_LIBFILE_DEBUG CACHE)
+ endif()
+
+ # Check header and library files are present.
+ foreach(file ${_IMPORT_CHECK_FILES} )
+ if(NOT EXISTS "${file}" )
+ message(FATAL_ERROR "unofficial::libvpx::libvpx references the file
+ \"${file}\"
+but this file does not exist. Possible reasons include:
+* The file was deleted, renamed, or moved to another location.
+* An install or uninstall procedure did not complete successfully.
+")
+ endif()
+ endforeach()
+ unset(_IMPORT_CHECK_FILES)
+endif()
diff --git a/vcpkg-ports/libvpx/vcpkg.json b/vcpkg-ports/libvpx/vcpkg.json
new file mode 100644
index 00000000..06c3d7d7
--- /dev/null
+++ b/vcpkg-ports/libvpx/vcpkg.json
@@ -0,0 +1,15 @@
+{
+ "name": "libvpx",
+ "version": "1.12.0",
+ "description": "The reference software implementation for the video coding formats VP8 and VP9.",
+ "homepage": "https://github.com/webmproject/libvpx",
+ "license": "BSD-3-Clause",
+ "features": {
+ "highbitdepth": {
+ "description": "use VP9 high bit depth (10/12) profiles"
+ },
+ "realtime": {
+ "description": "enable this option while building for real-time encoding"
+ }
+ }
+}
diff --git a/vcpkg-ports/libvpx/vpx.pc.in b/vcpkg-ports/libvpx/vpx.pc.in
new file mode 100644
index 00000000..df441d30
--- /dev/null
+++ b/vcpkg-ports/libvpx/vpx.pc.in
@@ -0,0 +1,13 @@
+prefix=@LIBVPX_PREFIX@
+# pkg-config file from libvpx v1.10.0
+exec_prefix=${prefix}
+libdir=${prefix}/lib
+includedir=${prefix}/include
+
+Name: vpx
+Description: WebM Project VPx codec implementation
+Version: @LIBVPX_VERSION@
+Requires:
+Conflicts:
+Libs: -L"${libdir}" -lvpx
+Cflags: -I"${includedir}"