From 86aa43926ffe1008412c4af2c0ddd6abf145426f Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Wed, 22 Dec 2021 15:00:24 +0000 Subject: [PATCH] WIP Signed-off-by: Rafael Kitover --- CMakeLists.txt | 4 ++++ cmake/Set-Toolchain-vcpkg.cmake | 24 +++++++++++++++++++----- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7004d127..f8e29259 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -44,6 +44,10 @@ set(VCPKG_DEPS_OPTIONAL ffmpeg ENABLE_FFMPEG ) +set(VCPKG_DEPS_OPTIONAL_ARM64_BLACKLIST + ffmpeg +) + include(Set-Toolchain-vcpkg) set(VBAM_STATIC_DEFAULT OFF) diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index f2c03e1a..607ae8a8 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -265,6 +265,16 @@ function(vcpkg_set_toolchain) foreach(i RANGE 0 ${optionals_list_last} 2) list(GET VCPKG_DEPS_OPTIONAL ${i} dep) + set(skip FALSE) + + if(VCPKG_TARGET_TRIPLET MATCHES "^arm64-") + foreach(blacklisted_dep IN LISTS VCPKG_DEPS_OPTIONAL_ARM64_BLACKLIST) + if(dep STREQUAL blacklisted_dep) + set(skip TRUE) + endif() + endforeach() + endif() + math(EXPR var_idx "${i} + 1") list(GET VCPKG_DEPS_OPTIONAL ${var_idx} var) @@ -272,7 +282,7 @@ function(vcpkg_set_toolchain) vcpkg_seconds() - if("${val}" OR (seconds LESS time_limit AND ("${val}" OR "${val}" STREQUAL ""))) + if(NOT skip AND ("${val}" OR (seconds LESS time_limit AND ("${val}" OR "${val}" STREQUAL "")))) set(dep_qualified "${dep}:${VCPKG_TARGET_TRIPLET}") execute_process( @@ -286,16 +296,20 @@ function(vcpkg_set_toolchain) endif() endforeach() - if(WIN32 AND VCPKG_TARGET_TRIPLET MATCHES x64 AND CMAKE_GENERATOR MATCHES "Visual Studio") - set(CMAKE_GENERATOR_PLATFORM x64 CACHE STRING "visual studio build architecture" FORCE) + if(WIN32 AND CMAKE_GENERATOR MATCHES "Visual Studio") + if(VCPKG_TARGET_TRIPLET MATCHES "^x64-") + set(CMAKE_GENERATOR_PLATFORM x64 CACHE STRING "visual studio build architecture" FORCE) + elseif(VCPKG_TARGET_TRIPLET MATCHES "^arm64-") + set(CMAKE_GENERATOR_PLATFORM arm64 CACHE STRING "visual studio build architecture" FORCE) + endif() endif() if(WIN32 AND NOT CMAKE_GENERATOR MATCHES "Visual Studio") - if(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-windows-") + if(VCPKG_TARGET_TRIPLET MATCHES "^(x[68][46]|arm64)-windows-") # set toolchain to VS for e.g. Ninja or jom set(CMAKE_C_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) set(CMAKE_CXX_COMPILER cl CACHE STRING "Microsoft C/C++ Compiler" FORCE) - elseif(VCPKG_TARGET_TRIPLET MATCHES "^x[68][46]-mingw-") + elseif(VCPKG_TARGET_TRIPLET MATCHES "^(x[68][46]|arm64)-mingw-") # set toolchain to MinGW for e.g. Ninja or jom set(CMAKE_C_COMPILER gcc CACHE STRING "MinGW GCC C Compiler" FORCE) set(CMAKE_CXX_COMPILER g++ CACHE STRING "MinGW G++ C++ Compiler" FORCE)