diff options
| author | ruki <[email protected]> | 2017-03-01 09:10:14 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2017-03-01 09:10:14 +0800 |
| commit | 4ddc67536933d296e667bd17f2dfe405d62da7a8 (patch) | |
| tree | f779ff9f20eb37ebe2854d98552792ba84e9d1db /docs | |
| parent | 1225d9f10e8ca107ca6a4bcba0da9cea357e12ab (diff) | |
modfiy docs
Diffstat (limited to 'docs')
| -rw-r--r-- | docs/README.md | 16 | ||||
| -rw-r--r-- | docs/cn/index.html | 7 | ||||
| -rw-r--r-- | docs/landing.html | 7 | ||||
| -rwxr-xr-x | docs/landing/index.cn.md | 5 | ||||
| -rwxr-xr-x | docs/landing/index.md | 5 | ||||
| -rwxr-xr-x | docs/zh/README.md | 16 | ||||
| -rwxr-xr-x | docs/zh/manual.md | 153 |
7 files changed, 192 insertions, 17 deletions
diff --git a/docs/README.md b/docs/README.md index e668a4df9..80cec9355 100644 --- a/docs/README.md +++ b/docs/README.md @@ -46,13 +46,13 @@ $ sudo ./install  -#### Create Empty Project +#### Create Project ```bash -$ xmake create -P ./hello +$ xmake create -l c -P ./hello ``` -And xmake will generate some files: +And xmake will generate some files for c language project: ``` hello @@ -71,6 +71,16 @@ target("hello") add_files("src/*.c") ``` +Support languages: + +* c/c++ +* objc/c++ +* asm +* swift +* dlang +* golang +* rust + <p class="tip"> If you want to known more options, please run: `xmake create --help` </p> diff --git a/docs/cn/index.html b/docs/cn/index.html index e6a648ece..267cdae5b 100644 --- a/docs/cn/index.html +++ b/docs/cn/index.html @@ -105,6 +105,9 @@ <li>Objc/Objc++</li> <li>Swift</li> <li>Assembly</li> + <li>Golang</li> + <li>Rust</li> + <li>Dlang</li> </ul> <h2 id="section-7">内置插件</h2> @@ -112,7 +115,7 @@ <ul> <li>宏记录脚本和回放插件</li> <li>加载自定义lua脚本插件</li> - <li>生成IDE工程文件插件(makefile, vs2002 - vs2015, …)</li> + <li>生成IDE工程文件插件(makefile, vs2002 - vs2017, …)</li> <li>生成doxygen文档插件</li> <li>iOS app2ipa插件</li> </ul> @@ -127,7 +130,7 @@ <li>邮箱:<a href="mailto:[email protected]">[email protected]</a></li> <li>主页:<a href="http://www.tboox.org/cn">TBOOX开源工程</a></li> <li>社区:<a href="http://www.tboox.org/forum">TBOOX开源社区</a></li> - <li>聊天:<a href="https://gitter.im/waruqi/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/waruqi/tboox.svg" alt="Join the chat at https://gitter.im/waruqi/tboox" /></a></li> + <li>聊天:<a href="https://gitter.im/tboox/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/tboox/tboox.svg" alt="Join the chat at https://gitter.im/tboox/tboox" /></a></li> <li>QQ群:343118190</li> <li>微信公众号:tboox-os</li> </ul> diff --git a/docs/landing.html b/docs/landing.html index 3f413097d..7735e5bb6 100644 --- a/docs/landing.html +++ b/docs/landing.html @@ -105,6 +105,9 @@ <li>Objc/Objc++</li> <li>Swift</li> <li>Assembly</li> + <li>Golang</li> + <li>Rust</li> + <li>Dlang</li> </ul> <h2 id="builtin-plugins">Builtin Plugins</h2> @@ -112,7 +115,7 @@ <ul> <li>Macros script plugin</li> <li>Run the custom lua script plugin</li> - <li>Generate IDE project file plugin(makefile, vs2002 - vs2015 .. )</li> + <li>Generate IDE project file plugin(makefile, vs2002 - vs2017 .. )</li> <li>Generate doxygen document plugin</li> <li>Convert .app to .ipa plugin</li> </ul> @@ -127,7 +130,7 @@ <li>Email:<a href="mailto:[email protected]">[email protected]</a></li> <li>Homepage:<a href="http://www.tboox.org/cn">TBOOX Open Source Project</a></li> <li>Community:<a href="http://www.tboox.org/forum">TBOOX Open Source Community</a></li> - <li>ChatRoom:<a href="https://gitter.im/waruqi/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/waruqi/tboox.svg" alt="Join the chat at https://gitter.im/waruqi/tboox" /></a></li> + <li>ChatRoom:<a href="https://gitter.im/tboox/tboox?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge"><img src="https://badges.gitter.im/tboox/tboox.svg" alt="Join the chat at https://gitter.im/tboox/tboox" /></a></li> </ul> diff --git a/docs/landing/index.cn.md b/docs/landing/index.cn.md index f57ac8327..9c3189443 100755 --- a/docs/landing/index.cn.md +++ b/docs/landing/index.cn.md @@ -54,12 +54,15 @@ $ xmake run -d console * Objc/Objc++ * Swift * Assembly +* Golang +* Rust +* Dlang ## 内置插件 * 宏记录脚本和回放插件 * 加载自定义lua脚本插件 -* 生成IDE工程文件插件(makefile, vs2002 - vs2015, ...) +* 生成IDE工程文件插件(makefile, vs2002 - vs2017, ...) * 生成doxygen文档插件 * iOS app2ipa插件 diff --git a/docs/landing/index.md b/docs/landing/index.md index e1e8ac58d..647bb6ea1 100755 --- a/docs/landing/index.md +++ b/docs/landing/index.md @@ -54,12 +54,15 @@ $ xmake run -d console * Objc/Objc++ * Swift * Assembly +* Golang +* Rust +* Dlang ## Builtin Plugins * Macros script plugin * Run the custom lua script plugin -* Generate IDE project file plugin(makefile, vs2002 - vs2015 .. ) +* Generate IDE project file plugin(makefile, vs2002 - vs2017 .. ) * Generate doxygen document plugin * Convert .app to .ipa plugin diff --git a/docs/zh/README.md b/docs/zh/README.md index 600af4f16..03f70e89a 100755 --- a/docs/zh/README.md +++ b/docs/zh/README.md @@ -53,12 +53,12 @@ $ sudo ./install  -#### 创建空工程 +#### 创建工程 -创建一个名叫`hello`的控制台工程: +创建一个名叫`hello`的`c`控制台工程: ```bash -$ xmake create -P ./hello +$ xmake create -l c -P ./hello ``` 执行完后,将会生成一个简单工程结构: @@ -78,6 +78,16 @@ target("hello") add_files("src/*.c") ``` +目前支持的语言如下: + +* c/c++ +* objc/c++ +* asm +* swift +* dlang +* golang +* rust + <p class="tip"> 如果你想了解更多参数选项,请运行: `xmake create --help` </p> diff --git a/docs/zh/manual.md b/docs/zh/manual.md index 958ad5fdf..a91466e21 100755 --- a/docs/zh/manual.md +++ b/docs/zh/manual.md @@ -458,7 +458,7 @@ target("test2") | [add_mxxflags](#targetadd_mxxflags) | 添加objc++编译选项 | >= 1.0.1 | | [add_scflags](#targetadd_scflags) | 添加swift编译选项 | >= 2.0.1 | | [add_asflags](#targetadd_asflags) | 添加汇编编译选项 | >= 2.0.1 | -| [add_goflags](#targetadd_goflags) | 添加go编译选项 | >= 2.1.1 | +| [add_gcflags](#targetadd_gcflags) | 添加go编译选项 | >= 2.1.1 | | [add_ldflags](#targetadd_ldflags) | 添加链接选项 | >= 1.0.1 | | [add_arflags](#targetadd_arflags) | 添加静态库归档选项 | >= 1.0.1 | | [add_shflags](#targetadd_shflags) | 添加动态库链接选项 | >= 1.0.1 | @@ -1374,14 +1374,34 @@ add_scflags("xxx") add_asflags("xxx") ``` -##### target:add_goflags +##### target:add_gcflags ###### 添加go编译选项 对golang代码添加编译选项 ```lua -add_goflags("xxx") +add_gcflags("xxx") +``` + +##### target:add_dcflags + +###### 添加dlang编译选项 + +对dlang代码添加编译选项 + +```lua +add_dcflags("xxx") +``` + +##### target:add_rcflags + +###### 添加rust编译选项 + +对rust代码添加编译选项 + +```lua +add_rcflags("xxx") ``` ##### target:add_ldflags @@ -1689,7 +1709,9 @@ option("test2") | [add_mxxflags](#targetadd_mxxflags) | 添加objc++编译选项 | >= 2.0.1 | | [add_scflags](#targetadd_scflags) | 添加swift编译选项 | >= 2.1.1 | | [add_asflags](#targetadd_asflags) | 添加汇编编译选项 | >= 2.1.1 | -| [add_goflags](#targetadd_goflags) | 添加go编译选项 | >= 2.1.1 | +| [add_gcflags](#targetadd_gcflags) | 添加go编译选项 | >= 2.1.1 | +| [add_dcflags](#targetadd_dcflags) | 添加dlang编译选项 | >= 2.1.1 | +| [add_rcflags](#targetadd_rcflags) | 添加rust编译选项 | >= 2.1.1 | | [add_ldflags](#targetadd_ldflags) | 添加链接选项 | >= 2.1.1 | | [add_arflags](#targetadd_arflags) | 添加静态库归档选项 | >= 2.1.1 | | [add_shflags](#targetadd_shflags) | 添加动态库链接选项 | >= 2.0.1 | @@ -2392,7 +2414,6 @@ task.run("hello", {color="red"}, arg1, arg2, arg3) 更加详细的`task.run`描述,见:[task.run](#task-run) - #### 平台扩展 xmake除了内置的一些构建平台,还可以自己扩展自定义构建平台,可以将自己实现的平台放置在以下目录即可, xmake会自动检测并且加载他们: @@ -2432,6 +2453,7 @@ platforms | [set_hosts](#platformset_hosts) | 设置平台支持的主机环境 | >= 2.0.1 | | [set_archs](#platformset_archs) | 设置平台支持的架构环境 | >= 2.0.1 | | [set_tooldirs](#platformset_tooldirs) | 设置平台工具的搜索目录 | >= 2.0.1 | +| [on_load](#platformon_load) | 设置加载平台环境配置脚本 | >= 2.0.1 | | [on_check](#platformon_check) | 设置平台工具的检测脚本 | >= 2.0.1 | | [on_install](#platformon_install) | 设置平台相关的工程目标安装脚本 | >= 2.0.5 | | [on_uninstall](#platformon_uninstall) | 设置平台相关的工程目标卸载脚本 | >= 2.0.5 | @@ -2572,12 +2594,133 @@ platform("android") ``` ##### set_archs + +###### 设置平台支持的架构环境 + +用来设置当前目标平台支持的编译架构环境,例如`iphoneos`平台可以构建`armv7`, `armv7s`, `arm64`, `i386`, `x86_64`等架构,那么可以设置为: + +```lua +platform("iphoneos") + set_archs("armv7", "armv7s", "arm64", "i386", "x86_64") +``` + +配置好架构后,执行:`xmake f -h`,就会在对应arch参数描述,自动显示设置的架构列表: + +``` + -a ARCH, --arch=ARCH Compile for the given architecture. (default: auto) + - android: armv5te armv6 armv7-a armv8-a arm64-v8a + - iphoneos: armv7 armv7s arm64 i386 x86_64 + - linux: i386 x86_64 + - macosx: i386 x86_64 + - mingw: i386 x86_64 + - watchos: armv7k i386 + - windows: x86 x64 amd64 x86_amd64 +``` + ##### set_tooldirs + +###### 设置平台工具的搜索目录 + +xmake会自动检测当前平台支持的一些构建工具是否存在,例如编译器、链接器等,如果要提高检测通过率,可以在平台配置的时候,设置一些工具环境搜索目录,例如: + +```lua +platform("linux") + + -- 在linux下检测这些目录环境 + set_tooldirs("/usr/bin", "/usr/local/bin", "/opt/bin", "/opt/local/bin") +``` + ##### on_load + +###### 设置加载平台环境配置脚本 + +一般用于在平台刚加载时,设置一些基本配置:生成目标文件命名格式、平台相关编译选项等 + +```lua +platform("windows") + + -- on load + on_load(function () + + -- init the file formats + _g.formats = {} + _g.formats.static = {"", ".lib"} + _g.formats.object = {"", ".obj"} + _g.formats.shared = {"", ".dll"} + _g.formats.binary = {"", ".exe"} + _g.formats.symbol = {"", ".pdb"} + + -- init flags for dlang + local dc_archs = { x86 = "-m32", x64 = "-m64", amd64 = "-m64", x86_amd64 = "-m64" } + _g.dcflags = { dc_archs[arch] or "" } + _g["dc-shflags"] = { dc_archs[arch] or "" } + _g["dc-ldflags"] = { dc_archs[arch] or "" } + + -- ok + return _g + end) +``` + +如果加载逻辑比较复杂,可以独立成单独`init.lua`文件,然后设置为: + +```lua +platform("xxxx") + on_load("init") +``` + +通过这种方式,会自动加载平台脚本目录下对应的`init.lua`文件,调用`function main() end`函数入口,完成复杂加载逻辑。 + ##### on_check + +##### 设置平台工具的检测脚本 + +由于每个平台检测的工具非常多,脚本比较复杂,一般直接独立成`check.lua`文件来实现检测逻辑,例如: + +```lua +platform("xxx") + on_check("check") +``` + +具体的检测代码入口如下: + +```lua +-- check it +function main(kind) + + -- init the check list of config + _g.config = + { + __check_arch + , checker.check_ccache + , _check_toolchains + } + + -- init the check list of global + _g.global = + { + checker.check_ccache + , _check_ndk_sdkver + } + + -- check it + checker.check(kind, _g) +end +``` + +具体实现这里就不介绍了,可以参考xmake源码目录下的`platforms`平台配置代码: [check.lua](https://github.com/tboox/xmake/blob/master/xmake/platforms/macosx/check.lua) + ##### on_install + +###### 设置目标工程在指定平台的安装脚本 + +具体实现逻辑见xmake源码:[install.lua](https://github.com/tboox/xmake/blob/master/xmake/platforms/macosx/install.lua) + ##### on_uninstall +###### 设置目标工程在指定平台的卸载脚本 + +具体实现逻辑见xmake源码:[uninstall.lua](https://github.com/tboox/xmake/blob/master/xmake/platforms/macosx/uninstall.lua) + #### 语言扩展 ##### language |
