[x264]: enable cross-compilation for linux arm64 target.

This commit is contained in:
Sylvain Prevost 2022-02-02 03:16:32 -06:00
parent 17b6ce4e38
commit f828a420ff
2 changed files with 34 additions and 1 deletions

View File

@ -32,6 +32,35 @@ if(VCPKG_TARGET_IS_LINUX)
list(APPEND OPTIONS --enable-pic)
endif()
vcpkg_cmake_get_vars(cmake_vars_file)
include("${cmake_vars_file}")
if (VCPKG_DETECTED_CMAKE_CROSSCOMPILING STREQUAL "TRUE")
if (VCPKG_TARGET_IS_LINUX)
if (VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
if (DEFINED ENV{CROSS_PREFIX})
# allow toolchain to specify the cross-prefix
set(cross_prefix $ENV{CROSS_PREFIX})
else()
# attempt to determine the cross-prefix from VCPKG_DETECTED_CMAKE_C/CXX_COMPILER using the most likely naming conventions
if (${VCPKG_DETECTED_CMAKE_C_COMPILER} MATCHES ".*-gcc")
string(REGEX REPLACE "gcc$" "" full_cross_prefix ${VCPKG_DETECTED_CMAKE_C_COMPILER})
get_filename_component(cross_prefix ${full_cross_prefix} NAME)
elseif (${VCPKG_DETECTED_CMAKE_CXX_COMPILER} MATCHES ".*-g\\+\\+")
string(REGEX REPLACE "g\\+\\+$" "" full_cross_prefix ${VCPKG_DETECTED_CMAKE_CXX_COMPILER})
get_filename_component(cross_prefix ${full_cross_prefix} NAME)
else()
message(AUTHOR_WARNING "Could not self-determine cross-prefix. Will attempt to use 'aarch64-linux-gnu-'. You should use ENV{CROSS_PREFIX} in your toolchain to override it.")
set(cross_prefix "aarch64-linux-gnu-")
endif()
endif()
list(APPEND OPTIONS --host=aarch64-linux)
list(APPEND OPTIONS --cross-prefix=${cross_prefix})
list(APPEND OPTIONS --disable-asm)
endif()
endif()
endif()
vcpkg_configure_make(
SOURCE_PATH ${SOURCE_PATH}
NO_ADDITIONAL_PATHS

View File

@ -1,7 +1,7 @@
{
"name": "x264",
"version-string": "164-5db6aa6cab1b146",
"port-version": 4,
"port-version": 5,
"description": "x264 is a free software library and application for encoding video streams into the H.264/MPEG-4 AVC compression format",
"homepage": "https://github.com/mirror/x264",
"supports": "!(arm & windows)",
@ -9,6 +9,10 @@
{
"name": "pthread",
"platform": "linux & osx"
},
{
"name": "vcpkg-cmake",
"host": true
}
]
}