diff options
| author | ruki <[email protected]> | 2021-12-20 23:18:02 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-12-20 23:18:02 +0800 |
| commit | a1abfda3ca119979f541876355471b026abcc3f9 (patch) | |
| tree | 566aa88ca52154eebc00309ebc4170294c208cee | |
| parent | 39349f1a4fbf510d434c01952fe1f8f7e7505259 (diff) | |
find package stub for vcpkg manifest mode
| -rw-r--r-- | tests/projects/package/vcpkg_manifest/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/package/manager/vcpkg/find_package.lua | 40 |
2 files changed, 27 insertions, 16 deletions
diff --git a/tests/projects/package/vcpkg_manifest/xmake.lua b/tests/projects/package/vcpkg_manifest/xmake.lua index fd8a23e79..a6b24f1bc 100644 --- a/tests/projects/package/vcpkg_manifest/xmake.lua +++ b/tests/projects/package/vcpkg_manifest/xmake.lua @@ -1,4 +1,5 @@ -add_requires("vcpkg::zlib 1.2.11", "vcpkg::fmt >=8.0.1") +add_requires("vcpkg::zlib 1.2.11") +add_requires("vcpkg::fmt >=8.0.1", {configs = {baseline = "50fd3d9957195575849a49fa591e645f1d8e7156"}}) add_requires("vcpkg::arrow", {configs = {features = {"json"}}}) target("test") diff --git a/xmake/modules/package/manager/vcpkg/find_package.lua b/xmake/modules/package/manager/vcpkg/find_package.lua index e84833958..726eceea7 100644 --- a/xmake/modules/package/manager/vcpkg/find_package.lua +++ b/xmake/modules/package/manager/vcpkg/find_package.lua @@ -27,21 +27,8 @@ import("core.project.target") import("detect.sdks.find_vcpkgdir") import("package.manager.vcpkg.configurations") --- find package from the vcpkg package manager --- --- @param name the package name, e.g. zlib, pcre --- @param opt the options, e.g. {verbose = true) --- -function main(name, opt) - - -- attempt to find vcpkg directory - local vcpkgdir = find_vcpkgdir() - if not vcpkgdir then - if option.get("diagnosis") then - cprint("${color.warning}checkinfo: ${clear dim}vcpkg root directory not found, maybe you need set $VCPKG_ROOT!") - end - return - end +-- find it for classic mode +function _find_package_for_classic(vcpkgdir, name, opt) -- fix name, e.g. ffmpeg[x264] as ffmpeg -- @see https://github.com/xmake-io/xmake/issues/925 @@ -137,3 +124,26 @@ function main(name, opt) return result end +-- find it for manifest mode +function _find_package_for_manifest(vcpkgdir, name, opt) +end + +-- find package from the vcpkg package manager +-- +-- @param name the package name, e.g. zlib, pcre +-- @param opt the options, e.g. {verbose = true) +-- +function main(name, opt) + + -- attempt to find vcpkg directory + local vcpkgdir = find_vcpkgdir() + if not vcpkgdir then + if option.get("diagnosis") then + cprint("${color.warning}checkinfo: ${clear dim}vcpkg root directory not found, maybe you need set $VCPKG_ROOT!") + end + return + end + + -- do find + return _find_package_for_manifest(vcpkgdir, name, opt) or _find_package_for_classic(vcpkgdir, name, opt) +end |
