Add custom ports not (yet) in upstream vcpkg

aom 3.7.0
libvpx 1.13.1: https://github.com/microsoft/vcpkg/pull/34814

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
Vasyl Gello 2023-11-03 09:50:17 +02:00
parent 9f4a844c9b
commit 4584cebad5
18 changed files with 949 additions and 0 deletions

View File

@ -0,0 +1,75 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 18190f647..f4b1b359d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,6 +23,9 @@ endif()
project(AOM C CXX)
+include(GNUInstallDirs)
+include(CMakePackageConfigHelpers)
+
# GENERATED source property global visibility.
if(POLICY CMP0118)
cmake_policy(SET CMP0118 NEW)
@@ -302,6 +305,52 @@ if(BUILD_SHARED_LIBS)
set(AOM_LIB_TARGETS ${AOM_LIB_TARGETS} aom_static)
endif()
+set(PUBLIC_HEADERS
+ aom/aom.h
+ aom/aom_codec.h
+ aom/aom_decoder.h
+ aom/aom_encoder.h
+ aom/aom_frame_buffer.h
+ aom/aom_image.h
+ aom/aom_integer.h
+ aom/aomcx.h
+ aom/aomdx.h
+)
+
+set_target_properties(aom PROPERTIES
+ PUBLIC_HEADER "${PUBLIC_HEADERS}")
+
+
+target_include_directories(aom
+ PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+ $<INSTALL_INTERFACE:include>)
+
+install(TARGETS aom
+ EXPORT unofficial-aom-targets
+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
+ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}"
+ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/aom")
+
+install(EXPORT unofficial-aom-targets
+ FILE unofficial-aom-targets.cmake
+ NAMESPACE unofficial::
+ DESTINATION lib/cmake/aom)
+
+configure_package_config_file(cmake/aom-config.cmake.in
+ ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake
+ INSTALL_DESTINATION lib/cmake/aom
+ NO_SET_AND_CHECK_MACRO
+ NO_CHECK_REQUIRED_COMPONENTS_MACRO)
+
+write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake
+ VERSION ${SO_FILE_VERSION}
+ COMPATIBILITY SameMajorVersion)
+
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/aom-config.cmake
+ ${CMAKE_CURRENT_BINARY_DIR}/aom-config-version.cmake
+ DESTINATION lib/cmake/aom)
+
# Setup dependencies.
if(CONFIG_THREE_PASS)
setup_ivf_dec_targets()
diff --git a/cmake/aom-config.cmake.in b/cmake/aom-config.cmake.in
new file mode 100644
index 000000000..91cac3b5b
--- /dev/null
+++ b/cmake/aom-config.cmake.in
@@ -0,0 +1,2 @@
+@PACKAGE_INIT@
+include(${CMAKE_CURRENT_LIST_DIR}/unofficial-aom-targets.cmake)

View File

@ -0,0 +1,19 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8f459f39c4..d8c1bb2b02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -286,12 +286,12 @@ add_library(aom ${target_objs_aom} $<TARGET_OBJECTS:aom_rtcd>)
if(BUILD_SHARED_LIBS)
add_library(aom_static STATIC ${target_objs_aom} $<TARGET_OBJECTS:aom_rtcd>)
- set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom)
+ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static)
if(MSVC OR (WIN32 AND NOT MINGW))
# Fix race condition on the export library file between the two versions.
# Affects MSVC in all three flavors (stock, Clang/CL, LLVM-- the latter sets
# MSVC and MINGW both to FALSE).
- set_target_properties(aom PROPERTIES ARCHIVE_OUTPUT_NAME "aom_dll")
+ set_target_properties(aom PROPERTIES ARCHIVE_OUTPUT_NAME "aom")
endif()
if(NOT MSVC)

View File

@ -0,0 +1,13 @@
diff --git a/build/cmake/aom_configure.cmake b/build/cmake/aom_configure.cmake
index aaef2c310..5500ad4a3 100644
--- a/build/cmake/aom_configure.cmake
+++ b/build/cmake/aom_configure.cmake
@@ -309,6 +309,8 @@ if(MSVC)
# Disable MSVC warnings that suggest making code non-portable.
add_compiler_flag_if_supported("/wd4996")
+ # Disable MSVC warnings for potentially uninitialized local pointer variable.
+ add_compiler_flag_if_supported("/wd4703")
if(ENABLE_WERROR)
add_compiler_flag_if_supported("/WX")
endif()

View File

@ -0,0 +1,60 @@
# NASM is required to build AOM
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(${NASM_EXE_PATH})
# Perl is required to build AOM
vcpkg_find_acquire_program(PERL)
get_filename_component(PERL_PATH ${PERL} DIRECTORY)
vcpkg_add_to_path(${PERL_PATH})
vcpkg_from_git(
OUT_SOURCE_PATH SOURCE_PATH
URL "https://aomedia.googlesource.com/aom"
REF 6054fae218eda6e53e1e3b4f7ef0fff4877c7bf1 # v3.7.0
PATCHES
aom-rename-static.diff
aom-uninitialized-pointer.diff
# Can be dropped when https://bugs.chromium.org/p/aomedia/issues/detail?id=3029 is merged into the upstream
aom-install.diff
)
set(aom_target_cpu "")
if(VCPKG_TARGET_IS_UWP OR (VCPKG_TARGET_IS_WINDOWS AND VCPKG_TARGET_ARCHITECTURE MATCHES "^arm"))
# UWP + aom's assembler files result in weirdness and build failures
# Also, disable assembly on ARM and ARM64 Windows to fix compilation issues.
set(aom_target_cpu "-DAOM_TARGET_CPU=generic")
endif()
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_TARGET_IS_LINUX)
set(aom_target_cpu "-DENABLE_NEON=OFF")
endif()
vcpkg_cmake_configure(
SOURCE_PATH ${SOURCE_PATH}
OPTIONS
${aom_target_cpu}
-DENABLE_DOCS=OFF
-DENABLE_EXAMPLES=OFF
-DENABLE_TESTDATA=OFF
-DENABLE_TESTS=OFF
-DENABLE_TOOLS=OFF
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
# Move cmake configs
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/${PORT})
# Remove duplicate files
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include
${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(INSTALL ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
vcpkg_fixup_pkgconfig()

17
res/vcpkg/aom/vcpkg.json Normal file
View File

@ -0,0 +1,17 @@
{
"name": "aom",
"version-semver": "3.7.0",
"description": "AV1 codec library",
"homepage": "https://aomedia.googlesource.com/aom",
"license": "BSD-2-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
]
}

View File

@ -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*)

View File

@ -0,0 +1,153 @@
diff --git a/build/make/configure.sh b/build/make/configure.sh
index 110f16e..c161d0e 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 ae289f7..78f5fc1 100644
--- a/configure
+++ b/configure
@@ -103,6 +103,8 @@ all_platforms="${all_platforms} arm64-darwin20-gcc"
all_platforms="${all_platforms} arm64-darwin21-gcc"
all_platforms="${all_platforms} arm64-darwin22-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"
@@ -112,6 +114,8 @@ 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"
@@ -143,6 +147,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"
@@ -167,6 +173,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"
@@ -491,11 +499,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}"
@@ -584,6 +591,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

View File

@ -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

View File

@ -0,0 +1,13 @@
diff --git a/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c b/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c
index 33753f7..997775a 100644
--- a/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c
+++ b/vp9/encoder/arm/neon/vp9_diamond_search_sad_neon.c
@@ -220,7 +220,7 @@ int vp9_diamond_search_sad_neon(const MACROBLOCK *x,
// Look up the component cost of the residual motion vector
{
uint32_t cost[4];
- int16_t __attribute__((aligned(16))) rowcol[8];
+ DECLARE_ALIGNED(16, int16_t, rowcol[8]);
vst1q_s16(rowcol, v_diff_mv_w);
// Note: This is a use case for gather instruction

View File

@ -0,0 +1,314 @@
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO webmproject/libvpx
REF "v${VERSION}"
SHA512 49706838563c92fab7334376848d0f374efcbc1729ef511e967c908fd2ecd40e8d197f1d85da6553b3a7026bdbc17e5a76595319858af26ce58cb9a4c3854897
HEAD_REF master
PATCHES
0002-Fix-nasm-debug-format-flag.patch
0003-add-uwp-v142-and-v143-support.patch
0004-remove-library-suffixes.patch
0005-fix-arm64-build.patch # Upstream commit: https://github.com/webmproject/libvpx/commit/858a8c611f4c965078485860a6820e2135e6611b
)
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()
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(${NASM_EXE_PATH})
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp")
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}-tmp")
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}-tmp"
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}-tmp"
LOGNAME generate-${TARGET_TRIPLET})
vcpkg_msbuild_install(
SOURCE_PATH "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp"
PROJECT_SUBPATH vpx.vcxproj
)
if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
else()
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${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()
vcpkg_find_acquire_program(YASM)
get_filename_component(YASM_EXE_PATH ${YASM} DIRECTORY)
vcpkg_add_to_path(${YASM_EXE_PATH})
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 arm)
set(LIBVPX_TARGET_ARCH "armv7")
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")
include($ENV{VCPKG_ROOT}/buildtrees/detect_compiler/${VCPKG_TARGET_ARCHITECTURE}-linux-rel/CMakeFiles/${CMAKE_VERSION}/CMakeCCompiler.cmake)
set(ENV{CROSS} "${CMAKE_LIBRARY_ARCHITECTURE}-")
elseif(VCPKG_TARGET_IS_ANDROID)
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-android-gcc")
set(ANDROID_API 21)
# From ndk android.toolchsin.cmake
if(CMAKE_HOST_SYSTEM_NAME STREQUAL Linux)
set(ANDROID_HOST_TAG linux-x86_64)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
set(ANDROID_HOST_TAG darwin-x86_64)
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL Windows)
set(ANDROID_HOST_TAG windows-x86_64)
endif()
set(ANDROID_TOOLCHAIN_ROOT
"$ENV{ANDROID_NDK_HOME}/toolchains/llvm/prebuilt/${ANDROID_HOST_TAG}")
# Settings
if(VCPKG_TARGET_ARCHITECTURE STREQUAL x86)
set(ANDROID_TARGET_TRIPLET i686-linux-android)
set(OPTIONS "${OPTIONS} --disable-sse4_1 --disable-avx --disable-avx2 --disable-avx512")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL x64)
set(ANDROID_TARGET_TRIPLET x86_64-linux-android)
set(OPTIONS "${OPTIONS} --disable-avx --disable-avx2 --disable-avx512")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(ANDROID_TARGET_TRIPLET armv7a-linux-androideabi)
set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(ANDROID_TARGET_TRIPLET aarch64-linux-android)
set(OPTIONS "${OPTIONS} --enable-thumb --disable-neon")
endif()
# Set environment variables for configure
set(ENV{CC} "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TARGET_TRIPLET}${ANDROID_API}-clang")
set(ENV{CXX} "${ANDROID_TOOLCHAIN_ROOT}/bin/${ANDROID_TARGET_TRIPLET}${ANDROID_API}-clang++")
set(ENV{AR} "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-ar")
set(ENV{AS} "${CMAKE_C_COMPILER}")
set(ENV{LD} "${ANDROID_TOOLCHAIN_ROOT}/bin/ld")
set(ENV{RANLIB} "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-ranlib")
set(ENV{STRIP} "${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-strip")
elseif(VCPKG_TARGET_IS_OSX)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(LIBVPX_TARGET "arm64-darwin20-gcc")
if(DEFINED VCPKG_OSX_DEPLOYMENT_TARGET)
set(MAC_OSX_MIN_VERSION_CFLAGS --extra-cflags=-mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET} --extra-cxxflags=-mmacosx-version-min=${VCPKG_OSX_DEPLOYMENT_TARGET})
endif()
else()
set(LIBVPX_TARGET "${LIBVPX_TARGET_ARCH}-darwin17-gcc") # enable latest CPU instructions for best performance and less CPU usage on MacOS
endif()
elseif(VCPKG_TARGET_IS_IOS)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
set(LIBVPX_TARGET "armv7-darwin-gcc")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
set(LIBVPX_TARGET "arm64-darwin-gcc")
else()
message(FATAL_ERROR "libvpx does not support architecture ${VCPKG_TARGET_ARCHITECTURE} on iOS")
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}
${MAC_OSX_MIN_VERSION_CFLAGS}
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 -j"
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}
${MAC_OSX_MIN_VERSION_CFLAGS}
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 -j"
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)
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")

View File

@ -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()

View File

@ -0,0 +1,22 @@
{
"name": "libvpx",
"version": "1.13.1",
"description": "The reference software implementation for the video coding formats VP8 and VP9.",
"homepage": "https://github.com/webmproject/libvpx",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-msbuild",
"host": true,
"platform": "windows"
}
],
"features": {
"highbitdepth": {
"description": "use VP9 high bit depth (10/12) profiles"
},
"realtime": {
"description": "enable this option while building for real-time encoding"
}
}
}

View File

@ -0,0 +1,12 @@
prefix=@LIBVPX_PREFIX@
exec_prefix=${prefix}
libdir=${prefix}/lib
includedir=${prefix}/include
Name: vpx
Description: WebM Project VPx codec implementation
Version: @VERSION@
Requires:
Conflicts:
Libs: -L"${libdir}" -lvpx
Cflags: -I"${includedir}"

View File

@ -0,0 +1,15 @@
diff --git a/cmake/OpusPackageVersion.cmake b/cmake/OpusPackageVersion.cmake
index 447ce3b..15ebd8e 100644
--- a/cmake/OpusPackageVersion.cmake
+++ b/cmake/OpusPackageVersion.cmake
@@ -4,7 +4,9 @@ endif()
set(__opus_version INCLUDED)
function(get_package_version PACKAGE_VERSION PROJECT_VERSION)
-
+ set(PACKAGE_VERSION "0" CACHE STRING "opus package version")
+ set(PROJECT_VERSION "0" CACHE STRING "opus project version")
+ return()
find_package(Git)
if(GIT_FOUND AND EXISTS "${CMAKE_CURRENT_LIST_DIR}/.git")
execute_process(COMMAND ${GIT_EXECUTABLE}

View File

@ -0,0 +1,58 @@
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xiph/opus
REF "v${VERSION}"
SHA512 86df35cd62ebf3551b2739effb8f818d635656d91d386d7d600a424a92c4c0d6bfbc3986f1ec6cf4950910ac87b28dc9640b9df3b9a6a5a75eb37ae71782b72e
HEAD_REF master
PATCHES fix-pkgconfig-version.patch
reinstate-opus-use-neon.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
avx AVX_SUPPORTED
)
set(ADDITIONAL_OPUS_OPTIONS "")
if(VCPKG_TARGET_IS_MINGW)
set(STACK_PROTECTOR OFF)
string(APPEND VCPKG_C_FLAGS "-D_FORTIFY_SOURCE=0")
string(APPEND VCPKG_CXX_FLAGS "-D_FORTIFY_SOURCE=0")
elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
set(STACK_PROTECTOR OFF)
else()
set(STACK_PROTECTOR ON)
endif()
# Fix build on mingw arm{,64}-* and arm-linux
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)")
list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_USE_NEON=OFF") # for version 1.3.1 (remove for future Opus release)
list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_DISABLE_INTRINSICS=ON") # for HEAD (and future Opus release)
endif()
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}"
OPTIONS ${FEATURE_OPTIONS}
-DPACKAGE_VERSION=${VERSION}
-DOPUS_STACK_PROTECTOR=${STACK_PROTECTOR}
-DOPUS_INSTALL_PKG_CONFIG_MODULE=ON
-DOPUS_INSTALL_CMAKE_CONFIG_MODULE=ON
-DOPUS_BUILD_PROGRAMS=OFF
-DOPUS_BUILD_TESTING=OFF
${ADDITIONAL_OPUS_OPTIONS}
MAYBE_UNUSED_VARIABLES
OPUS_USE_NEON
OPUS_DISABLE_INTRINSICS
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Opus)
vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m)
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake"
"${CURRENT_PACKAGES_DIR}/lib/cmake"
"${CURRENT_PACKAGES_DIR}/debug/include")
file(INSTALL "${SOURCE_PATH}/COPYING" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)

View File

@ -0,0 +1,13 @@
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d824cd..8ff44a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -467,7 +467,7 @@ if(NOT OPUS_DISABLE_INTRINSICS)
endif()
endif()
- if(COMPILER_SUPPORT_NEON)
+ if(COMPILER_SUPPORT_NEON AND OPUS_USE_NEON)
if(OPUS_MAY_HAVE_NEON)
if(RUNTIME_CPU_CAPABILITY_DETECTION)
message(STATUS "OPUS_MAY_HAVE_NEON enabling runtime detection")

23
res/vcpkg/opus/vcpkg.json Normal file
View File

@ -0,0 +1,23 @@
{
"name": "opus",
"version": "1.4",
"port-version": 1,
"description": "Totally open, royalty-free, highly versatile audio codec",
"homepage": "https://github.com/xiph/opus",
"license": "BSD-3-Clause",
"dependencies": [
{
"name": "vcpkg-cmake",
"host": true
},
{
"name": "vcpkg-cmake-config",
"host": true
}
],
"features": {
"avx": {
"description": "Builds the library with avx instruction set"
}
}
}

59
vcpkg.json Normal file
View File

@ -0,0 +1,59 @@
{
"dependencies": [
{
"name": "aom",
"host": true
},
{
"name": "aom",
"host": false
},
{
"name": "cpu-features",
"platform": "android"
},
{
"name": "libjpeg-turbo",
"host": true
},
{
"name": "libjpeg-turbo",
"host": false
},
{
"name": "oboe",
"platform": "android"
},
{
"name": "opus",
"host": true
},
{
"name": "opus",
"host": false
},
{
"name": "libvpx",
"host": true
},
{
"name": "libvpx",
"host": false
},
{
"name": "libyuv",
"host": true
},
{
"name": "libyuv",
"host": false
}
],
"vcpkg-configuration": {
"default-registry": {
"kind": "builtin",
"baseline": ""
},
"overlay-ports": [ "./res/vcpkg" ]
}
}