vcpkg/ports/opus/portfile.cmake
Cheney Wang 4912fbd4c1
[opus] update to v1.5.1 (#38124)
Fixes https://github.com/microsoft/vcpkg/issues/38111

Modified the feature name and corresponding option as `avx2` because the
upstream change:
84484a6790.

Tested all feature and usage on the following triplets:
```
x64-windows
x64-windows-static
x86-windows
```

- [x] Changes comply with the [maintainer
guide](https://github.com/microsoft/vcpkg-docs/blob/main/vcpkg/contributing/maintainer-guide.md).
- [x] SHA512s are updated for each updated download.
- [ ] ~The "supports" clause reflects platforms that may be fixed by
this new version.~
- [ ] ~Any fixed [CI
baseline](https://github.com/microsoft/vcpkg/blob/master/scripts/ci.baseline.txt)
entries are removed from that file.~
- [ ] ~Any patches that are no longer applied are deleted from the
port's directory.~
- [x] The version database is fixed by rerunning `./vcpkg x-add-version
--all` and committing the result.
- [x] Only one version is added to each modified port's versions file.
2024-04-19 07:55:28 -04:00

56 lines
1.8 KiB
CMake

vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO xiph/opus
REF "v${VERSION}"
SHA512 ba79ad035993e7bc4c09b7d77964ba913eb0b2be33305e8a04a8c49aaab21c4d96ac828e31ae45484896105851fdfc8c305c63c8400e4481dd76c62a1c12286b
HEAD_REF main
PATCHES fix-pkgconfig-version.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
avx2 AVX2_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")
if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)64$")
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()
elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
set(STACK_PROTECTOR OFF)
else()
set(STACK_PROTECTOR ON)
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")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")