소스 검색

improve configuration

ruki 4 년 전
부모
커밋
bfabee8b96
4개의 변경된 파일84개의 추가작업 그리고 18개의 파일을 삭제
  1. 42 10
      guide/configuration.md
  2. 2 1
      package/local_package.md
  3. 38 6
      zh-cn/guide/configuration.md
  4. 2 1
      zh-cn/package/local_package.md

+ 42 - 10
guide/configuration.md

@@ -155,7 +155,7 @@ Note: We can also specify the `-p linux` platform to configure cross compilation
 At this time, xmake will automatically detect the prefix name cross of gcc and other compilers: `arm-linux-armeabi-`, and when compiling, it will also automatically add search options for` link library` and `header files` :
 
 ```
--I/home/toolchains_sdkdir/include 
+-I/home/toolchains_sdkdir/include
 -L/home/toolchains_sdkdir/lib
 ```
 
@@ -188,7 +188,7 @@ For example, there are two different compilers in the bin directory of toolchain
 
 ```
 /opt/bin
-  - armv7-linux-gcc 
+  - armv7-linux-gcc
   - aarch64-linux-gcc
 ```
 
@@ -338,7 +338,7 @@ if is_plat("gragonfly", "freebsd", "netbsd", "openbsd") then
     add_files("src/unix/kqueue.c")
     add_files("src/unix/posix-hrtime.c")
     add_headerfiles("(include/uv-bsd.h)")
-end 
+end
 
 -- for sunos platform
 if is_plat("sunos") then
@@ -693,7 +693,7 @@ $ xmake f -p linux --sdk=/user/toolsdk --as=armv7-linux-as
 If the 'AS' environment variable exists, it will use the values specified in the current environment variables.
 
 <p class="tip">
-We can set a unknown compiler as like-gcc/clang compiler, .e.g `xmake f --as=gcc@/home/xxx/asmips.exe` 
+We can set a unknown compiler as like-gcc/clang compiler, .e.g `xmake f --as=gcc@/home/xxx/asmips.exe`
 </p>
 
 #### --cc
@@ -707,7 +707,7 @@ $ xmake f -p linux --sdk=/user/toolsdk --cc=armv7-linux-clang
 If the 'CC' environment variable exists, it will use the values specified in the current environment variables.
 
 <p class="tip">
-We can set a unknown compiler as like-gcc/clang compiler, .e.g `xmake f --cc=gcc@/home/xxx/ccmips.exe` 
+We can set a unknown compiler as like-gcc/clang compiler, .e.g `xmake f --cc=gcc@/home/xxx/ccmips.exe`
 </p>
 
 #### --cxx
@@ -721,7 +721,7 @@ $ xmake f -p linux --sdk=/user/toolsdk --cxx=armv7-linux-clang++
 If the 'CXX' environment variable exists, it will use the values specified in the current environment variables.
 
 <p class="tip">
-We can set a unknown compiler as like-gcc/clang compiler, .e.g `xmake f --cxx=g++@/home/xxx/c++mips.exe` 
+We can set a unknown compiler as like-gcc/clang compiler, .e.g `xmake f --cxx=g++@/home/xxx/c++mips.exe`
 </p>
 
 #### --ld
@@ -735,7 +735,7 @@ $ xmake f -p linux --sdk=/user/toolsdk --ld=armv7-linux-clang++
 If the 'LD' environment variable exists, it will use the values specified in the current environment variables.
 
 <p class="tip">
-We can set a unknown compiler as like-gcc/clang linker, .e.g `xmake f --ld=g++@/home/xxx/c++mips.exe` 
+We can set a unknown compiler as like-gcc/clang linker, .e.g `xmake f --ld=g++@/home/xxx/c++mips.exe`
 </p>
 
 #### --sh
@@ -749,7 +749,7 @@ $ xmake f -p linux --sdk=/user/toolsdk --sh=armv7-linux-clang++
 If the 'SH' environment variable exists, it will use the values specified in the current environment variables.
 
 <p class="tip">
-We can set a unknown compiler as like-gcc/clang linker, .e.g `xmake f --sh=g++@/home/xxx/c++mips.exe` 
+We can set a unknown compiler as like-gcc/clang linker, .e.g `xmake f --sh=g++@/home/xxx/c++mips.exe`
 </p>
 
 #### --ar
@@ -763,7 +763,7 @@ $ xmake f -p linux --sdk=/user/toolsdk --ar=armv7-linux-ar
 If the 'AR' environment variable exists, it will use the values specified in the current environment variables.
 
 <p class="tip">
-We can set a unknown compiler as like-ar archiver, .e.g `xmake f --ar=ar@/home/xxx/armips.exe` 
+We can set a unknown compiler as like-ar archiver, .e.g `xmake f --ar=ar@/home/xxx/armips.exe`
 </p>
 
 ## Global Configuration
@@ -796,10 +796,42 @@ $ xmake f -c
 $ xmake
 ```
 
-or 
+or
 
 ```bash
 $ xmake f -p iphoneos -c
 $ xmake
 ```
 
+## Import and export configuration
+
+After 2.5.5, we can also import and export the configured configuration set to facilitate rapid configuration migration.
+
+### Export configuration
+
+```console
+$ xmake f --export=/tmp/config.txt
+$ xmake f -m debug --xxx=y --export=/tmp/config.txt
+```
+
+### Import configuration
+
+```console
+$ xmake f --import=/tmp/config.txt
+$ xmake f -m debug --xxx=y --import=/tmp/config.txt
+```
+
+### Export configuration (with menu)
+
+```console
+$ xmake f --menu --export=/tmp/config.txt
+$ xmake f --menu -m debug --xxx=y --export=/tmp/config.txt
+```
+
+
+### Import configuration (with menu)
+
+```console
+$ xmake f --menu --import=/tmp/config.txt
+$ xmake f --menu -m debug --xxx=y --import=/tmp/config.txt
+```

+ 2 - 1
package/local_package.md

@@ -1,7 +1,8 @@
-After version 2.5.5, we have provided a new local package packaging solution that will seamlessly integrate `add_requires` and `add_packages`.
 
 ### Default packaging format
 
+After version 2.5.5, we have provided a new local package packaging solution that will seamlessly integrate `add_requires` and `add_packages`.
+
 We can execute the `xmake package` command to generate the default new version of the packaging format.
 
 ```console

+ 38 - 6
zh-cn/guide/configuration.md

@@ -151,7 +151,7 @@ $ xmake
 这个时候,xmake会去自动探测gcc等编译器的前缀名cross:`arm-linux-armeabi-`,并且编译的时候,也会自动加上`链接库`和`头文件`的搜索选项,例如:
 
 ```
--I/home/toolchains_sdkdir/include 
+-I/home/toolchains_sdkdir/include
 -L/home/toolchains_sdkdir/lib
 ```
 
@@ -184,7 +184,7 @@ $ xmake
 
 ```
 /opt/bin
-  - armv7-linux-gcc 
+  - armv7-linux-gcc
   - aarch64-linux-gcc
 ```
 
@@ -217,7 +217,7 @@ xmake f --cxx=clang++@/home/xxx/c++mips.exe
 ```
 
 设置c++mips.exe编译器作为类clang++的使用方式来编译。
- 
+
 也就是说,在指定编译器为`c++mips.exe`的同时,告诉xmake,它跟clang++用法和参数选项基本相同。
 
 ### 设置c/c++链接器
@@ -334,7 +334,7 @@ if is_plat("gragonfly", "freebsd", "netbsd", "openbsd") then
     add_files("src/unix/kqueue.c")
     add_files("src/unix/posix-hrtime.c")
     add_headerfiles("(include/uv-bsd.h)")
-end 
+end
 
 -- for sunos platform
 if is_plat("sunos") then
@@ -371,7 +371,7 @@ $ xmake show -l toolchains
 
 !> 此特性需要v2.3.4以上版本才支持
 
-上文讲述的是通用的交叉编译工具链配置,如果一些特定的工具链需要额外传入`--ldflags/--includedirs`等场景就比较繁琐了, 
+上文讲述的是通用的交叉编译工具链配置,如果一些特定的工具链需要额外传入`--ldflags/--includedirs`等场景就比较繁琐了,
 因此xmake也内置了一些常用工具链,可以省去交叉编译工具链复杂的配置过程,只需要执行:
 
 ```bash
@@ -652,7 +652,7 @@ $ xmake
 
 对于不规则工具链目录结构,靠单纯地[--sdk](#-sdk)选项设置,没法完全检测通过的情况下,可以通过这个选项继续附加设置工具链的bin目录位置。
 
-例如:一些特殊的交叉工具链的,编译器bin目录,并不在 `/home/toolchains_sdkdir/bin` 这个位置,而是独立到了 `/usr/opt/bin` 
+例如:一些特殊的交叉工具链的,编译器bin目录,并不在 `/home/toolchains_sdkdir/bin` 这个位置,而是独立到了 `/usr/opt/bin`
 
 ```bash
 $ xmake f -p linux --sdk=/home/toolchains_sdkdir --bin=/usr/opt/bin
@@ -828,3 +828,35 @@ $ xmake f -p iphoneos -c
 $ xmake
 ```
 
+## 导入导出配置
+
+2.5.5 之后,我们还可以导入导出已经配置好的配置集,方便配置的快速迁移。
+
+### 导出配置
+
+```console
+$ xmake f --export=/tmp/config.txt
+$ xmake f -m debug --xxx=y --export=/tmp/config.txt
+```
+
+### 导入配置
+
+```console
+$ xmake f --import=/tmp/config.txt
+$ xmake f -m debug --xxx=y --import=/tmp/config.txt
+```
+
+### 导出配置(带菜单)
+
+```console
+$ xmake f --menu --export=/tmp/config.txt
+$ xmake f --menu -m debug --xxx=y --export=/tmp/config.txt
+```
+
+
+### 导入配置(带菜单)
+
+```console
+$ xmake f --menu --import=/tmp/config.txt
+$ xmake f --menu -m debug --xxx=y --import=/tmp/config.txt
+```

+ 2 - 1
zh-cn/package/local_package.md

@@ -1,7 +1,8 @@
-2.5.5 版本之后,我们提供了一种新的本地包打包方案,将会更加无缝的对接 `add_requires` 和 `add_packages`。
 
 ### 默认打包格式
 
+2.5.5 版本之后,我们提供了一种新的本地包打包方案,将会更加无缝的对接 `add_requires` 和 `add_packages`。
+
 我们执行 `xmake package` 命令就能够生成默认的新版打包格式。
 
 ```console