diff --git a/.github/workflows/flutter-build.yml b/.github/workflows/flutter-build.yml index a960f72cc..19cdd3a31 100644 --- a/.github/workflows/flutter-build.yml +++ b/.github/workflows/flutter-build.yml @@ -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 diff --git a/res/vcpkg/0001-Extend-crosscompiling-efforts-to-other-architectures.patch b/res/vcpkg/0001-Extend-crosscompiling-efforts-to-other-architectures.patch deleted file mode 100644 index 313bf939b..000000000 --- a/res/vcpkg/0001-Extend-crosscompiling-efforts-to-other-architectures.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 4f03e584befa8ccee59eb6e8556a11d968f1785f Mon Sep 17 00:00:00 2001 -From: Vasyl Gello -Date: Mon, 13 Nov 2023 05:30:49 +0000 -Subject: [PATCH] Extend crosscompiling efforts to other architectures - -Signed-off-by: Vasyl Gello ---- - 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 - diff --git a/res/vcpkg/libvpx/portfile.cmake b/res/vcpkg/libvpx/portfile.cmake index f3c3419e5..30f794314 100644 --- a/res/vcpkg/libvpx/portfile.cmake +++ b/res/vcpkg/libvpx/portfile.cmake @@ -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) diff --git a/res/vcpkg/libvpx/vcpkg.json b/res/vcpkg/libvpx/vcpkg.json index 5c8137363..0a11ff7ea 100644 --- a/res/vcpkg/libvpx/vcpkg.json +++ b/res/vcpkg/libvpx/vcpkg.json @@ -13,14 +13,6 @@ "name": "vcpkg-msbuild", "host": true, "platform": "windows" - }, - { - "name": "yasm", - "host": true, - "features": [ - "tools" - ], - "platform": "!(windows & !mingw)" } ], "features": { diff --git a/res/vcpkg/linux.cmake b/res/vcpkg/linux.cmake new file mode 100644 index 000000000..9496930d0 --- /dev/null +++ b/res/vcpkg/linux.cmake @@ -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()