vcpkg/ports/x265/portfile.cmake
Kai Pastor c6043cde21
[x265] Update to 3.6, fix pthread flags, add feature "tools" (#39450)
Fixes build errors on android due to wrong pthread flags and 32 bit API
level requirements (`ftello`).

Alternative to #39314.
2024-06-24 18:03:17 -07:00

66 lines
2.0 KiB
CMake

vcpkg_from_bitbucket(
OUT_SOURCE_PATH SOURCE_PATH
REPO multicoreware/x265_git
REF "${VERSION}"
SHA512 cfc3fdd7ce10a6cadf4515707d8f338fe58329cbbbcac11a85f00376e29156baccfb19a514ac2bc816432d15a2a4eb1bb7e16e3a870b6b9f9bc28e1a44270091
HEAD_REF master
PATCHES
disable-install-pdb.patch
version.patch
linkage.diff
pkgconfig.diff
pthread.diff
compiler-target.diff
neon.diff
)
vcpkg_check_features(OUT_FEATURE_OPTIONS OPTIONS
FEATURES
tool ENABLE_CLI
)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86" OR VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
vcpkg_find_acquire_program(NASM)
list(APPEND OPTIONS "-DNASM_EXECUTABLE=${NASM}")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static" AND NOT VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_OSX)
# x265 doesn't create sufficient PIC for asm, breaking usage
# in shared libs, e.g. the libheif gdk pixbuf plugin.
# Users can override this in custom triplets.
list(APPEND OPTIONS "-DENABLE_ASSEMBLY=OFF")
endif()
elseif(VCPKG_TARGET_IS_WINDOWS)
list(APPEND OPTIONS "-DENABLE_ASSEMBLY=OFF")
endif()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ENABLE_SHARED)
vcpkg_cmake_configure(
SOURCE_PATH "${SOURCE_PATH}/source"
OPTIONS
${OPTIONS}
-DENABLE_SHARED=${ENABLE_SHARED}
-DENABLE_PIC=ON
-DENABLE_LIBNUMA=OFF
"-DVERSION=${VERSION}"
OPTIONS_DEBUG
-DENABLE_CLI=OFF
MAYBE_UNUSED_VARIABLES
ENABLE_LIBNUMA
)
vcpkg_cmake_install()
vcpkg_copy_pdbs()
vcpkg_fixup_pkgconfig()
if("tool" IN_LIST FEATURES)
vcpkg_copy_tools(TOOL_NAMES x265 AUTO_CLEAN)
endif()
if(VCPKG_TARGET_IS_WINDOWS AND VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/include/x265.h" "#ifdef X265_API_IMPORTS" "#if 1")
endif()
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/COPYING")