Jelajahi Sumber

remove find_packages docs

ruki 3 tahun lalu
induk
melakukan
a93d711cd5

+ 0 - 15
manual/builtin_modules.md

@@ -599,21 +599,6 @@ if (errors) raise(errors)
 
 If an exception is thrown in the try block, the error information is captured in catch and finally. See: [try-catch](#try-catch-finally)
 
-### find_packages
-
-#### Finding dependencies
-
-This interface is a wrapper around the [lib.detect.find_package](/manual/extension_modules?id=detectfind_package) interface and provides lookup support for multiple dependencies, for example:
-
-```lua
-target("test")
-    set_kind("binary")
-    add_files("src/*.c")
-    on_load(function (target)
-        target:add(find_packages("openssl", "zlib"))
-    end)
-```
-
 ### os
 
 The system operation module belongs to the built-in module. It can be called directly by the script scope without using [import](#import) import.

+ 0 - 5
manual/configuration_option.md

@@ -88,14 +88,9 @@ After the detection of the dependent small option is completed, the state of the
 
 Execute this script before option detection
 
-For example: before testing, find the package by [find_package](#detect-find_package), and add information such as `links`, `includedirs` and `linkdirs` to the option.
-Then start the option detection, and then automatically link to the target after passing.
-
 ```lua
 option("zlib")
     before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
     end)
 ```
 

+ 2 - 206
manual/extension_modules.md

@@ -867,7 +867,7 @@ The result is: `cxx`, which is the `c++` type. For the corresponding list, see:
 
 This module provides very powerful probing capabilities for probing programs, compilers, language features, dependencies, and more.
 
-!> The interface of this module is spread across multiple module directories, try to import it by importing a single interface, which is more efficient, for example: `import("lib.detect.find_package")` instead of `import("lib.detect ") `Import all to call.
+!> The interface of this module is spread across multiple module directories, try to import it by importing a single interface, which is more efficient.
 
 #### detect.find_file
 
@@ -1066,211 +1066,7 @@ We can also test quickly with `xmake lua lib.detect.find_programver ccache`.
 
 - Find package files
 
-This interface is also used to find library files, but it is higher than [lib.detect.find_library](#detectfind_library), and it is more powerful and easy to use, because it is based on the strength of the package.
-
-So what is a complete package, it contains:
-
-1. Multiple static libraries or dynamic library files
-2. Library search directory
-3. Search directory for header files
-4. Optional compile link options, such as `defines`
-5. Optional version number
-
-For example, we look for an openssl package:
-
-```lua
-import("lib.detect.find_package")
-
-local package = find_package("openssl")
-```
-
-The returned results are as follows:
-
-```lua
-{links = {"ssl", "crypto", "z"}, linkdirs = {"/usr/local/lib"}, includedirs = {"/usr/local/include"}}
-```
-
-If the search is successful, return a table containing all the package information, if it fails, return nil
-
-The return result here can be directly passed as the parameter of `target:add`, `option:add`, which is used to dynamically increase the configuration of `target/option`:
-
-```lua
-option("zlib")
-    set_showmenu(true)
-    before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
-    end)
-```
-
-```lua
-target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("zlib"))
-    end)
-```
-
-If third-party tools such as `homebrew`, `pkg-config` are installed on the system, then this interface will try to use them to improve the search results.
-
-We can also choose to find the package of the specified version by specifying the version number (if the package does not get the version information or there is no matching version of the package, then return nil):
-
-```lua
-local package = find_package("openssl", {version = "1.0.1"})
-```
-
-The packages that are looked up by default are matched to the platform, architecture, and mode according to the following rules:
-
-1. If the parameter passed in specifies `{plat = "iphoneos", arch = "arm64", mode = "release"}`, then match first, for example: `find_package("openssl", {plat = "iphoneos"} )`.
-2. If there is a configuration file in the current project environment, try to get it from `config.get("plat")`, `config.get("arch")` and `config.get("mode")` The platform architecture is matched.
-3. Finally, the matching is done from `os.host()` and `os.arch()`, which is the platform architecture environment of the current host.
-
-If the system's library directory and `pkg-config` are not enough to meet the requirements and the package cannot be found, you can manually set the search path yourself:
-
-```lua
-local package = find_package("openssl", {linkdirs = {"/usr/lib", "/usr/local/lib"}, includedirs = "/usr/local/include"})
-```
-
-You can also specify the link name you want to search at the same time, the header file name:
-
-```lua
-local package = find_package("openssl", {links = {"ssl", "crypto"}, includes = "ssl.h"}})
-```
-
-You can even specify xmake's `packagedir/*.pkg` package directory to find the corresponding `openssl.pkg` package, which is typically used to find local packages built into the project directory.
-
-For example, the tbox project has a built-in `pkg/openssl.pkg` local package project. We can use the following script to pass in the `{packagedirs = ""}` parameter to find the local package first. If it can't find it, go to the system. package.
-
-```lua
-target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("openssl", {packagedirs = path.join(os.projectdir(), "pkg")}))
-    end)
-```
-
-To summarize, the current search order:
-
-1. If you specify the `{packagedirs = ""}` parameter, look for the local package `*.pkg` from the path specified by this parameter.
-2. If there is a `detect.packages.find_xxx` script under `xmake/modules`, try calling this script to improve the lookup results.
-3. If vcpkg exists in the system, obtain the package from the vcpkg package management system.
-4. If the system has `pkg-config` and you are looking for a library for the system environment, try to find it using the path and link information provided by `pkg-config`
-5. If the system has `homebrew` and you are looking for a library for the system environment, try to find it using the information provided by `brew --prefix xxx`
-6. Find from the pathes path specified in the parameter and some known system paths `/usr/lib`, `/usr/include`
-
-Here we need to focus on the second point, through the `detect.packages.find_xxx` script to improve the search results, many times automatic packet detection is unable to fully detect the package path,
-Especially for the windows platform, there is no default library directory, and there is no package management app. When many libraries are installed, they are placed in the system directory, or add a registry key.
-
-Therefore, there is no uniform rule for finding it. At this time, you can customize a search script to improve the lookup mechanism of `find_package` and perform more accurate search for the specified package.
-
-In the xmake/modules/detect/packages` directory that comes with xmake, there are already many built-in package scripts for better lookup support for commonly used packages.
-Of course, this is not enough for all users. If the package that the user needs is still not found, then you can define a search script yourself, for example:
-
-To find a package named `openssl`, you can write a script for `find_openssl.lua` placed in the project directory:
-
-```
-Projectdir
- - xmake
-   - modules
-     - detect/package/find_openssl.lua
-```
-
-Then specify the directory for this module at the beginning of the project's `xmake.lua` file:
-
-```lua
-add_moduledirs("$(projectdir)/xmake/modules")
-```
-
-This way xmake will be able to find custom extensions.
-
-Next we look at the implementation of `find_openssl.lua`:
-
-```lua
--- imports
-import("lib.detect.find_path")
-import("lib.detect.find_library")
-
--- find openssl
---
--- @param opt the package options. e.g. see the options of find_package()
---
--- @return see the return value of find_package()
---
-function main(opt)
-
-    -- for windows platform
-    --
-    -- http://www.slproweb.com/products/Win32OpenSSL.html
-    --
-    if opt.plat == "windows" then
-
-        -- init bits
-        local bits = (opt.arch == "x64" and "64" or "32")
-
-        -- init search pathes
-        local pathes = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
-                        "$(env PROGRAMFILES)/OpenSSL",
-                        "$(env PROGRAMFILES)/OpenSSL-Win" .. bits,
-                        "C:/OpenSSL",
-                        "C:/OpenSSL-Win" .. bits}
-
-        -- find library
-        local result = {links = {}, linkdirs = {}, includedirs = {}}
-        for _, name in ipairs({"libssl", "libcrypto"}) do
-            local linkinfo = find_library(name, pathes, {suffixes = "lib"})
-            if linkinfo then
-                table.insert(result.links, linkinfo.link)
-                table.insert(result.linkdirs, linkinfo.linkdir)
-            end
-        end
-
-        -- not found?
-        if #result.links ~= 2 then
-            return
-        end
-
-        -- find include
-        table.insert(result.includedirs, find_path("openssl/ssl.h", pathes, {suffixes = "include"}))
-
-        -- ok
-        return result
-        end
-    end
-```
-
-Inside the windows platform to read the registry, to find the
-specified library file, the bottom layer is actually called
-[find_library](#detectfind_library) and other interfaces.
-
-!> In order to speed up the efficiency of frequent
-lookups, this interface is self-contained by default. If you want to
-disable the cache, you can execute `xmake f -c` in the project
-directory to clear the local cache.  You can also disable the cache by
-specifying the force parameter, forcing a re-find:
-
-`find_package("openssl", {force = true})`
-
-We can also test quickly with `xmake lua lib.detect.find_package openssl`.
-
-After the 2.2.5 version, the built-in interface [find_packages](#find_packages) has been added, which can find multiple packages at
-the same time, and can be used directly without importing by import.
-
-And after this release, support for explicitly looking for packages
-from a specified third-party package manager, for example:
-
-```lua
-find_package("brew::pcre2/libpcre2-8")
-```
-
-Since the package name of each third-party package manager is not
-completely consistent, for example, pcre2 has three library versions
-in homebrew, we can specify the library corresponding to libpcre2-8
-version by the above method.
-
-In addition, for vcpkg, conan can also specify the library inside by
-adding the `vcpkg::`, `conan::` package namespace.
-
-v2.5.9 We can also use cmake to find some packages through `find_package("cmake::xxx")`.
+After 2.6.x this interface is not recommended for direct use (internal use only), for library integration, please use `add_requires()` and `add_packages()` as much as possible.
 
 #### detect.find_tool
 

+ 0 - 10
mirror/manual/builtin_modules.html

@@ -497,16 +497,6 @@ $ xmake --version
 <pre><code class="lang-lua">if (errors) raise(errors)
 </code></pre>
 <p>If an exception is thrown in the try block, the error information is captured in catch and finally. See: <a href="#try-catch-finally">try-catch</a></p>
-<h3 id="find_packages">find_packages</h3>
-<h4 id="findingdependencies">Finding dependencies</h4>
-<p>This interface is a wrapper around the <a href="/mirror/manual/extension_modules.html#detectfind_package">lib.detect.find_package</a> interface and provides lookup support for multiple dependencies, for example:</p>
-<pre><code class="lang-lua">target("test")
-    set_kind("binary")
-    add_files("src/*.c")
-    on_load(function (target)
-        target:add(find_packages("openssl", "zlib"))
-    end)
-</code></pre>
 <h3 id="os">os</h3>
 <p>The system operation module belongs to the built-in module. It can be called directly by the script scope without using <a href="#import">import</a> import.</p>
 <p>This module is also a native module of lua, and xmake has been extended to provide more practical interfaces.</p>

+ 0 - 3
mirror/manual/configuration_option.html

@@ -148,11 +148,8 @@ option("test")
 <p>!> Since on_check will only be executed when the default value is not set, if the default value is set, the custom logic can be processed in the after_check phase.</p>
 <h3 id="optionbefore_check">option:before_check</h3>
 <p>Execute this script before option detection</p>
-<p>For example: before testing, find the package by <a href="#detect-find_package">find_package</a>, and add information such as <code>links</code>, <code>includedirs</code> and <code>linkdirs</code> to the option.<br>Then start the option detection, and then automatically link to the target after passing.</p>
 <pre><code class="lang-lua">option("zlib")
     before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
     end)
 </code></pre>
 <h3 id="optionon_check">option:on_check</h3>

+ 2 - 141
mirror/manual/extension_modules.html

@@ -918,7 +918,7 @@ end
 <p>The result is: <code>cxx</code>, which is the <code>c++</code> type. For the corresponding list, see: <a href="#languagesourcekinds">language.sourcekinds</a></p>
 <h3 id="libdetect">lib.detect</h3>
 <p>This module provides very powerful probing capabilities for probing programs, compilers, language features, dependencies, and more.</p>
-<p>!> The interface of this module is spread across multiple module directories, try to import it by importing a single interface, which is more efficient, for example: <code>import("lib.detect.find_package")</code> instead of <code>import("lib.detect ")</code>Import all to call.</p>
+<p>!> The interface of this module is spread across multiple module directories, try to import it by importing a single interface, which is more efficient.</p>
 <h4 id="detectfind_file">detect.find_file</h4>
 <ul>
 <li>Find files</li>
@@ -1037,146 +1037,7 @@ local version = find_programver("ccache", {command = "--version", parse = functi
 <ul>
 <li>Find package files</li>
 </ul>
-<p>This interface is also used to find library files, but it is higher than <a href="#detectfind_library">lib.detect.find_library</a>, and it is more powerful and easy to use, because it is based on the strength of the package.</p>
-<p>So what is a complete package, it contains:</p>
-<ol>
-<li>Multiple static libraries or dynamic library files</li>
-<li>Library search directory</li>
-<li>Search directory for header files</li>
-<li>Optional compile link options, such as <code>defines</code></li>
-<li>Optional version number</li>
-</ol>
-<p>For example, we look for an openssl package:</p>
-<pre><code class="lang-lua">import("lib.detect.find_package")
-
-local package = find_package("openssl")
-</code></pre>
-<p>The returned results are as follows:</p>
-<pre><code class="lang-lua">{links = {"ssl", "crypto", "z"}, linkdirs = {"/usr/local/lib"}, includedirs = {"/usr/local/include"}}
-</code></pre>
-<p>If the search is successful, return a table containing all the package information, if it fails, return nil</p>
-<p>The return result here can be directly passed as the parameter of <code>target:add</code>, <code>option:add</code>, which is used to dynamically increase the configuration of <code>target/option</code>:</p>
-<pre><code class="lang-lua">option("zlib")
-    set_showmenu(true)
-    before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
-    end)
-</code></pre>
-<pre><code class="lang-lua">target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("zlib"))
-    end)
-</code></pre>
-<p>If third-party tools such as <code>homebrew</code>, <code>pkg-config</code> are installed on the system, then this interface will try to use them to improve the search results.</p>
-<p>We can also choose to find the package of the specified version by specifying the version number (if the package does not get the version information or there is no matching version of the package, then return nil):</p>
-<pre><code class="lang-lua">local package = find_package("openssl", {version = "1.0.1"})
-</code></pre>
-<p>The packages that are looked up by default are matched to the platform, architecture, and mode according to the following rules:</p>
-<ol>
-<li>If the parameter passed in specifies <code>{plat = "iphoneos", arch = "arm64", mode = "release"}</code>, then match first, for example: <code>find_package("openssl", {plat = "iphoneos"} )</code>.</li>
-<li>If there is a configuration file in the current project environment, try to get it from <code>config.get("plat")</code>, <code>config.get("arch")</code> and <code>config.get("mode")</code> The platform architecture is matched.</li>
-<li>Finally, the matching is done from <code>os.host()</code> and <code>os.arch()</code>, which is the platform architecture environment of the current host.</li>
-</ol>
-<p>If the system&#39;s library directory and <code>pkg-config</code> are not enough to meet the requirements and the package cannot be found, you can manually set the search path yourself:</p>
-<pre><code class="lang-lua">local package = find_package("openssl", {linkdirs = {"/usr/lib", "/usr/local/lib"}, includedirs = "/usr/local/include"})
-</code></pre>
-<p>You can also specify the link name you want to search at the same time, the header file name:</p>
-<pre><code class="lang-lua">local package = find_package("openssl", {links = {"ssl", "crypto"}, includes = "ssl.h"}})
-</code></pre>
-<p>You can even specify xmake&#39;s <code>packagedir/*.pkg</code> package directory to find the corresponding <code>openssl.pkg</code> package, which is typically used to find local packages built into the project directory.</p>
-<p>For example, the tbox project has a built-in <code>pkg/openssl.pkg</code> local package project. We can use the following script to pass in the <code>{packagedirs = ""}</code> parameter to find the local package first. If it can&#39;t find it, go to the system. package.</p>
-<pre><code class="lang-lua">target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("openssl", {packagedirs = path.join(os.projectdir(), "pkg")}))
-    end)
-</code></pre>
-<p>To summarize, the current search order:</p>
-<ol>
-<li>If you specify the <code>{packagedirs = ""}</code> parameter, look for the local package <code>*.pkg</code> from the path specified by this parameter.</li>
-<li>If there is a <code>detect.packages.find_xxx</code> script under <code>xmake/modules</code>, try calling this script to improve the lookup results.</li>
-<li>If vcpkg exists in the system, obtain the package from the vcpkg package management system.</li>
-<li>If the system has <code>pkg-config</code> and you are looking for a library for the system environment, try to find it using the path and link information provided by <code>pkg-config</code></li>
-<li>If the system has <code>homebrew</code> and you are looking for a library for the system environment, try to find it using the information provided by <code>brew --prefix xxx</code></li>
-<li>Find from the pathes path specified in the parameter and some known system paths <code>/usr/lib</code>, <code>/usr/include</code></li>
-</ol>
-<p>Here we need to focus on the second point, through the <code>detect.packages.find_xxx</code> script to improve the search results, many times automatic packet detection is unable to fully detect the package path,<br>Especially for the windows platform, there is no default library directory, and there is no package management app. When many libraries are installed, they are placed in the system directory, or add a registry key.</p>
-<p>Therefore, there is no uniform rule for finding it. At this time, you can customize a search script to improve the lookup mechanism of <code>find_package</code> and perform more accurate search for the specified package.</p>
-<p>In the xmake/modules/detect/packages` directory that comes with xmake, there are already many built-in package scripts for better lookup support for commonly used packages.<br>Of course, this is not enough for all users. If the package that the user needs is still not found, then you can define a search script yourself, for example:</p>
-<p>To find a package named <code>openssl</code>, you can write a script for <code>find_openssl.lua</code> placed in the project directory:</p>
-<pre><code>Projectdir
- - xmake
-   - modules
-     - detect/package/find_openssl.lua
-</code></pre><p>Then specify the directory for this module at the beginning of the project&#39;s <code>xmake.lua</code> file:</p>
-<pre><code class="lang-lua">add_moduledirs("$(projectdir)/xmake/modules")
-</code></pre>
-<p>This way xmake will be able to find custom extensions.</p>
-<p>Next we look at the implementation of <code>find_openssl.lua</code>:</p>
-<pre><code class="lang-lua">-- imports
-import("lib.detect.find_path")
-import("lib.detect.find_library")
-
--- find openssl
---
--- @param opt the package options. e.g. see the options of find_package()
---
--- @return see the return value of find_package()
---
-function main(opt)
-
-    -- for windows platform
-    --
-    -- http://www.slproweb.com/products/Win32OpenSSL.html
-    --
-    if opt.plat == "windows" then
-
-        -- init bits
-        local bits = (opt.arch == "x64" and "64" or "32")
-
-        -- init search pathes
-        local pathes = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
-                        "$(env PROGRAMFILES)/OpenSSL",
-                        "$(env PROGRAMFILES)/OpenSSL-Win" .. bits,
-                        "C:/OpenSSL",
-                        "C:/OpenSSL-Win" .. bits}
-
-        -- find library
-        local result = {links = {}, linkdirs = {}, includedirs = {}}
-        for _, name in ipairs({"libssl", "libcrypto"}) do
-            local linkinfo = find_library(name, pathes, {suffixes = "lib"})
-            if linkinfo then
-                table.insert(result.links, linkinfo.link)
-                table.insert(result.linkdirs, linkinfo.linkdir)
-            end
-        end
-
-        -- not found?
-        if #result.links ~= 2 then
-            return
-        end
-
-        -- find include
-        table.insert(result.includedirs, find_path("openssl/ssl.h", pathes, {suffixes = "include"}))
-
-        -- ok
-        return result
-        end
-    end
-</code></pre>
-<p>Inside the windows platform to read the registry, to find the<br>specified library file, the bottom layer is actually called<br><a href="#detectfind_library">find_library</a> and other interfaces.</p>
-<p>!> In order to speed up the efficiency of frequent<br>lookups, this interface is self-contained by default. If you want to<br>disable the cache, you can execute <code>xmake f -c</code> in the project<br>directory to clear the local cache.  You can also disable the cache by<br>specifying the force parameter, forcing a re-find:</p>
-<p><code>find_package("openssl", {force = true})</code></p>
-<p>We can also test quickly with <code>xmake lua lib.detect.find_package openssl</code>.</p>
-<p>After the 2.2.5 version, the built-in interface <a href="#find_packages">find_packages</a> has been added, which can find multiple packages at<br>the same time, and can be used directly without importing by import.</p>
-<p>And after this release, support for explicitly looking for packages<br>from a specified third-party package manager, for example:</p>
-<pre><code class="lang-lua">find_package("brew::pcre2/libpcre2-8")
-</code></pre>
-<p>Since the package name of each third-party package manager is not<br>completely consistent, for example, pcre2 has three library versions<br>in homebrew, we can specify the library corresponding to libpcre2-8<br>version by the above method.</p>
-<p>In addition, for vcpkg, conan can also specify the library inside by<br>adding the <code>vcpkg::</code>, <code>conan::</code> package namespace.</p>
-<p>v2.5.9 We can also use cmake to find some packages through <code>find_package("cmake::xxx")</code>.</p>
+<p>After 2.6.x this interface is not recommended for direct use (internal use only), for library integration, please use <code>add_requires()</code> and <code>add_packages()</code> as much as possible.</p>
 <h4 id="detectfind_tool">detect.find_tool</h4>
 <ul>
 <li>Find tool</li>

+ 0 - 10
mirror/zh-cn/manual/builtin_modules.html

@@ -496,16 +496,6 @@ $ xmake --version
 <pre><code class="lang-lua">if (errors) raise(errors)
 </code></pre>
 <p>如果在try块中抛出异常,就会在catch和finally中进行errors信息捕获,具体见:<a href="#try-catch-finally">try-catch</a></p>
-<h3 id="find_packages">find_packages</h3>
-<h4 id="">查找依赖包</h4>
-<p>此接口是对<a href="/mirror/zh-cn/manual/extension_modules.html#detectfind_package">lib.detect.find_package</a>接口的封装,提供多个依赖包的查找支持,例如:</p>
-<pre><code class="lang-lua">target("test")
-    set_kind("binary")
-    add_files("src/*.c")
-    on_load(function (target)
-        target:add(find_packages("openssl", "zlib"))
-    end)
-</code></pre>
 <h3 id="os">os</h3>
 <p>系统操作模块,属于内置模块,无需使用<a href="#import">import</a>导入,可直接脚本域调用其接口。</p>
 <p>此模块也是lua的原生模块,xmake在其基础上进行了扩展,提供更多实用的接口。</p>

+ 0 - 3
mirror/zh-cn/manual/configuration_option.html

@@ -150,11 +150,8 @@ option("test")
 <p>!> 由于 on_check 只有在没有设置 default 值的情况下才会被执行,因此如果设置了 default 值,那么可以在 after_check 阶段处理自定义逻辑。</p>
 <h3 id="optionbefore_check">option:before_check</h3>
 <h4 id="">选项检测之前执行此脚本</h4>
-<p>例如:在检测之前,通过<a href="#detect-find_package">find_package</a>来查找包,将<code>links</code>, <code>includedirs</code>和<code>linkdirs</code>等信息添加到option中去,<br>然后开始选项检测,通过后就会自动链接到target上。</p>
 <pre><code class="lang-lua">option("zlib")
     before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
     end)
 </code></pre>
 <h3 id="optionon_check">option:on_check</h3>

+ 2 - 140
mirror/zh-cn/manual/extension_modules.html

@@ -924,7 +924,7 @@ end
 <p>显示结果为:<code>cxx</code>,也就是<code>c++</code>类型,具体对应列表见:<a href="#languagesourcekinds">language.sourcekinds</a></p>
 <h3 id="libdetect">lib.detect</h3>
 <p>此模块提供了非常强大的探测功能,用于探测程序、编译器、语言特性、依赖包等。</p>
-<p>!> 此模块的接口分散在多个模块目录中,尽量通过导入单个接口来使用,这样效率更高,例如:<code>import("lib.detect.find_package")</code>,而不是通过<code>import("lib.detect")</code>导入所有来调用。</p>
+<p>!> 此模块的接口分散在多个模块目录中,尽量通过导入单个接口来使用,这样效率更高。</p>
 <h4 id="detectfind_file">detect.find_file</h4>
 <ul>
 <li>查找文件</li>
@@ -1045,145 +1045,7 @@ local version = find_programver("ccache", {command = "--version", parse = functi
 <ul>
 <li>查找包文件</li>
 </ul>
-<p>此接口也是用于查找库文件,但是比<a href="#detectfind_library">lib.detect.find_library</a>更加上层,也更为强大和简单易用,因为它是以包为力度进行查找。</p>
-<p>那怎样算是一个完整的包,它包含:</p>
-<ol>
-<li>多个静态库或者动态库文件</li>
-<li>库的搜索目录</li>
-<li>头文件的搜索目录</li>
-<li>可选的编译链接选项,例如:<code>defines</code>等</li>
-<li>可选的版本号</li>
-</ol>
-<p>例如我们查找一个openssl包:</p>
-<pre><code class="lang-lua">import("lib.detect.find_package")
-
-local package = find_package("openssl")
-</code></pre>
-<p>返回的结果如下:</p>
-<pre><code class="lang-lua">{links = {"ssl", "crypto", "z"}, linkdirs = {"/usr/local/lib"}, includedirs = {"/usr/local/include"}}
-</code></pre>
-<p>如果查找成功,则返回一个包含所有包信息的table,如果失败返回nil</p>
-<p>这里的返回结果可以直接作为<code>target:add</code>, <code>option:add</code>的参数传入,用于动态增加<code>target/option</code>的配置:</p>
-<pre><code class="lang-lua">option("zlib")
-    set_showmenu(true)
-    before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
-    end)
-</code></pre>
-<pre><code class="lang-lua">target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("zlib"))
-    end)
-</code></pre>
-<p>如果系统上装有<code>homebrew</code>, <code>pkg-config</code>等第三方工具,那么此接口会尝试使用它们去改进查找结果。</p>
-<p>我们也可以通过指定版本号,来选择查找指定版本的包(如果这个包获取不到版本信息或者没有匹配版本的包,则返回nil):</p>
-<pre><code class="lang-lua">local package = find_package("openssl", {version = "1.0.1"})
-</code></pre>
-<p>默认情况下查找的包是根据如下规则匹配平台,架构和模式的:</p>
-<ol>
-<li>如果参数传入指定了<code>{plat = "iphoneos", arch = "arm64", mode = "release"}</code>,则优先匹配,例如:<code>find_package("openssl", {plat = "iphoneos"})</code>。</li>
-<li>如果是在当前工程环境,存在配置文件,则优先尝试从<code>config.get("plat")</code>, <code>config.get("arch")</code>和<code>config.get("mode")</code>获取平台架构进行匹配。</li>
-<li>最后从<code>os.host()</code>和<code>os.arch()</code>中进行匹配,也就是当前主机的平台架构环境。</li>
-</ol>
-<p>如果系统的库目录以及<code>pkg-config</code>都不能满足需求,找不到包,那么可以自己手动设置搜索路径:</p>
-<pre><code class="lang-lua">local package = find_package("openssl", {linkdirs = {"/usr/lib", "/usr/local/lib"}, includedirs = "/usr/local/include"})
-</code></pre>
-<p>也可以同时指定需要搜索的链接名,头文件名:</p>
-<pre><code class="lang-lua">local package = find_package("openssl", {links = {"ssl", "crypto"}, includes = "ssl.h"}})
-</code></pre>
-<p>甚至可以指定xmake的<code>packagedir/*.pkg</code>包目录,用于查找对应的<code>openssl.pkg</code>包,一般用于查找内置在工程目录中的本地包。</p>
-<p>例如,tbox工程内置了<code>pkg/openssl.pkg</code>本地包载项目中,我们可以通过下面的脚本,传入<code>{packagedirs = ""}</code>参数优先查找本地包,如果找不到再去找系统包。</p>
-<pre><code class="lang-lua">target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("openssl", {packagedirs = path.join(os.projectdir(), "pkg")}))
-    end)
-</code></pre>
-<p>总结下,现在的查找顺序:</p>
-<ol>
-<li>如果指定<code>{packagedirs = ""}</code>参数,优先从这个参数指定的路径中查找本地包<code>*.pkg</code></li>
-<li>如果在<code>xmake/modules</code>下面存在<code>detect.packages.find_xxx</code>脚本,那么尝试调用此脚本来改进查找结果</li>
-<li>如果系统存在vcpkg,优先从vcpkg的包管理系统中去获取包</li>
-<li>如果系统存在<code>pkg-config</code>,并且查找的是系统环境的库,则尝试使用<code>pkg-config</code>提供的路径和链接信息进行查找</li>
-<li>如果系统存在<code>homebrew</code>,并且查找的是系统环境的库,则尝试使用<code>brew --prefix xxx</code>提供的信息进行查找</li>
-<li>从参数中指定的pathes路径和一些已知的系统路径<code>/usr/lib</code>, <code>/usr/include</code>中进行查找</li>
-</ol>
-<p>这里需要着重说下第二点,通过在<code>detect.packages.find_xxx</code>脚本来改进查找结果,很多时候自动的包探测是没法完全探测到包路径的,<br>尤其是针对windows平台,没有默认的库目录,也没有包管理app,很多库装的时候,都是自己所处放置在系统目录,或者添加注册表项。</p>
-<p>因此查找起来没有统一的规则,这个时候,就可以自定义一个查找脚本,去改进<code>find_package</code>的查找机制,对指定包进行更精准的查找。</p>
-<p>在xmake自带的<code>xmake/modules/detect/packages</code>目录下,已经有许多的内置包脚本,来对常用的包进行更好的查找支持。<br>当然这不可能满足所有用户的需求,如果用户需要的包还是找不到,那么可以自己定义一个查找脚本,例如:</p>
-<p>查找一个名为<code>openssl</code>的包,可以编写一个<code>find_openssl.lua</code>的脚本放置在工程目录:</p>
-<pre><code>projectdir
- - xmake
-   - modules
-     - detect/package/find_openssl.lua
-</code></pre><p>然后在工程的<code>xmake.lua</code>文件的开头指定下这个modules的目录:</p>
-<pre><code class="lang-lua">add_moduledirs("$(projectdir)/xmake/modules")
-</code></pre>
-<p>这样xmake就能找到自定义的扩展模块了。</p>
-<p>接下来我们看下<code>find_openssl.lua</code>的实现:</p>
-<pre><code class="lang-lua">-- imports
-import("lib.detect.find_path")
-import("lib.detect.find_library")
-
--- find openssl
---
--- @param opt   the package options. e.g. see the options of find_package()
---
--- @return      see the return value of find_package()
---
-function main(opt)
-
-    -- for windows platform
-    --
-    -- http://www.slproweb.com/products/Win32OpenSSL.html
-    --
-    if opt.plat == "windows" then
-
-        -- init bits
-        local bits = (opt.arch == "x64" and "64" or "32")
-
-        -- init search pathes
-        local pathes = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
-                        "$(env PROGRAMFILES)/OpenSSL",
-                        "$(env PROGRAMFILES)/OpenSSL-Win" .. bits,
-                        "C:/OpenSSL",
-                        "C:/OpenSSL-Win" .. bits}
-
-        -- find library
-        local result = {links = {}, linkdirs = {}, includedirs = {}}
-        for _, name in ipairs({"libssl", "libcrypto"}) do
-            local linkinfo = find_library(name, pathes, {suffixes = "lib"})
-            if linkinfo then
-                table.insert(result.links, linkinfo.link)
-                table.insert(result.linkdirs, linkinfo.linkdir)
-            end
-        end
-
-        -- not found?
-        if #result.links ~= 2 then
-            return
-        end
-
-        -- find include
-        table.insert(result.includedirs, find_path("openssl/ssl.h", pathes, {suffixes = "include"}))
-
-        -- ok
-        return result
-    end
-end
-</code></pre>
-<p>里面对windows平台进行注册表读取,去查找指定的库文件,其底层其实也是调用的<a href="#detectfind_library">find_library</a>等接口。</p>
-<p>!> 为了加速频发查找的效率,此接口是默认自带cache的,如果要禁用cache,可以在工程目录执行<code>xmake f -c</code>清除本地cache。<br>也可以通过指定force参数,来禁用cache,强制重新查找:<code>find_package("openssl", {force = true})</code></p>
-<p>我们也可以通过<code>xmake lua lib.detect.find_package openssl</code> 来快速测试。</p>
-<p>2.2.5版本之后,新增了内置接口<a href="#find_packages">find_packages</a>,可以同时查找多个包,并且不需要通过import导入即可直接使用。</p>
-<p>并且此版本之后,支持显式的从指定第三方包管理器中查找包,例如:</p>
-<pre><code class="lang-lua">find_package("brew::pcre2/libpcre2-8")
-</code></pre>
-<p>由于每个第三方包管理器的包名不完全一致,比如pcre2在homebrew中有三个库版本,我们可以通过上面的方式,指定查找对应libpcre2-8版本的库。</p>
-<p>另外,对于vcpkg, conan也可以通过加上<code>vcpkg::</code>, <code>conan::</code>包命名空间来指定查找里面的库。</p>
-<p>v2.5.9 我们也可以通过 <code>find_package("cmake::xxx")</code> 去借助 cmake 来找一些包。</p>
+<p>2.6.x 之后,这个接口不推荐直接使用(仅供内部使用),库集成,请尽量使用 <code>add_requires()</code> 和 <code>add_packages()</code>。</p>
 <h4 id="detectfind_tool">detect.find_tool</h4>
 <ul>
 <li>查找工具</li>

+ 0 - 5
mirror/zh-cn/manual/global_interfaces.html

@@ -148,11 +148,6 @@ set_xmakever("2.1.0")
 <h3 id="add_moduledirs">add_moduledirs</h3>
 <h4 id="">添加模块目录</h4>
 <p>xmake内置的扩展模块都在<code>xmake/modules</code>目录下,可通过<a href="#import">import</a>来导入他们,如果自己在工程里面实现了一些扩展模块,<br>可以放置在这个接口指定的目录下,import也就会能找到,并且优先进行导入。</p>
-<p>例如定义一个<code>find_openssl.lua</code>的扩展模块,用于扩展内置的<a href="#detect-find_package">lib.detect.find_package</a>接口,则只需要将它放置在:</p>
-<pre><code>projectdir/xmake/modules/detect/packages/find_openssl.lua
-</code></pre><p>然后在工程<code>xmake.lua</code>下指定这个模块目录,<code>find_package</code>就可以自动找到了:</p>
-<pre><code class="lang-lua">add_moduledirs("projectdir/xmake/modules")
-</code></pre>
 <h3 id="add_plugindirs">add_plugindirs</h3>
 <h4 id="">添加插件目录</h4>
 <p>xmake内置的插件都是放在<code>xmake/plugins</code>目录下,但是对于用户自定义的一些特定工程的插件,如果不想放置在xmake安装目录下,那么可以在<code>xmake.lua</code>中进行配置指定的其他插件路径。</p>

+ 100 - 100
sitemap.xml

@@ -12,502 +12,502 @@
 
 <url>
   <loc>https://xmake.io/mirror/guide/project_examples.html</loc>
-  <lastmod>2022-09-17T20:57:33+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/quickstart.html</loc>
-  <lastmod>2022-09-17T20:57:33+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:16+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/faq.html</loc>
-  <lastmod>2022-09-17T20:57:33+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/configuration.html</loc>
-  <lastmod>2022-09-17T20:57:33+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/syntax_description.html</loc>
-  <lastmod>2022-09-17T20:57:34+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/guide/installation.html</loc>
-  <lastmod>2022-09-17T20:57:34+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/remote_build.html</loc>
-  <lastmod>2022-09-17T20:57:34+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/unity_build.html</loc>
-  <lastmod>2022-09-17T20:57:34+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:17+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/distcc_build.html</loc>
-  <lastmod>2022-09-17T20:57:34+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/trybuild.html</loc>
-  <lastmod>2022-09-17T20:57:34+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/autogen.html</loc>
-  <lastmod>2022-09-17T20:57:35+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/features/build_cache.html</loc>
-  <lastmod>2022-09-17T20:57:35+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/plugin_development.html</loc>
-  <lastmod>2022-09-17T20:57:35+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:18+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/more_plugins.html</loc>
-  <lastmod>2022-09-17T20:57:35+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/plugin/builtin_plugins.html</loc>
-  <lastmod>2022-09-17T20:57:35+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/awesome.html</loc>
-  <lastmod>2022-09-17T20:57:35+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/technical_support.html</loc>
-  <lastmod>2022-09-17T20:57:36+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/changelog.html</loc>
-  <lastmod>2022-09-17T20:57:36+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:19+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/contact.html</loc>
-  <lastmod>2022-09-17T20:57:36+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/introduction.html</loc>
-  <lastmod>2022-09-17T20:57:36+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/who_is_using_xmake.html</loc>
-  <lastmod>2022-09-17T20:57:36+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/about/sponsor.html</loc>
-  <lastmod>2022-09-17T20:57:36+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/index.html</loc>
-  <lastmod>2022-09-17T20:57:37+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/project_examples.html</loc>
-  <lastmod>2022-09-17T20:57:37+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:20+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/quickstart.html</loc>
-  <lastmod>2022-09-17T20:57:37+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/faq.html</loc>
-  <lastmod>2022-09-17T20:57:37+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/configuration.html</loc>
-  <lastmod>2022-09-17T20:57:37+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/syntax_description.html</loc>
-  <lastmod>2022-09-17T20:57:38+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/guide/installation.html</loc>
-  <lastmod>2022-09-17T20:57:38+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:21+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/remote_build.html</loc>
-  <lastmod>2022-09-17T20:57:38+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/unity_build.html</loc>
-  <lastmod>2022-09-17T20:57:38+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/distcc_build.html</loc>
-  <lastmod>2022-09-17T20:57:38+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/trybuild.html</loc>
-  <lastmod>2022-09-17T20:57:38+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/autogen.html</loc>
-  <lastmod>2022-09-17T20:57:39+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/features/build_cache.html</loc>
-  <lastmod>2022-09-17T20:57:39+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:22+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/plugin_development.html</loc>
-  <lastmod>2022-09-17T20:57:39+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/more_plugins.html</loc>
-  <lastmod>2022-09-17T20:57:39+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/plugin/builtin_plugins.html</loc>
-  <lastmod>2022-09-17T20:57:39+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/awesome.html</loc>
-  <lastmod>2022-09-17T20:57:39+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/technical_support.html</loc>
-  <lastmod>2022-09-17T20:57:40+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:23+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/changelog.html</loc>
-  <lastmod>2022-09-17T20:57:40+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/contact.html</loc>
-  <lastmod>2022-09-17T20:57:40+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/peripheral_items.html</loc>
-  <lastmod>2022-09-17T20:57:40+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/introduction.html</loc>
-  <lastmod>2022-09-17T20:57:40+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/who_is_using_xmake.html</loc>
-  <lastmod>2022-09-17T20:57:40+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/sponsor.html</loc>
-  <lastmod>2022-09-17T20:57:41+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:24+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/about/course.html</loc>
-  <lastmod>2022-09-17T20:57:41+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/index.html</loc>
-  <lastmod>2022-09-17T20:57:41+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/getting_started.html</loc>
-  <lastmod>2022-09-17T20:57:41+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/specification.html</loc>
-  <lastmod>2022-09-17T20:57:41+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_variables.html</loc>
-  <lastmod>2022-09-17T20:57:42+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:25+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/conditions.html</loc>
-  <lastmod>2022-09-17T20:57:42+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_rule.html</loc>
-  <lastmod>2022-09-17T20:57:42+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/target_instance.html</loc>
-  <lastmod>2022-09-17T20:57:42+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/project_target.html</loc>
-  <lastmod>2022-09-17T20:57:42+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/builtin_modules.html</loc>
-  <lastmod>2022-09-17T20:57:42+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:26+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/custom_toolchain.html</loc>
-  <lastmod>2022-09-17T20:57:43+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/plugin_task.html</loc>
-  <lastmod>2022-09-17T20:57:43+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_dependencies.html</loc>
-  <lastmod>2022-09-17T20:57:43+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/configuration_option.html</loc>
-  <lastmod>2022-09-17T20:57:43+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/extension_modules.html</loc>
-  <lastmod>2022-09-17T20:57:43+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:27+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/helper_interfaces.html</loc>
-  <lastmod>2022-09-17T20:57:44+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/global_interfaces.html</loc>
-  <lastmod>2022-09-17T20:57:44+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/package_instance.html</loc>
-  <lastmod>2022-09-17T20:57:44+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/manual/option_instance.html</loc>
-  <lastmod>2022-09-17T20:57:44+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/builtin_themes.html</loc>
-  <lastmod>2022-09-17T20:57:44+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:28+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/theme/switch_theme.html</loc>
-  <lastmod>2022-09-17T20:57:44+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_3rd_source_library.html</loc>
-  <lastmod>2022-09-17T20:57:45+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package_old.html</loc>
-  <lastmod>2022-09-17T20:57:45+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/local_package.html</loc>
-  <lastmod>2022-09-17T20:57:45+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/system_package.html</loc>
-  <lastmod>2022-09-17T20:57:45+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:29+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/package/remote_package.html</loc>
-  <lastmod>2022-09-17T20:57:45+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/remote_toolchain.html</loc>
-  <lastmod>2022-09-17T20:57:45+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/zh-cn/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2022-09-17T20:57:46+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/getting_started.html</loc>
-  <lastmod>2022-09-17T20:57:46+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/specification.html</loc>
-  <lastmod>2022-09-17T20:57:46+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:30+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_variables.html</loc>
-  <lastmod>2022-09-17T20:57:46+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/conditions.html</loc>
-  <lastmod>2022-09-17T20:57:46+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_rule.html</loc>
-  <lastmod>2022-09-17T20:57:47+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/target_instance.html</loc>
-  <lastmod>2022-09-17T20:57:47+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/project_target.html</loc>
-  <lastmod>2022-09-17T20:57:47+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:31+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/builtin_modules.html</loc>
-  <lastmod>2022-09-17T20:57:47+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/custom_toolchain.html</loc>
-  <lastmod>2022-09-17T20:57:47+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/plugin_task.html</loc>
-  <lastmod>2022-09-17T20:57:47+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_dependencies.html</loc>
-  <lastmod>2022-09-17T20:57:48+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/configuration_option.html</loc>
-  <lastmod>2022-09-17T20:57:48+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:32+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/extension_modules.html</loc>
-  <lastmod>2022-09-17T20:57:48+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:33+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/helper_interfaces.html</loc>
-  <lastmod>2022-09-17T20:57:48+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:33+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/global_interfaces.html</loc>
-  <lastmod>2022-09-17T20:57:48+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:33+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/package_instance.html</loc>
-  <lastmod>2022-09-17T20:57:49+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:33+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/manual/option_instance.html</loc>
-  <lastmod>2022-09-17T20:57:49+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:33+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/builtin_themes.html</loc>
-  <lastmod>2022-09-17T20:57:49+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:34+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/theme/switch_theme.html</loc>
-  <lastmod>2022-09-17T20:57:49+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:34+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_3rd_source_library.html</loc>
-  <lastmod>2022-09-17T20:57:49+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:34+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package_old.html</loc>
-  <lastmod>2022-09-17T20:57:49+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:34+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/local_package.html</loc>
-  <lastmod>2022-09-17T20:57:50+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:34+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/system_package.html</loc>
-  <lastmod>2022-09-17T20:57:50+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:35+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/package/remote_package.html</loc>
-  <lastmod>2022-09-17T20:57:50+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:35+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/remote_toolchain.html</loc>
-  <lastmod>2022-09-17T20:57:50+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:35+08:00</lastmod>
 </url>
 
 <url>
   <loc>https://xmake.io/mirror/toolchain/builtin_toolchains.html</loc>
-  <lastmod>2022-09-17T20:57:50+08:00</lastmod>
+  <lastmod>2022-09-19T20:03:35+08:00</lastmod>
 </url>
 
 </urlset>

+ 0 - 15
zh-cn/manual/builtin_modules.md

@@ -597,21 +597,6 @@ if (errors) raise(errors)
 
 如果在try块中抛出异常,就会在catch和finally中进行errors信息捕获,具体见:[try-catch](#try-catch-finally)
 
-### find_packages
-
-#### 查找依赖包
-
-此接口是对[lib.detect.find_package](/zh-cn/manual/extension_modules?id=detectfind_package)接口的封装,提供多个依赖包的查找支持,例如:
-
-```lua
-target("test")
-    set_kind("binary")
-    add_files("src/*.c")
-    on_load(function (target)
-        target:add(find_packages("openssl", "zlib"))
-    end)
-```
-
 ### os
 
 系统操作模块,属于内置模块,无需使用[import](#import)导入,可直接脚本域调用其接口。

+ 0 - 5
zh-cn/manual/configuration_option.md

@@ -91,14 +91,9 @@ option("test")
 
 #### 选项检测之前执行此脚本
 
-例如:在检测之前,通过[find_package](#detect-find_package)来查找包,将`links`, `includedirs`和`linkdirs`等信息添加到option中去,
-然后开始选项检测,通过后就会自动链接到target上。
-
 ```lua
 option("zlib")
     before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
     end)
 ```
 

+ 2 - 193
zh-cn/manual/extension_modules.md

@@ -873,7 +873,7 @@ print(language.sourcekind_of("/xxxx/test.cpp"))
 
 此模块提供了非常强大的探测功能,用于探测程序、编译器、语言特性、依赖包等。
 
-!> 此模块的接口分散在多个模块目录中,尽量通过导入单个接口来使用,这样效率更高,例如:`import("lib.detect.find_package")`,而不是通过`import("lib.detect")`导入所有来调用
+!> 此模块的接口分散在多个模块目录中,尽量通过导入单个接口来使用,这样效率更高。
 
 #### detect.find_file
 
@@ -1074,198 +1074,7 @@ local version = find_programver("ccache", {command = "--version", parse = functi
 
 - 查找包文件
 
-此接口也是用于查找库文件,但是比[lib.detect.find_library](#detectfind_library)更加上层,也更为强大和简单易用,因为它是以包为力度进行查找。
-
-那怎样算是一个完整的包,它包含:
-
-1. 多个静态库或者动态库文件
-2. 库的搜索目录
-3. 头文件的搜索目录
-4. 可选的编译链接选项,例如:`defines`等
-5. 可选的版本号
-
-例如我们查找一个openssl包:
-
-```lua
-import("lib.detect.find_package")
-
-local package = find_package("openssl")
-```
-
-返回的结果如下:
-
-```lua
-{links = {"ssl", "crypto", "z"}, linkdirs = {"/usr/local/lib"}, includedirs = {"/usr/local/include"}}
-```
-
-如果查找成功,则返回一个包含所有包信息的table,如果失败返回nil
-
-这里的返回结果可以直接作为`target:add`, `option:add`的参数传入,用于动态增加`target/option`的配置:
-
-```lua
-option("zlib")
-    set_showmenu(true)
-    before_check(function (option)
-        import("lib.detect.find_package")
-        option:add(find_package("zlib"))
-    end)
-```
-
-```lua
-target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("zlib"))
-    end)
-```
-
-如果系统上装有`homebrew`, `pkg-config`等第三方工具,那么此接口会尝试使用它们去改进查找结果。
-
-我们也可以通过指定版本号,来选择查找指定版本的包(如果这个包获取不到版本信息或者没有匹配版本的包,则返回nil):
-
-```lua
-local package = find_package("openssl", {version = "1.0.1"})
-```
-
-默认情况下查找的包是根据如下规则匹配平台,架构和模式的:
-
-1. 如果参数传入指定了`{plat = "iphoneos", arch = "arm64", mode = "release"}`,则优先匹配,例如:`find_package("openssl", {plat = "iphoneos"})`。
-2. 如果是在当前工程环境,存在配置文件,则优先尝试从`config.get("plat")`, `config.get("arch")`和`config.get("mode")`获取平台架构进行匹配。
-3. 最后从`os.host()`和`os.arch()`中进行匹配,也就是当前主机的平台架构环境。
-
-如果系统的库目录以及`pkg-config`都不能满足需求,找不到包,那么可以自己手动设置搜索路径:
-
-```lua
-local package = find_package("openssl", {linkdirs = {"/usr/lib", "/usr/local/lib"}, includedirs = "/usr/local/include"})
-```
-
-也可以同时指定需要搜索的链接名,头文件名:
-
-```lua
-local package = find_package("openssl", {links = {"ssl", "crypto"}, includes = "ssl.h"}})
-```
-
-甚至可以指定xmake的`packagedir/*.pkg`包目录,用于查找对应的`openssl.pkg`包,一般用于查找内置在工程目录中的本地包。
-
-例如,tbox工程内置了`pkg/openssl.pkg`本地包载项目中,我们可以通过下面的脚本,传入`{packagedirs = ""}`参数优先查找本地包,如果找不到再去找系统包。
-
-```lua
-target("test")
-    on_load(function (target)
-        import("lib.detect.find_package")
-        target:add(find_package("openssl", {packagedirs = path.join(os.projectdir(), "pkg")}))
-    end)
-```
-
-总结下,现在的查找顺序:
-
-1. 如果指定`{packagedirs = ""}`参数,优先从这个参数指定的路径中查找本地包`*.pkg`
-2. 如果在`xmake/modules`下面存在`detect.packages.find_xxx`脚本,那么尝试调用此脚本来改进查找结果
-3. 如果系统存在vcpkg,优先从vcpkg的包管理系统中去获取包
-4. 如果系统存在`pkg-config`,并且查找的是系统环境的库,则尝试使用`pkg-config`提供的路径和链接信息进行查找
-5. 如果系统存在`homebrew`,并且查找的是系统环境的库,则尝试使用`brew --prefix xxx`提供的信息进行查找
-6. 从参数中指定的pathes路径和一些已知的系统路径`/usr/lib`, `/usr/include`中进行查找
-
-这里需要着重说下第二点,通过在`detect.packages.find_xxx`脚本来改进查找结果,很多时候自动的包探测是没法完全探测到包路径的,
-尤其是针对windows平台,没有默认的库目录,也没有包管理app,很多库装的时候,都是自己所处放置在系统目录,或者添加注册表项。
-
-因此查找起来没有统一的规则,这个时候,就可以自定义一个查找脚本,去改进`find_package`的查找机制,对指定包进行更精准的查找。
-
-在xmake自带的`xmake/modules/detect/packages`目录下,已经有许多的内置包脚本,来对常用的包进行更好的查找支持。
-当然这不可能满足所有用户的需求,如果用户需要的包还是找不到,那么可以自己定义一个查找脚本,例如:
-
-查找一个名为`openssl`的包,可以编写一个`find_openssl.lua`的脚本放置在工程目录:
-
-```
-projectdir
- - xmake
-   - modules
-     - detect/package/find_openssl.lua
-```
-
-然后在工程的`xmake.lua`文件的开头指定下这个modules的目录:
-
-```lua
-add_moduledirs("$(projectdir)/xmake/modules")
-```
-
-这样xmake就能找到自定义的扩展模块了。
-
-接下来我们看下`find_openssl.lua`的实现:
-
-```lua
--- imports
-import("lib.detect.find_path")
-import("lib.detect.find_library")
-
--- find openssl
---
--- @param opt   the package options. e.g. see the options of find_package()
---
--- @return      see the return value of find_package()
---
-function main(opt)
-
-    -- for windows platform
-    --
-    -- http://www.slproweb.com/products/Win32OpenSSL.html
-    --
-    if opt.plat == "windows" then
-
-        -- init bits
-        local bits = (opt.arch == "x64" and "64" or "32")
-
-        -- init search pathes
-        local pathes = {"$(reg HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL %(" .. bits .. "-bit%)_is1;Inno Setup: App Path)",
-                        "$(env PROGRAMFILES)/OpenSSL",
-                        "$(env PROGRAMFILES)/OpenSSL-Win" .. bits,
-                        "C:/OpenSSL",
-                        "C:/OpenSSL-Win" .. bits}
-
-        -- find library
-        local result = {links = {}, linkdirs = {}, includedirs = {}}
-        for _, name in ipairs({"libssl", "libcrypto"}) do
-            local linkinfo = find_library(name, pathes, {suffixes = "lib"})
-            if linkinfo then
-                table.insert(result.links, linkinfo.link)
-                table.insert(result.linkdirs, linkinfo.linkdir)
-            end
-        end
-
-        -- not found?
-        if #result.links ~= 2 then
-            return
-        end
-
-        -- find include
-        table.insert(result.includedirs, find_path("openssl/ssl.h", pathes, {suffixes = "include"}))
-
-        -- ok
-        return result
-    end
-end
-```
-
-里面对windows平台进行注册表读取,去查找指定的库文件,其底层其实也是调用的[find_library](#detectfind_library)等接口。
-
-!> 为了加速频发查找的效率,此接口是默认自带cache的,如果要禁用cache,可以在工程目录执行`xmake f -c`清除本地cache。
-也可以通过指定force参数,来禁用cache,强制重新查找:`find_package("openssl", {force = true})`
-
-我们也可以通过`xmake lua lib.detect.find_package openssl` 来快速测试。
-
-2.2.5版本之后,新增了内置接口[find_packages](#find_packages),可以同时查找多个包,并且不需要通过import导入即可直接使用。
-
-并且此版本之后,支持显式的从指定第三方包管理器中查找包,例如:
-
-```lua
-find_package("brew::pcre2/libpcre2-8")
-```
-
-由于每个第三方包管理器的包名不完全一致,比如pcre2在homebrew中有三个库版本,我们可以通过上面的方式,指定查找对应libpcre2-8版本的库。
-
-另外,对于vcpkg, conan也可以通过加上`vcpkg::`, `conan::`包命名空间来指定查找里面的库。
-
-v2.5.9 我们也可以通过 `find_package("cmake::xxx")` 去借助 cmake 来找一些包。
+2.6.x 之后,这个接口不推荐直接使用(仅供内部使用),库集成,请尽量使用 `add_requires()` 和 `add_packages()`。
 
 #### detect.find_tool
 

+ 0 - 12
zh-cn/manual/global_interfaces.md

@@ -98,18 +98,6 @@ set_xmakever("2.1.0")
 xmake内置的扩展模块都在`xmake/modules`目录下,可通过[import](#import)来导入他们,如果自己在工程里面实现了一些扩展模块,
 可以放置在这个接口指定的目录下,import也就会能找到,并且优先进行导入。
 
-例如定义一个`find_openssl.lua`的扩展模块,用于扩展内置的[lib.detect.find_package](#detect-find_package)接口,则只需要将它放置在:
-
-```
-projectdir/xmake/modules/detect/packages/find_openssl.lua
-```
-
-然后在工程`xmake.lua`下指定这个模块目录,`find_package`就可以自动找到了:
-
-```lua
-add_moduledirs("projectdir/xmake/modules")
-```
-
 ### add_plugindirs
 
 #### 添加插件目录