ruki il y a 4 ans
Parent
commit
01bff0daef

+ 28 - 0
manual/custom_rule.md

@@ -685,6 +685,34 @@ static unsigned char g_test_frag_spv_data[] = {
 
 Similar to the usage of bin2c rules, see the complete example: [glsl2spv example](https://github.com/xmake-io/xmake/tree/master/tests/projects/other/glsl2spv)
 
+#### python.library
+
+We can use this rule to generate python library modules with pybind11, which will adjust the module name of the python library.
+
+````lua
+add_rules("mode.release", "mode.debug")
+add_requires("pybind11")
+
+target("example")
+     add_rules("python.library")
+     add_files("src/*.cpp")
+     add_packages("pybind11")
+     set_languages("c++11")
+````
+
+with soabi:
+
+````lua
+add_rules("mode.release", "mode.debug")
+add_requires("pybind11")
+
+target("example")
+     add_rules("python.library", {soabi = true})
+     add_files("src/*.cpp")
+     add_packages("pybind11")
+     set_languages("c++11")
+````
+
 ### rule
 
 #### Defining rules

+ 21 - 5
manual/project_target.md

@@ -1355,7 +1355,7 @@ And after the 2.1.9 version, you can use the force parameter to force the automa
 add_files("src/*.c", {force = {cxflags = "-DTEST", mflags = "-framework xxx"}})
 ```
 
-### target:del_files
+### target:remove_files
 
 #### Remove source files
 
@@ -1364,7 +1364,7 @@ Through this interface, you can delete the specified file from the list of files
 ```lua
 target("test")
     add_files("src/*.c")
-    del_files("src/test.c")
+    remove_files("src/test.c")
 ```
 
 In the above example, you can add all files except `test.c` from the `src` directory. Of course, this can also be done by `add_files("src/*.c|test.c").To achieve the same purpose, but this way is more flexible.
@@ -1374,16 +1374,32 @@ For example, we can conditionally determine which files to delete, and this inte
 ```lua
 target("test")
     add_files("src/**.c")
-    del_files("src/test*.c")
-    del_files("src/subdir/*.c|xxx.c")
+    remove_files("src/test*.c")
+    remove_files("src/subdir/*.c|xxx.c")
     if is_plat("iphoneos") then
         add_files("xxx.m")
     end
 ```
 
-Through the above example, we can see that `add_files` and `del_files` are added and deleted sequentially according to the calling sequence, and deleted by `del_files("src/subdir/*.c|xxx.c")` Batch file,
+Through the above example, we can see that `add_files` and `remove_files` are added and deleted sequentially according to the calling sequence, and deleted by `remove_files("src/subdir/*.c|xxx.c")` Batch file,
 And exclude `src/subdir/xxx.c` (that is, don't delete this file).
 
+Note: This interface is only available in version v2.6.3. The previous version was del_files, which has been abandoned.
+
+If you want to be compatible with the previous version, you can solve it through the following configuration.
+
+````lua
+remove_files = remove_files or del_files
+````
+
+### target:remove_headerfiles
+
+#### Remove the specified file from the preceding list of header files
+
+Mainly used to remove files from the list of header files set by `add_headerfiles`, similar to `remove_files`.
+
+This interface is only provided in v2.6.3 version.
+
 ### target:add_linkdirs
 
 #### Add link search directories

+ 13 - 0
package/remote_package.md

@@ -262,6 +262,19 @@ e.g:
 add_requires("vcpkg::boost[core]")
 ```
 
+After v2.6.3, xmake supports the new manifest mode of vcpkg, through which we can support version selection of vcpkg package, for example:
+
+````lua
+add_requires("vcpkg::zlib 1.2.11+10")
+add_requires("vcpkg::fmt >=8.0.1", {configs = {baseline = "50fd3d9957195575849a49fa591e645f1d8e7156"}})
+add_requires("vcpkg::libpng", {configs = {features = {"apng"}}})
+
+target("test")
+     set_kind("binary")
+     add_files("src/*.cpp")
+     add_packages("vcpkg::zlib", "vcpkg::fmt", "vcpkg::libpng")
+````
+
 ### Add conan dependency package
 
 ```lua

+ 28 - 0
zh-cn/manual/custom_rule.md

@@ -687,6 +687,34 @@ static unsigned char g_test_frag_spv_data[] = {
 
 跟 bin2c 规则的使用方式类似,完整例子见:[glsl2spv example](https://github.com/xmake-io/xmake/tree/master/tests/projects/other/glsl2spv)
 
+#### python.library
+
+我们可以用这个规则,配合 pybind11 生成 python 库模块,它会调整 python 库的模块名。
+
+```lua
+add_rules("mode.release", "mode.debug")
+add_requires("pybind11")
+
+target("example")
+    add_rules("python.library")
+    add_files("src/*.cpp")
+    add_packages("pybind11")
+    set_languages("c++11")
+```
+
+带有 soabi:
+
+```lua
+add_rules("mode.release", "mode.debug")
+add_requires("pybind11")
+
+target("example")
+    add_rules("python.library", {soabi = true})
+    add_files("src/*.cpp")
+    add_packages("pybind11")
+    set_languages("c++11")
+```
+
 ### rule
 
 #### 定义规则

+ 21 - 5
zh-cn/manual/project_target.md

@@ -1356,7 +1356,7 @@ target("test")
 add_files("src/*.c", {force = {cxflags = "-DTEST", mflags = "-framework xxx"}})
 ```
 
-### target:del_files
+### target:remove_files
 
 #### 从前面的源代码文件列表中删除指定文件
 
@@ -1365,7 +1365,7 @@ add_files("src/*.c", {force = {cxflags = "-DTEST", mflags = "-framework xxx"}})
 ```lua
 target("test")
     add_files("src/*.c")
-    del_files("src/test.c")
+    remove_files("src/test.c")
 ```
 
 上面的例子,可以从`src`目录下添加除`test.c`以外的所有文件,当然这个也可以通过`add_files("src/*.c|test.c")`来达到相同的目的,但是这种方式更加灵活。
@@ -1375,16 +1375,32 @@ target("test")
 ```lua
 target("test")
     add_files("src/**.c")
-    del_files("src/test*.c")
-    del_files("src/subdir/*.c|xxx.c")
+    remove_files("src/test*.c")
+    remove_files("src/subdir/*.c|xxx.c")
     if is_plat("iphoneos") then
         add_files("xxx.m")
     end
 ```
 
-通过上面的例子,我们可以看出`add_files`和`del_files`是根据调用顺序,进行顺序添加和删除的,并且通过`del_files("src/subdir/*.c|xxx.c")`删除一批文件,
+通过上面的例子,我们可以看出`add_files`和`remove_files`是根据调用顺序,进行顺序添加和删除的,并且通过`remove_files("src/subdir/*.c|xxx.c")`删除一批文件,
 并且排除`src/subdir/xxx.c`(就是说,不删除这个文件)。
 
+注: 这个接口 v2.6.3 版本才提供,之前的版本是 del_files,已经废弃。
+
+如果向下要兼容以前的版本,可以通过下面的配置解决。
+
+```lua
+remove_files = remove_files or del_files
+```
+
+### target:remove_headerfiles
+
+#### 从前面的头文件列表中删除指定文件
+
+主要用于从 `add_headerfiles` 设置的头文件列表中删除文件,用法与 `remove_files` 类似。
+
+这个接口,v2.6.3 版本才提供。
+
 ### target:add_linkdirs
 
 #### 添加链接库搜索目录

+ 12 - 0
zh-cn/package/remote_package.md

@@ -289,6 +289,18 @@ target("test")
 add_requires("vcpkg::boost[core]")
 ```
 
+v2.6.3 之后,xmake 支持 vcpkg 新的清单模式,通过它,我们就能支持 vcpkg 包的版本选择,例如:
+
+```lua
+add_requires("vcpkg::zlib 1.2.11+10")
+add_requires("vcpkg::fmt >=8.0.1", {configs = {baseline = "50fd3d9957195575849a49fa591e645f1d8e7156"}})
+add_requires("vcpkg::libpng", {configs = {features = {"apng"}}})
+
+target("test")
+    set_kind("binary")
+    add_files("src/*.cpp")
+    add_packages("vcpkg::zlib", "vcpkg::fmt", "vcpkg::libpng")
+```
 
 ### 添加 conan 的依赖包