portfile.cmake 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. vcpkg_from_github(
  2. OUT_SOURCE_PATH SOURCE_PATH
  3. REPO xiph/opus
  4. REF "v${VERSION}"
  5. SHA512 4ffefd9c035671024f9720c5129bfe395dea04f0d6b730041c2804e89b1db6e4d19633ad1ae58855afc355034233537361e707f26dc53adac916554830038fab
  6. HEAD_REF main
  7. PATCHES fix-pkgconfig-version.patch
  8. )
  9. vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
  10. FEATURES
  11. avx2 AVX2_SUPPORTED
  12. )
  13. set(ADDITIONAL_OPUS_OPTIONS "")
  14. if(VCPKG_TARGET_IS_MINGW)
  15. set(STACK_PROTECTOR OFF)
  16. string(APPEND VCPKG_C_FLAGS "-D_FORTIFY_SOURCE=0")
  17. string(APPEND VCPKG_CXX_FLAGS "-D_FORTIFY_SOURCE=0")
  18. if(VCPKG_TARGET_ARCHITECTURE MATCHES "^(ARM|arm)64$")
  19. list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_USE_NEON=OFF") # for version 1.3.1 (remove for future Opus release)
  20. list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_DISABLE_INTRINSICS=ON") # for HEAD (and future Opus release)
  21. endif()
  22. elseif(VCPKG_TARGET_IS_EMSCRIPTEN)
  23. set(STACK_PROTECTOR OFF)
  24. else()
  25. set(STACK_PROTECTOR ON)
  26. endif()
  27. if((VCPKG_TARGET_IS_LINUX AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm") OR
  28. (VCPKG_TARGET_IS_ANDROID AND VCPKG_TARGET_ARCHITECTURE STREQUAL "arm" AND VCPKG_CMAKE_CONFIGURE_OPTIONS MATCHES "ANDROID_ARM_NEON"))
  29. message(STATUS "Disabling ARM NEON and intrinsics on ${TARGET_TRIPLET}")
  30. list(APPEND ADDITIONAL_OPUS_OPTIONS "-DOPUS_DISABLE_INTRINSICS=ON -DCOMPILER_SUPPORTS_NEON=OFF") # for HEAD (and future Opus release)
  31. endif()
  32. vcpkg_cmake_configure(
  33. SOURCE_PATH "${SOURCE_PATH}"
  34. OPTIONS ${FEATURE_OPTIONS}
  35. -DPACKAGE_VERSION=${VERSION}
  36. -DOPUS_STACK_PROTECTOR=${STACK_PROTECTOR}
  37. -DOPUS_INSTALL_PKG_CONFIG_MODULE=ON
  38. -DOPUS_INSTALL_CMAKE_CONFIG_MODULE=ON
  39. -DOPUS_BUILD_PROGRAMS=OFF
  40. -DOPUS_BUILD_TESTING=OFF
  41. ${ADDITIONAL_OPUS_OPTIONS}
  42. MAYBE_UNUSED_VARIABLES
  43. OPUS_USE_NEON
  44. OPUS_DISABLE_INTRINSICS
  45. )
  46. vcpkg_cmake_install()
  47. vcpkg_copy_pdbs()
  48. vcpkg_cmake_config_fixup(CONFIG_PATH lib/cmake/Opus)
  49. vcpkg_fixup_pkgconfig(SYSTEM_LIBRARIES m)
  50. file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/lib/cmake"
  51. "${CURRENT_PACKAGES_DIR}/lib/cmake"
  52. "${CURRENT_PACKAGES_DIR}/debug/include")
  53. vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")