diff options
| author | ruki <[email protected]> | 2017-02-05 15:10:32 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-02-05 15:10:32 +0800 |
| commit | 29b2ea970aeed26971438417bb67ddce5c703cc1 (patch) | |
| tree | 79c01e65539ccc23d0738a040ead7867ae59ba91 /docs | |
| parent | db465c5fc41396dacf505a162304ee1e611fbaa3 (diff) | |
write some manual interfaces
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/README.md | 53 | ||||
| -rw-r--r-- | docs/config.js | 6 | ||||
| -rw-r--r-- | docs/plugins.md | 34 | ||||
| -rwxr-xr-x | docs/zh/README.md | 52 | ||||
| -rwxr-xr-x | docs/zh/manual.md | 564 | ||||
| -rwxr-xr-x | docs/zh/plugins.md | 36 |
6 files changed, 564 insertions, 181 deletions
diff --git a/docs/README.md b/docs/README.md index 8bd98f014..e297a5b3c 100644 --- a/docs/README.md +++ b/docs/README.md @@ -15,26 +15,26 @@ so that any developer can quickly pick it up and enjoy the productivity boost wh ## Installation -#### Windows +##### Windows 1. Download xmake installer ([Releases](https://github.com/tboox/xmake/releases)) 2. Run xmake-[version].exe -#### MacOS +##### MacOS ```bash $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" $ sudo brew install xmake ``` -#### Linux +##### Linux ```bash $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)" $ sudo brew install xmake ``` -#### Compilation +##### Compilation ```bash $ git clone [email protected]:waruqi/xmake.git @@ -119,9 +119,9 @@ hello`main: ## Configuration -### Target Platforms +#### Target Platforms -#### Current Host +##### Current Host ```bash $ xmake @@ -131,49 +131,49 @@ $ xmake XMake will detect the current host platform automatically and build project. </p> -#### Linux +##### Linux ```bash $ xmake f -p linux [-a i386|x86_64] $ xmake ``` -#### Android +##### Android ```bash $ xmake f -p android --ndk=~/files/android-ndk-r10e/ [-a armv5te|armv6|armv7-a|armv8-a|arm64-v8a] $ xmake ``` -#### iPhoneOS +##### iPhoneOS ```bash $ xmake f -p iphoneos [-a armv7|armv7s|arm64|i386|x86_64] $ xmake ``` -#### Windows +##### Windows ```bash $ xmake f -p windows [-a x86|x64] $ xmake ``` -#### Mingw +##### Mingw ```bash $ xmake f -p mingw --sdk=/usr/local/i386-mingw32-4.3.0/ [-a i386|x86_64] $ xmake ``` -#### Apple WatchOS +##### Apple WatchOS ```bash $ xmake f -p watchos [-a i386|armv7k] $ xmake ``` -#### Cross Compilation +##### Cross Compilation ```bash $ xmake f -p linux --sdk=/usr/local/arm-linux-gcc/ [--toolchains=/sdk/bin] [--cross=arm-linux-] @@ -189,7 +189,7 @@ $ xmake And if you want to known more options, please run: `xmake f --help` </p> -### Global Configuration +#### Global Configuration You can save to the global configuration for simplfying operation. @@ -210,7 +210,7 @@ $ xmake You can use short or long command option, for exmaple: `xmake g` or `xmake global`.<br> </p> -### Clean Configuration +#### Clean Configuration We can clean all cached configuration and re-configure projecct. @@ -254,3 +254,26 @@ For example: $ xmake run --help ``` +#### How to do if xmake fails? + +Please attempt to clean configuration and rebuild it first. + +```bash +$ xmake f -c +$ xmake +``` + +If it fails again, please add `-v` or `--verbose` options to get more verbose info. + +For exmaple: + +```hash +$ xmake -v +$ xmake --verbose +``` + +And add `--backtrace` to get the verbose backtrace info, then you can submit these infos to [issues](https://github.com/tboox/xmake/issues). + +```bash +$ xmake -v --backtrace +``` diff --git a/docs/config.js b/docs/config.js index 53f62bda7..0cbd07773 100644 --- a/docs/config.js +++ b/docs/config.js @@ -24,6 +24,9 @@ self.$config = { title: 'Blog', path: 'http://www.tboox.org' }, { + title: 'Community', path: 'http://www.tboox.org/forum' + }, + { title: 'English', type: 'dropdown', items: langs, exact: true } ], @@ -41,6 +44,9 @@ self.$config = { title: '博客', path: 'http://www.tboox.org/cn' }, { + title: '社区', path: 'http://www.tboox.org/forum' + }, + { title: '中文', type: 'dropdown', items: langs, exact: true } ] diff --git a/docs/plugins.md b/docs/plugins.md index afa560a8a..fbdc09afa 100644 --- a/docs/plugins.md +++ b/docs/plugins.md @@ -101,15 +101,17 @@ target("demo") end) ``` -## Macros Recording and Playback +## Builtin Plugins -#### Introduction +#### Macros Recording and Playback + +##### Introduction We can record and playback our xmake commands and save as macro quickly using this plugin. And we can run this macro to simplify our jobs repeatly. -#### Record Commands +##### Record Commands ```bash # begin to record commands @@ -137,14 +139,14 @@ $ xmake p xmake macro --end ``` -#### Playback Macro +##### Playback Macro ```bash # playback the previous anonymous macro $ xmake macro . ``` -#### Named Macro +##### Named Macro ```bash $ xmake macro --begin @@ -153,7 +155,7 @@ $ xmake macro --end macroname $ xmake macro macroname ``` -#### Import and Export Macro +##### Import and Export Macro Import the given macro file or directory. @@ -169,7 +171,7 @@ $ xmake macro --export=/xxx/macro.lua macroname $ xmake macro --export=/xxx/macrodir ``` -#### List and Show Macro +##### List and Show Macro List all builtin macros. @@ -183,7 +185,7 @@ Show the given macro script content. $ xmake macro --show macroname ``` -#### Custom Macro Script +##### Custom Macro Script Create and write a `macro.lua` script first. @@ -220,7 +222,7 @@ Playback this macro script. $ xmake macro [.|macroname] ``` -#### Builtin Macros +##### Builtin Macros XMake supports some builtins macros to simplify our jobs. @@ -230,7 +232,7 @@ For example, we use `package` macro to package all architectures of the iphoneos $ xmake macro package -p iphoneos ``` -#### Advance Macro Script +##### Advance Macro Script Let's see the `package` macro script: @@ -334,7 +336,7 @@ end If you want to known more options, please run: `xmake macro --help` </p> -## Run the Custom Lua Script +#### Run the Custom Lua Script Write a simple lua script: @@ -354,21 +356,21 @@ $ xmake lua /tmp/test.lua You can also use `import` api to write a more advance lua script. </p> -## Generate IDE Project Files +#### Generate IDE Project Files -#### Generate Makefile +##### Generate Makefile ```bash $ xmake project -k makefile ``` -#### Generate VisualStudio Project +##### Generate VisualStudio Project ```bash $ xmake project -k [vs2008|vs2013|vs2015|..] ``` -## Generate Doxygen Document +#### Generate Doxygen Document Please ensure that the doxygen tool has been installed first. @@ -376,7 +378,7 @@ Please ensure that the doxygen tool has been installed first. $ xmake doxygen ``` -## Convert .app to .ipa +#### Convert .app to .ipa ```bash $ xmake app2ipa --icon=/xxx.png /xxx/ios.app -o /xxx.ios.ipa diff --git a/docs/zh/README.md b/docs/zh/README.md index dd943f0f7..f92570d26 100755 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -22,26 +22,26 @@ xmake的目标是开发者更加关注于项目本身开发,简化项目的描 ## 安装 -#### Windows +##### Windows 1. 从 ([Releases](https://github.com/tboox/xmake/releases)) 上下载windows安装包 2. 运行安装程序 xmake-[version].exe -#### MacOS +##### MacOS ```bash $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" $ sudo brew install xmake ``` -#### Linux +##### Linux ```bash $ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)" $ sudo brew install xmake ``` -#### 编译安装 +##### 编译安装 ```bash $ git clone [email protected]:waruqi/xmake.git @@ -126,9 +126,9 @@ hello`main: ## 配置 -### 目标平台 +#### 目标平台 -#### 主机平台 +##### 主机平台 ```bash $ xmake @@ -138,49 +138,49 @@ $ xmake xmake将会自动探测当前主机平台,默认自动生成对应的目标程序。 </p> -#### Linux +##### Linux ```bash $ xmake f -p linux [-a i386|x86_64] $ xmake ``` -#### Android +##### Android ```bash $ xmake f -p android --ndk=~/files/android-ndk-r10e/ [-a armv5te|armv6|armv7-a|armv8-a|arm64-v8a] $ xmake ``` -#### iPhoneOS +##### iPhoneOS ```bash $ xmake f -p iphoneos [-a armv7|armv7s|arm64|i386|x86_64] $ xmake ``` -#### Windows +##### Windows ```bash $ xmake f -p windows [-a x86|x64] $ xmake ``` -#### Mingw +##### Mingw ```bash $ xmake f -p mingw --sdk=/usr/local/i386-mingw32-4.3.0/ [-a i386|x86_64] $ xmake ``` -#### Apple WatchOS +##### Apple WatchOS ```bash $ xmake f -p watchos [-a i386|armv7k] $ xmake ``` -#### 交叉编译 +##### 交叉编译 ```bash $ xmake f -p linux --sdk=/usr/local/arm-linux-gcc/ [--toolchains=/sdk/bin] [--cross=arm-linux-] @@ -196,7 +196,7 @@ $ xmake 如果你想要了解更多参数选项,请运行: `xmake f --help` </p> -### 全局配置 +#### 全局配置 我们也可以将一些常用配置保存到全局配置中,来简化频繁地输入: @@ -219,7 +219,7 @@ $ xmake 每个命令都有其简写,例如: `xmake g` 或者 `xmake global`.<br> </p> -### 清除配置 +#### 清除配置 有时候,配置出了问题编译不过,或者需要重新检测各种依赖库和接口,可以加上`-c`参数,清除缓存的配置,强制重新检测和配置 @@ -263,4 +263,26 @@ $ xmake [action|plugin] [-h|--help] $ xmake run --help ``` +#### 如果xmake运行失败了怎么办? +可以先尝试清除下配置,重新构建下: + +```bash +$ xmake f -c +$ xmake +``` + +如果还是失败了,请加上 `-v` 或者 `--verbose` 选项重新执行xmake后,获取更加详细的输出信息 + +例如: + +```hash +$ xmake -v +$ xmake --verbose +``` + +并且可以加上 `--backtrace` 选项获取出错时的xmake的调试栈信息, 然后你可以提交这些信息到[issues](https://github.com/tboox/xmake/issues). + +```bash +$ xmake -v --backtrace +``` diff --git a/docs/zh/manual.md b/docs/zh/manual.md index 9a415cd5a..ec0882e80 100755 --- a/docs/zh/manual.md +++ b/docs/zh/manual.md @@ -3,135 +3,463 @@ nav: zh search: zh --- -## 条件判断 +## 接口文档 -#### is_os -#### is_arch -#### is_plat -#### is_mode -#### is_kind -#### is_option +#### 条件判断 -## 根作用域 +条件判断的api,一般用于必须要处理特定平台的编译逻辑的场合。。通常跟lua的if语句配合使用。 -#### set_project -#### set_version -#### add_subdirs -#### add_subfiles -#### add_plugindirs -#### add_packagedirs +| 接口 | 描述 | +| ------------------------- | ----------------------------- | +| [is_os](#is_os) | 判断当前编译架构 | +| [is_arch](#is_arch) | 判断当前构建的操作系统 | +| [is_plat](#is_plat) | 判断当前编译平台 | +| [is_mode](#is_mode) | 判断当前编译模式 | +| [is_kind](#is_kind) | 判断当前编译类型 | +| [is_option](#is_option) | 判断选项是否启用 | -## Target目标 +##### is_os -#### target -#### set_kind -#### set_strip -#### set_options -#### set_symbols -#### set_warnings -#### set_optimize -#### set_languages -#### set_headerdir -#### set_targetdir -#### set_objectdir -#### on_build -#### on_clean -#### on_package -#### on_install -#### on_uninstall -#### on_run -#### before_build -#### before_clean -#### before_package -#### before_install -#### before_uninstall -#### before_run -#### after_build -#### after_clean -#### after_package -#### after_install -#### after_uninstall -#### after_run -#### set_config_h -#### set_config_h_prefix -#### add_deps -#### add_links -#### add_files -#### add_headers -#### add_linkdirs -#### add_includedirs -#### add_defines -#### add_undefines -#### add_defines_h -#### add_undefines_h -#### add_cflags -#### add_cxflags -#### add_cxxflags -#### add_mflags -#### add_mxflags -#### add_mxxflags -#### add_ldflags -#### add_arflags -#### add_shflags -#### add_cfuncs -#### add_cxxfuncs -#### add_options -#### add_languages -#### add_vectorexts +###### 判断当前构建的操作系统 -## Option选项 +```lua +-- 如果当前操作系统是ios +if is_os("ios") then + add_files("src/xxx/*.m") +end +``` -#### option -#### set_enable -#### set_showmenu -#### set_category -#### set_warnings -#### set_optimize -#### set_languages -#### set_description -#### add_bindings -#### add_rbindings -#### add_links -#### add_linkdirs -#### add_includedirs -#### add_cincludes -#### add_cxxincludes -#### add_cfuncs -#### add_cxxfuncs -#### add_ctypes -#### add_cxxtypes -#### add_cflags -#### add_cxflags -#### add_cxxflags -#### add_ldflags -#### add_vectorexts -#### add_defines -#### add_defines_if_ok -#### add_defines_h_if_ok -#### add_undefines -#### add_undefines_if_ok -#### add_undefines_h_if_ok +目前支持的操作系统有: -## Task任务 +* windows +* linux +* android +* macosx +* ios -#### set_menu -#### set_category -#### on_run +##### is_arch -## Platform平台 +###### 判断当前编译架构 -#### set_os -#### set_menu -#### set_hosts -#### set_archs -#### set_checker -#### set_tooldirs -#### on_load +用于检测编译配置:`xmake f -a armv7` -## Template模板 +```lua +-- 如果当前架构是x86_64或者i386 +if is_arch("x86_64", "i386") then + add_files("src/xxx/*.c") +end -#### set_description -#### set_projectdir -#### add_macros -#### add_macrofiles +-- 如果当前平台是armv7, arm64, armv7s, armv7-a +if is_arch("armv7", "arm64", "armv7s", "armv7-a") then + -- ... +end +``` + +如果像上面那样一个个去判断所有arm架构,也许会很繁琐,毕竟每个平台的架构类型很多,xmake提供了类似add_files中的通配符匹配模式,来更加简洁的进行判断: + +```lua +--如果当前平台是arm平台 +if is_arch("arm*") then + -- ... +end +``` + +用*就可以匹配所有了。。 + +##### is_plat + +###### 判断当前编译平台 + +用于检测编译配置:`xmake f -p iphoneos` + +```lua +-- 如果当前平台是android +if is_plat("android") then + add_files("src/xxx/*.c") +end + +-- 如果当前平台是macosx或者iphoneos +if is_plat("macosx", "iphoneos") then + add_mxflags("-framework Foundation") + add_ldflags("-framework Foundation") +end +``` + +目前支持的平台有: + +* windows +* linux +* macosx +* android +* iphoneos +* watchos + +当然你也可以自己扩展添加自己的平台。。。 + +##### is_mode + +###### 判断当前编译模式 + +用于检测编译配置:`xmake f -m debug` + +编译模式的类型并不是内置的,可以自由指定,一般指定:`debug`, `release`, `profile` 这些就够用了,当然你也可以在xmake.lua使用其他模式名来判断。 + +```lua +-- 如果当前编译模式是debug +if is_mode("debug") then + + -- 添加DEBUG编译宏 + add_defines("DEBUG") + + -- 启用调试符号 + set_symbols("debug") + + -- 禁用优化 + set_optimize("none") + +end + +-- 如果是release或者profile模式 +if is_mode("release", "profile") then + + -- 如果是release模式 + if is_mode("release") then + + -- 隐藏符号 + set_symbols("hidden") + + -- strip所有符号 + set_strip("all") + + -- 忽略帧指针 + add_cxflags("-fomit-frame-pointer") + add_mxflags("-fomit-frame-pointer") + + -- 如果是profile模式 + else + + -- 启用调试符号 + set_symbols("debug") + + end + + -- 添加扩展指令集 + add_vectorexts("sse2", "sse3", "ssse3", "mmx") +end +``` + +##### is_kind + +###### 判断当前编译类型 + +判断当前是否编译的是动态库还是静态库,用于检测编译配置:`xmake f -k [static|shared]` + +一般用于如下场景: + +```lua +target("test") + + -- 通过配置设置目标的kind + set_kind("$(kind)") + add_files("src/*c") + + -- 如果当前编译的是静态库,那么添加指定文件 + if is_kind("static") then + add_files("src/xxx.c") + end +``` + +编译配置的时候,可手动切换,编译类型: + +```bash +# 编译静态库 +$ xmake f -k static +$ xmake +``` + +```bash +# 编译动态库 +$ xmake f -k shared +$ xmake +``` + +##### is_option + +###### 判断选项是否启用 + +用于检测自定义的编译配置选型:`xmake f --xxxx=y` + +如果某个自动检测选项、手动设置选项被启用,那么可以通过`is_option`接口来判断,例如: + +```lua +-- 如果手动启用了xmake f --demo=y 选项 +if is_option("demo") then + + -- 编译demo目录下的代码 + add_subdirs("src/demo") +end +``` + +#### 全局接口 + +全局接口影响整个工程描述,被调用后,后面被包含进来的所有子`xmake.lua`都会受影响。 + +| 接口 | 描述 | +| ------------------------------------- | ----------------------------- | +| [set_project](#set_project) | 设置工程名 | +| [set_version](#set_version) | 设置工程版本 | +| [add_subdirs](#add_subdirs) | 添加子工程目录 | +| [add_subfiles](#add_subfiles) | 添加子工程文件 | +| [add_plugindirs](#add_plugindirs) | 添加插件目录 | +| [add_packagedirs](#add_packagedirs) | 添加包目录 | + +##### set_project + +###### 设置工程名 + +设置工程名,在doxygen自动文档生成插件、工程文件生成插件中会用到,一般设置在xmake.lua的最开头,当然放在其他地方也是可以的 + +```lua +-- 设置工程名 +set_project("tbox") + +-- 设置工程版本 +set_version("1.5.1") +``` + +##### set_version + +###### 设置工程版本 + +设置项目版本,可以放在xmake.lua任何地方,一般放在最开头,例如: + +```lua +set_version("1.5.1") +``` + +以tbox为例,如果调用`set_config_h`设置了`config.h`,那么会自动生成如下宏: + +```c +// version +#define TB_CONFIG_VERSION "1.5.1" +#define TB_CONFIG_VERSION_MAJOR 1 +#define TB_CONFIG_VERSION_MINOR 5 +#define TB_CONFIG_VERSION_ALTER 1 +#define TB_CONFIG_VERSION_BUILD 201510220917 +``` + +##### add_subdirs + +###### 添加子工程目录 + +每个子工程对应一个`xmake.lua`的工程描述文件。 + +虽然一个`xmake.lua`也可以描述多个子工程模块,但是如果工程越来越大,越来越复杂,适当的模块化是很有必要的。。 + +这就需要`add_subdirs`了,将每个子模块放到不同目录中,并为其建立一个新的`xmake.lua`独立去维护它,例如: + +``` +./tbox +├── src +│ ├── demo +│ │ └── xmake.lua (用来描述测试模块) +│ └── tbox +│ └── xmake.lua(用来描述libtbox库模块) +└── xmake.lua(用该描述通用配置信息,以及对子模块的维护) +```` + +在`tbox/xmake.lua`中通过`add_subdirs`将拥有`xmale.lua`的子模块的目录,添加进来,就可以了,例如: + +```lua +-- 添加libtbox库模块目录 +add_subdirs("src/tbox") + +-- 如果xmake f --demo=y,启用了demo模块,那么包含demo目录 +if is_option("demo") then + add_subdirs("src/demo") +end +``` + +默认情况下,xmake会去编译在所有xmake.lua中描述的所有target目标,如果只想编译指定目标,可以执行: + +```bash +# 仅仅编译tbox库模块 +$ xmake tbox + +# 仅仅重新编译demo模块 +$ xmake -r demo +``` + +需要注意的是,每个子`xmake.lua`中所有的路径设置都是相对于当前这个子`xmake.lua`所在的目录的,都是相对路径,这样方便维护 + +##### add_subfiles + +###### 添加子工程文件 + +`add_subfiles`的作用与[add_subdirs](#add_subdirs)类似,唯一的区别就是:这个接口直接指定`xmake.lua`文件所在的路径,而不是目录,例如: + +```lua +add_subfiles("src/tbox/xmake.lua") +``` + +##### add_plugindirs + +###### 添加插件目录 + +xmake内置的插件都是放在`xmake/plugins`目录下,但是对于用户自定义的一些特定工程的插件,如果不想放置在xmake安装目录下,那么可以在`xmake.lua`中进行配置指定的其他插件路径。 + +```lua +-- 将当前工程下的plugins目录设置为自定义插件目录 +add_plugindirs("$(projectdir)/plugins") +``` + +这样,xmake在编译此工程的时候,也就加载这些插件。 + +##### add_packagedirs + +###### 添加包目录 + +通过设置依赖包目录,可以方便的集成一些第三方的依赖库,以tbox工程为例,其包目录如下: + +``` +tbox/pkg +- base.pkg +- zlib.pkg +- polarssl.pkg +- openssl.pkg +- mysql.pkg +- pcre.pkg +- ... +``` + +如果要让当前工程识别加载这些包,首先要指定包目录路径,例如: + +```lua +add_packagedirs("pkg") +``` + +指定好后,就可以在target作用域中,通过[add_packages](#add_packages)接口,来添加集成包依赖了,例如: + +```lua +target("tbox") + add_packages("zlib", "polarssl", "pcre", "mysql") +``` + +#### 工程目标 + +##### target +##### set_kind +##### set_strip +##### set_options +##### set_symbols +##### set_warnings +##### set_optimize +##### set_languages +##### set_headerdir +##### set_targetdir +##### set_objectdir +##### on_build +##### on_clean +##### on_package +##### on_install +##### on_uninstall +##### on_run +##### before_build +##### before_clean +##### before_package +##### before_install +##### before_uninstall +##### before_run +##### after_build +##### after_clean +##### after_package +##### after_install +##### after_uninstall +##### after_run +##### set_config_h +##### set_config_h_prefix +##### add_deps +##### add_links +##### add_files +##### add_headers +##### add_linkdirs +##### add_includedirs +##### add_defines +##### add_undefines +##### add_defines_h +##### add_undefines_h +##### add_cflags +##### add_cxflags +##### add_cxxflags +##### add_mflags +##### add_mxflags +##### add_mxxflags +##### add_ldflags +##### add_arflags +##### add_shflags +##### add_cfuncs +##### add_cxxfuncs +##### add_options +##### add_packages +##### add_languages +##### add_vectorexts + +#### 选项定义 + +##### option +##### set_enable +##### set_showmenu +##### set_category +##### set_warnings +##### set_optimize +##### set_languages +##### set_description +##### add_bindings +##### add_rbindings +##### add_links +##### add_linkdirs +##### add_includedirs +##### add_cincludes +##### add_cxxincludes +##### add_cfuncs +##### add_cxxfuncs +##### add_ctypes +##### add_cxxtypes +##### add_cflags +##### add_cxflags +##### add_cxxflags +##### add_ldflags +##### add_vectorexts +##### add_defines +##### add_defines_if_ok +##### add_defines_h_if_ok +##### add_undefines +##### add_undefines_if_ok +##### add_undefines_h_if_ok + +#### 插件任务 + +##### task +##### set_menu +##### set_category +##### on_run + +#### 平台扩展 + +##### platform +##### set_os +##### set_menu +##### set_hosts +##### set_archs +##### set_checker +##### set_tooldirs +##### on_load + +#### 工程模板 + +##### template +##### set_description +##### set_projectdir +##### add_macros +##### add_macrofiles diff --git a/docs/zh/plugins.md b/docs/zh/plugins.md index d40f208e6..8704ca86c 100755 --- a/docs/zh/plugins.md +++ b/docs/zh/plugins.md @@ -102,9 +102,11 @@ target("demo") end) ``` -## 宏记录和回放 +## 内置插件 -#### 简介 +#### 宏记录和回放 + +##### 简介 我们可以通过这个插件,快速记录和回放我们平常频繁使用到的一些xmake操作,来简化我们日常的开发工作。 @@ -117,7 +119,7 @@ target("demo") * 支持宏脚本的删除、显示等管理功能 * 支持自定义高级宏脚本,以及参数配置 -#### 记录操作 +##### 记录操作 ```bash # 开始记录宏 @@ -145,14 +147,14 @@ $ xmake p xmake macro --end ``` -#### 回放 +##### 回放 ```bash # 回放一个匿名宏 $ xmake macro . ``` -#### 命名宏 +##### 命名宏 匿名宏的好处就是快速记录,快速回放,如果需要长久保存,就需要给宏取个名字。 @@ -163,7 +165,7 @@ $ xmake macro --end macroname $ xmake macro macroname ``` -#### 导入导出宏 +##### 导入导出宏 导入指定的宏脚本或者宏目录: @@ -179,7 +181,7 @@ $ xmake macro --export=/xxx/macro.lua macroname $ xmake macro --export=/xxx/macrodir ``` -#### 列举显示宏 +##### 列举显示宏 列举所有`xmake`内置的宏脚本: @@ -193,7 +195,7 @@ $ xmake macro --list $ xmake macro --show macroname ``` -#### 自定义宏脚本 +##### 自定义宏脚本 我们也可以自己编写个宏脚本 `macro.lua` 然后导入到xmake中去。 @@ -230,7 +232,7 @@ $ xmake macro --import=/xxx/macro.lua [macroname] $ xmake macro [.|macroname] ``` -#### 内置的宏脚本 +##### 内置的宏脚本 XMake 提供了一些内置的宏脚本,来简化我们的日常开发工作。 @@ -240,7 +242,7 @@ XMake 提供了一些内置的宏脚本,来简化我们的日常开发工作� $ xmake macro package -p iphoneos ``` -#### 高级的宏脚本编写 +##### 高级的宏脚本编写 以上面提到的`package`宏为例,我们看下其具体代码,里面通过`import`导入一些扩展模块,实现了复杂的脚本操作。 @@ -345,7 +347,7 @@ end 如果你想要获取更多宏参数选项信息,请运行: `xmake macro --help` </p> -## 运行自定义lua脚本 +#### 运行自定义lua脚本 这个跟宏脚本类似,只是省去了导入导出操作,直接指定lua脚本来加载运行,这对于想要快速测试一些接口模块,验证自己的某些思路,都是一个不错的方式。 @@ -367,9 +369,9 @@ $ xmake lua /tmp/test.lua 当然,你也可以像宏脚本那样,使用`import`接口导入扩展模块,实现复杂的功能。 </p> -## 生成IDE工程文件 +#### 生成IDE工程文件 -#### 简介 +##### 简介 XMake跟`cmake`, `premake`等其他一些构建工具的区别在于: @@ -379,19 +381,19 @@ XMake跟`cmake`, `premake`等其他一些构建工具的区别在于: 这样做的一个好处是:插件更加容易扩展,维护也更加独立和方便。 -#### 生成Makefile +##### 生成Makefile ```bash $ xmake project -k makefile ``` -#### 生成VisualStudio工程 +##### 生成VisualStudio工程 ```bash $ xmake project -k [vs2008|vs2013|vs2015|..] ``` -## 生成doxygen文档 +#### 生成doxygen文档 请先确保本机已安装`doxygen`工具,然后在工程目录下运行: @@ -399,7 +401,7 @@ $ xmake project -k [vs2008|vs2013|vs2015|..] $ xmake doxygen ``` -## 从app生成ipa包 +#### 从app生成ipa包 这仅仅是一个小插件,ios开发的同学,可能会用的到。 |
