vcpkg/scripts/cmake/vcpkg_find_acquire_program(PKGCONFIG).cmake
2024-04-01 13:37:39 -07:00

77 lines
3.7 KiB
CMake

macro(z_vcpkg_find_acquire_pkgconfig_msys_declare_packages)
z_vcpkg_acquire_msys_declare_package(
URL "https://mirror.msys2.org/mingw/clangarm64/mingw-w64-clang-aarch64-pkgconf-1~2.2.0-1-any.pkg.tar.zst"
SHA512 c19bd55e42def33107b52816f7c49827467681d05a173a36d73789a58194bc7e4af04807e4902b62184f32012a2d75f41d8fb3bfddf8b20e2a8f14955c05e99d
PROVIDES mingw-w64-clang-aarch64-pkg-config
)
z_vcpkg_acquire_msys_declare_package(
URL "https://mirror.msys2.org/mingw/mingw64/mingw-w64-x86_64-pkgconf-1~2.2.0-1-any.pkg.tar.zst"
SHA512 eb6ba49d56b0edc4f605ad896ac9deb2202c853c821f1c28a26e3c71a5083e893c8697d174b141da9dc6561620ea218166bd041664d54a0ab51b93bad246ed7a
PROVIDES mingw-w64-x86_64-pkg-config
)
z_vcpkg_acquire_msys_declare_package(
URL "https://mirror.msys2.org/mingw/mingw32/mingw-w64-i686-pkgconf-1~2.2.0-1-any.pkg.tar.zst"
SHA512 388788997a09bc394019aa4c2f0181a35a9aa8605b3bcf6b39f4bd0588f4e185573b6149ca54916677834059b0ccc75bf40db3fe6e7326ab268ea37f37346e22
PROVIDES mingw-w64-i686-pkg-config
)
endmacro()
set(program_name pkg-config)
if(DEFINED "ENV{PKG_CONFIG}")
debug_message(STATUS "PKG_CONFIG found in ENV! Using $ENV{PKG_CONFIG}")
set(PKGCONFIG "$ENV{PKG_CONFIG}" CACHE INTERNAL "")
set(PKGCONFIG "${PKGCONFIG}" PARENT_SCOPE)
return()
elseif(CMAKE_HOST_SYSTEM_NAME STREQUAL "OpenBSD")
# As of 6.8, the OpenBSD specific pkg-config doesn't support {pcfiledir}
set(rename_binary_to "pkg-config")
set(program_version 0.29.2.1)
set(raw_executable ON)
set(download_filename "pkg-config.openbsd")
set(tool_subdirectory "openbsd")
set(download_urls "https://raw.githubusercontent.com/jgilje/pkg-config-openbsd/master/pkg-config")
set(download_sha512 b7ec9017b445e00ae1377e36e774cf3f5194ab262595840b449832707d11e443a102675f66d8b7e8b2e2f28cebd6e256835507b1e0c69644cc9febab8285080b)
set(version_command --version)
elseif(CMAKE_HOST_WIN32)
if(NOT EXISTS "${PKGCONFIG}")
set(program_version 2.1.0)
if(DEFINED ENV{PROCESSOR_ARCHITEW6432})
set(host_arch "$ENV{PROCESSOR_ARCHITEW6432}")
else()
set(host_arch "$ENV{PROCESSOR_ARCHITECTURE}")
endif()
if("${host_arch}" STREQUAL "ARM64")
vcpkg_acquire_msys(PKGCONFIG_ROOT
NO_DEFAULT_PACKAGES
Z_DECLARE_EXTRA_PACKAGES_COMMAND "z_vcpkg_find_acquire_pkgconfig_msys_declare_packages"
PACKAGES mingw-w64-clang-aarch64-pkgconf
)
set("${program}" "${PKGCONFIG_ROOT}/clangarm64/bin/pkg-config.exe" CACHE INTERNAL "")
elseif("${host_arch}" MATCHES "64")
vcpkg_acquire_msys(PKGCONFIG_ROOT
NO_DEFAULT_PACKAGES
Z_DECLARE_EXTRA_PACKAGES_COMMAND "z_vcpkg_find_acquire_pkgconfig_msys_declare_packages"
PACKAGES mingw-w64-x86_64-pkgconf
)
set("${program}" "${PKGCONFIG_ROOT}/mingw64/bin/pkg-config.exe" CACHE INTERNAL "")
else()
vcpkg_acquire_msys(PKGCONFIG_ROOT
NO_DEFAULT_PACKAGES
Z_DECLARE_EXTRA_PACKAGES_COMMAND "z_vcpkg_find_acquire_pkgconfig_msys_declare_packages"
PACKAGES mingw-w64-i686-pkgconf
)
set("${program}" "${PKGCONFIG_ROOT}/mingw32/bin/pkg-config.exe" CACHE INTERNAL "")
endif()
endif()
set("${program}" "${${program}}" PARENT_SCOPE)
return()
else()
set(brew_package_name pkg-config)
set(apt_package_name pkg-config)
set(paths_to_search "/bin" "/usr/bin" "/usr/local/bin")
if(VCPKG_HOST_IS_OSX)
vcpkg_list(PREPEND paths_to_search "/opt/homebrew/bin")
endif()
endif()