diff options
| author | ruki <[email protected]> | 2018-08-21 22:54:22 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2018-08-21 11:26:12 +0800 |
| commit | 3519fbff209ebf0b99290a780c1cc425b5ab99d8 (patch) | |
| tree | 4ea89d0827f76af62465ac12384720fcb0c55654 /xmake/core | |
| parent | 0ba43c443b64019b87721f3af47675ab9d8226ec (diff) | |
support vcpkg for lib.detect.find_package
Diffstat (limited to 'xmake/core')
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_library.lua | 6 | ||||
| -rw-r--r-- | xmake/core/sandbox/modules/import/lib/detect/find_package.lua | 10 |
2 files changed, 12 insertions, 4 deletions
diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_library.lua b/xmake/core/sandbox/modules/import/lib/detect/find_library.lua index 9cd12556d..4e173fc54 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_library.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_library.lua @@ -38,10 +38,10 @@ local find_file = import("lib.detect.find_file") -- get link name from the file name function sandbox_lib_detect_find_library._link(filename) - -- get link - local link, count = filename:gsub(target.filename("([%w%-_]+)", "static"):gsub("%.", "%%.") .. "$", "%1") + -- get link, @note need %%w to escape to %w because gsub was called in target.filename + local link, count = filename:gsub(target.filename("([%%w%%-_]+)", "static"):gsub("%.", "%%.") .. "$", "%1") if count == 0 then - link, count = filename:gsub(target.filename("([%w%-_]+)", "shared"):gsub("%.", "%%.") .. "$", "%1") + link, count = filename:gsub(target.filename("([%%w%%-_]+)", "shared"):gsub("%.", "%%.") .. "$", "%1") end -- ok? diff --git a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua index 03976addb..cfd683217 100644 --- a/xmake/core/sandbox/modules/import/lib/detect/find_package.lua +++ b/xmake/core/sandbox/modules/import/lib/detect/find_package.lua @@ -141,11 +141,16 @@ function sandbox_lib_detect_find_package._find_from_modules(name, opt) end end --- find package from pkg-config +-- find package from pkg-config/brew function sandbox_lib_detect_find_package._find_from_pkg_config(name, opt) return import("lib.detect.pkg_config").find(name, opt) end +-- find package from vcpkg +function sandbox_lib_detect_find_package._find_from_vcpkg(name, opt) + return import("lib.detect.vcpkg").find(name, opt) +end + -- find package from system directories function sandbox_lib_detect_find_package._find_from_systemdirs(name, opt) @@ -251,6 +256,9 @@ function sandbox_lib_detect_find_package._find(name, opt) -- find package from modules table.insert(findscripts, sandbox_lib_detect_find_package._find_from_modules) + -- find package from vcpkg (support multi-platforms/architectures) + table.insert(findscripts, sandbox_lib_detect_find_package._find_from_vcpkg) + -- find package from the current host platform if opt.plat == os.host() and opt.arch == os.arch() then table.insert(findscripts, sandbox_lib_detect_find_package._find_from_pkg_config) |
