VCPKG port fixes

* Do not patch vcpkg - replace the cmake script fully
  * Actualize libvpx port

[skip ci]

Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
This commit is contained in:
Vasyl Gello 2023-11-15 12:47:33 +02:00
parent 882b39b067
commit bfe282c2db
5 changed files with 85 additions and 72 deletions

View File

@ -1225,9 +1225,7 @@ jobs:
- name: Install vcpkg dependencies
run: |
pushd $VCPKG_ROOT
git apply --ignore-space-change "$OLDPWD/res/vcpkg/0001-Extend-crosscompiling-efforts-to-other-architectures.patch"
popd
cp $PWD/res/vcpkg/linux.cmake $VCPKG_ROOT/scripts/toolchains/linux.cmake
$VCPKG_ROOT/vcpkg install --triplet arm-linux --x-install-root="$VCPKG_ROOT/installed"
shell: bash

View File

@ -1,53 +0,0 @@
From 4f03e584befa8ccee59eb6e8556a11d968f1785f Mon Sep 17 00:00:00 2001
From: Vasyl Gello <vasek.gello@gmail.com>
Date: Mon, 13 Nov 2023 05:30:49 +0000
Subject: [PATCH] Extend crosscompiling efforts to other architectures
Signed-off-by: Vasyl Gello <vasek.gello@gmail.com>
---
scripts/toolchains/linux.cmake | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/scripts/toolchains/linux.cmake b/scripts/toolchains/linux.cmake
index f19940b..f22c710 100644
--- a/scripts/toolchains/linux.cmake
+++ b/scripts/toolchains/linux.cmake
@@ -13,7 +13,7 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
string(APPEND VCPKG_LINKER_FLAGS " -m32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(CMAKE_SYSTEM_PROCESSOR armv7l CACHE STRING "")
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
endif()
@@ -25,12 +25,12 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "arm-linux-gnueabihf-as")
- endif()
- message(STATUS "Cross compiling arm on host x86_64, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
+ endif()
+ message(STATUS "Cross compiling arm on host ${CMAKE_HOST_SYSTEM_PROCESSOR}, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64 CACHE STRING "")
- if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux" AND CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "x86_64")
+ if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
endif()
@@ -42,8 +42,8 @@ elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "aarch64-linux-gnu-as")
- endif()
- message(STATUS "Cross compiling arm64 on host x86_64, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
+ endif()
+ message(STATUS "Cross compiling arm64 on host ${CMAKE_HOST_SYSTEM_PROCESSOR}, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
endif()
--
2.40.1

View File

@ -26,10 +26,11 @@ else()
set(ENV{PATH} "${MSYS_ROOT}/usr/bin:$ENV{PATH}:${PERL_EXE_PATH}")
endif()
vcpkg_find_acquire_program(NASM)
get_filename_component(NASM_EXE_PATH ${NASM} DIRECTORY)
vcpkg_add_to_path(${NASM_EXE_PATH})
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")
@ -130,12 +131,12 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
endif()
else()
yasm_tool_helper(APPEND_TO_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}")
set(AS_NASM "--as=nasm")
if(VCPKG_LIBRARY_LINKAGE STREQUAL "dynamic")
set(OPTIONS "${OPTIONS} --disable-static --enable-shared")
@ -170,6 +171,7 @@ else()
if(VCPKG_DETECTED_CMAKE_C_COMPILER MATCHES "([^\/]*-)gcc$")
message(STATUS "Cross-building for ${TARGET_TRIPLET} with ${CMAKE_MATCH_1}")
set(ENV{CROSS} ${CMAKE_MATCH_1})
unset(AS_NASM)
else()
set(ENV{CC} ${VCPKG_DETECTED_CMAKE_C_COMPILER})
set(ENV{CXX} ${VCPKG_DETECTED_CMAKE_CXX_COMPILER})
@ -191,16 +193,12 @@ else()
set(LIBVPX_TARGET "generic-gnu")
# 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")
endif()
# Set environment variables for configure
@ -208,6 +206,8 @@ else()
set(ENV{LDFLAGS} "${LDFLAGS} --target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET}")
# Set clang target
set(OPTIONS "${OPTIONS} --extra-cflags=--target=${VCPKG_DETECTED_CMAKE_C_COMPILER_TARGET} --extra-cxxflags=--target=${VCPKG_DETECTED_CMAKE_CXX_COMPILER_TARGET}")
# Unset nasm and let AS do its job
unset(AS_NASM)
elseif(VCPKG_TARGET_IS_OSX)
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(LIBVPX_TARGET "arm64-darwin20-gcc")
@ -242,6 +242,7 @@ else()
${OPTIONS}
${OPTIONS_RELEASE}
${MAC_OSX_MIN_VERSION_CFLAGS}
${AS_NASM}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel"
LOGNAME configure-${TARGET_TRIPLET}-rel)
@ -275,6 +276,7 @@ else()
${OPTIONS}
${OPTIONS_DEBUG}
${MAC_OSX_MIN_VERSION_CFLAGS}
${AS_NASM}
WORKING_DIRECTORY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg"
LOGNAME configure-${TARGET_TRIPLET}-dbg)

View File

@ -13,14 +13,6 @@
"name": "vcpkg-msbuild",
"host": true,
"platform": "windows"
},
{
"name": "yasm",
"host": true,
"features": [
"tools"
],
"platform": "!(windows & !mingw)"
}
],
"features": {

74
res/vcpkg/linux.cmake Normal file
View File

@ -0,0 +1,74 @@
if(NOT _VCPKG_LINUX_TOOLCHAIN)
set(_VCPKG_LINUX_TOOLCHAIN 1)
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
set(CMAKE_CROSSCOMPILING OFF CACHE BOOL "")
endif()
set(CMAKE_SYSTEM_NAME Linux CACHE STRING "")
if(VCPKG_TARGET_ARCHITECTURE STREQUAL "x64")
set(CMAKE_SYSTEM_PROCESSOR x86_64 CACHE STRING "")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "x86")
set(CMAKE_SYSTEM_PROCESSOR x86 CACHE STRING "")
string(APPEND VCPKG_C_FLAGS " -m32")
string(APPEND VCPKG_CXX_FLAGS " -m32")
string(APPEND VCPKG_LINKER_FLAGS " -m32")
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm")
set(CMAKE_SYSTEM_PROCESSOR armv7l CACHE STRING "")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "arm-linux-gnueabihf-g++")
endif()
if(NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "arm-linux-gnueabihf-gcc")
endif()
if(NOT DEFINED CMAKE_ASM_COMPILER)
set(CMAKE_ASM_COMPILER "arm-linux-gnueabihf-gcc")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "arm-linux-gnueabihf-as")
endif()
message(STATUS "Cross compiling arm on host ${CMAKE_HOST_SYSTEM_PROCESSOR}, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
elseif(VCPKG_TARGET_ARCHITECTURE STREQUAL "arm64")
set(CMAKE_SYSTEM_PROCESSOR aarch64 CACHE STRING "")
if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux")
if(NOT DEFINED CMAKE_CXX_COMPILER)
set(CMAKE_CXX_COMPILER "aarch64-linux-gnu-g++")
endif()
if(NOT DEFINED CMAKE_C_COMPILER)
set(CMAKE_C_COMPILER "aarch64-linux-gnu-gcc")
endif()
if(NOT DEFINED CMAKE_ASM_COMPILER)
set(CMAKE_ASM_COMPILER "aarch64-linux-gnu-gcc")
endif()
if(NOT DEFINED CMAKE_ASM-ATT_COMPILER)
set(CMAKE_ASM-ATT_COMPILER "aarch64-linux-gnu-as")
endif()
message(STATUS "Cross compiling arm64 on host ${CMAKE_HOST_SYSTEM_PROCESSOR}, use cross compiler: ${CMAKE_CXX_COMPILER}/${CMAKE_C_COMPILER}")
endif()
endif()
get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if(NOT _CMAKE_IN_TRY_COMPILE)
string(APPEND CMAKE_C_FLAGS_INIT " -fPIC ${VCPKG_C_FLAGS} ")
string(APPEND CMAKE_CXX_FLAGS_INIT " -fPIC ${VCPKG_CXX_FLAGS} ")
string(APPEND CMAKE_C_FLAGS_DEBUG_INIT " ${VCPKG_C_FLAGS_DEBUG} ")
string(APPEND CMAKE_CXX_FLAGS_DEBUG_INIT " ${VCPKG_CXX_FLAGS_DEBUG} ")
string(APPEND CMAKE_C_FLAGS_RELEASE_INIT " ${VCPKG_C_FLAGS_RELEASE} ")
string(APPEND CMAKE_CXX_FLAGS_RELEASE_INIT " ${VCPKG_CXX_FLAGS_RELEASE} ")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${VCPKG_LINKER_FLAGS} ")
if(VCPKG_CRT_LINKAGE STREQUAL "static")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT "-static ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT "-static ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-static ")
endif()
string(APPEND CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT " ${VCPKG_LINKER_FLAGS_DEBUG} ")
string(APPEND CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT " ${VCPKG_LINKER_FLAGS_RELEASE} ")
endif()
endif()