summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorruki <[email protected]>2017-03-14 17:45:09 +0800
committerruki <[email protected]>2017-03-14 17:45:09 +0800
commit5749c784b22bd71490b4219e8eebab9f4927700e (patch)
tree1934aee2f24e4a7225f923bb43e74e9e4e4fb1a7 /docs
parent02582aff7d42b5c731250dceb81f82a749527c7d (diff)
add cross compilation docs for english
Diffstat (limited to 'docs')
-rw-r--r--docs/README.md196
-rwxr-xr-xdocs/zh/README.md2
2 files changed, 191 insertions, 7 deletions
diff --git a/docs/README.md b/docs/README.md
index 29738c7a1..d235a93a9 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -137,6 +137,16 @@ hello`main:
## Configuration
+Set compilation configuration before building project with command `xmake f|config`.
+And if you want to known more options, please run: `xmake f --help`。
+
+<p class="tip">
+ You can use short or long command option, for exmaple: <br>
+ `xmake f` or `xmake config`.<br>
+ `xmake f -p linux` or `xmake config --plat=linux`.<br>
+ `xmake f -p linux -a i386` or `xmake config --plat=linux --arch=i386`.
+</p>
+
#### Target Platforms
##### Current Host
@@ -163,6 +173,20 @@ $ xmake f -p android --ndk=~/files/android-ndk-r10e/ [-a armv5te|armv6|armv7-a|a
$ xmake
```
+If you want to set the other android toolchains, you can use [--toolchains](#-toolchains) option.
+
+For example:
+
+```bash
+$ xmake f -p android --ndk=~/files/android-ndk-r10e/ -a arm64-v8a --toolchains=~/files/android-ndk-r10e/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin
+```
+
+The [--toolchains](#-toolchains) option is used to set `bin` directory of toolchains.
+
+<p class="tip">
+Please attempt to set `--arch=` option if it had failed to check compiler.
+</p>
+
##### iPhoneOS
```bash
@@ -198,15 +222,175 @@ $ xmake f -p linux --sdk=/usr/local/arm-linux-gcc/ [--toolchains=/sdk/bin] [--cr
$ xmake
```
+| Configuration Option | Description |
+| ---------------------------- | -------------------------------------------- |
+| [--sdk](#-sdk) | Set the sdk root directory of toolchains |
+| [--toolchains](#-toolchains) | Set the `bin` directory of toolchains |
+| [--cross](#-cross) | Set the prefix of compilation tools |
+| [--as](#-as) | Set `asm` assembler |
+| [--cc](#-cc) | Set `c` compiler |
+| [--cxx](#-cxx) | Set `c++` compiler |
+| [--mm](#-mm) | Set `objc` compiler |
+| [--mxx](#-mxx) | Set `objc++` compiler |
+| [--sc](#-sc) | Set `swift` compiler |
+| [--gc](#-gc) | Set `golang` compiler |
+| [--dc](#-dc) | Set `dlang` compiler |
+| [--rc](#-rc) | Set `rust` compiler |
+| [--ld](#-ld) | Set `c/c++/objc/asm` linker |
+| [--sh](#-sh) | Set `c/c++/objc/asm` shared library linker |
+| [--ar](#-ar) | Set `c/c++/objc/asm` static library archiver |
+| [--sc-ld](#-sc-ld) | Set `swift` linker |
+| [--sc-sh](#-sc-sh) | Set `swift` shared library linker |
+| [--gc-ld](#-gc-ld) | Set `golang` linker |
+| [--gc-ar](#-gc-ar) | Set `golang` static library archiver |
+| [--dc-ld](#-dc-ld) | Set `dlang` linker |
+| [--dc-sh](#-dc-sh) | Set `dlang` shared library linker |
+| [--dc-ar](#-dc-ar) | Set `dlang` static library archiver |
+| [--rc-ld](#-rc-ld) | Set `rust` linker |
+| [--rc-sh](#-rc-sh) | Set `rust` shared library linker |
+| [--rc-ar](#-rc-ar) | Set `rust` static library archiver |
+| [--asflags](#-asflags) | Set `asm`汇编 compiler option |
+| [--cflags](#-cflags) | Set `c` compiler option |
+| [--cxflags](#-cxflags) | Set `c/c++` compiler option |
+| [--cxxflags](#-cxxflags) | Set `c++` compiler option |
+| [--mflags](#-mflags) | Set `objc` compiler option |
+| [--mxflags](#-mxflags) | Set `objc/c++` compiler option |
+| [--mxxflags](#-mxxflags) | Set `objc++` compiler option |
+| [--scflags](#-scflags) | Set `swift` compiler option |
+| [--gcflags](#-gcflags) | Set `golang` compiler option |
+| [--dcflags](#-dcflags) | Set `dlang` compiler option |
+| [--rcflags](#-rcflags) | Set `rust` compiler option |
+| [--ldflags](#-ldflags) | Set linker option |
+| [--shflags](#-shflags) | Set shared library linker option |
+| [--arflags](#-arflags) | Set static library archiver option |
+
<p class="tip">
- You can use short or long command option, for exmaple: <br>
- `xmake f` or `xmake config`.<br>
- `xmake f -p linux` or `xmake config --plat=linux`.<br>
- `xmake f -p linux -a i386` or `xmake config --plat=linux --arch=i386`.<br>
- <br>
- And if you want to known more options, please run: `xmake f --help`
+if you want to known more options, please run: `xmake f --help`。
</p>
+###### --sdk
+
+- Set the sdk root directory of toolchains
+
+xmake provides a convenient and flexible cross-compiling support.
+In most cases, we need not to configure complex toolchains prefix, for example: `arm-linux-`
+
+As long as this toolchains meet the following directory structure:
+
+```
+/home/toolchains_sdkdir
+ - bin
+ - arm-linux-gcc
+ - arm-linux-ld
+ - ...
+ - lib
+ - libxxx.a
+ - include
+ - xxx.h
+```
+
+Then,we can only configure the sdk directory and build it.
+
+```bash
+$ xmake f -p linux --sdk=/home/toolchains_sdkdir
+$ xmake
+```
+
+xmake will detect the prefix: arm-linux- and add the include and library search directory automatically.
+
+```
+-I/home/toolchains_sdkdir/include -L/home/toolchains_sdkdir/lib
+```
+
+###### --toolchains
+
+- Set the `bin` directory of toolchains
+
+We need set it manually if the toolchains /bin directory is in other places, for example:
+
+```bash
+$ xmake f -p linux --sdk=/home/toolchains_sdkdir --toolchains=/usr/opt/bin
+$ xmake
+```
+
+###### --cross
+
+- Set the prefix of compilation tools
+
+For example, under the same toolchains directory at the same time, there are two different compilers:
+
+```
+/opt/bin
+ - armv7-linux-gcc
+ - aarch64-linux-gcc
+```
+
+If we want to use the `armv7-linux-gcc` compiler, we can run the following command:
+
+```bash
+$ xmake f -p linux --sdk=/usr/toolsdk --toolchains=/opt/bin --cross=armv7-linux-
+```
+
+###### --as
+
+- Set `asm` assembler
+
+```bash
+$ 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.
+
+###### --cc
+
+- Set c compiler
+
+```bash
+$ 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.
+
+###### --cxx
+
+- Set `c++` compiler
+
+```bash
+$ 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.
+
+###### --ld
+
+- Set `c/c++/objc/asm` linker
+
+```bash
+$ 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.
+
+###### --sh
+
+- Set `c/c++/objc/asm` shared library linker
+
+```bash
+$ 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.
+
+###### --ar
+
+- Set `c/c++/objc/asm` static library archiver
+
+```bash
+$ 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.
+
#### Global Configuration
You can save to the global configuration for simplfying operation.
diff --git a/docs/zh/README.md b/docs/zh/README.md
index 86908ff64..03455e8d3 100755
--- a/docs/zh/README.md
+++ b/docs/zh/README.md
@@ -231,7 +231,7 @@ $ xmake
| 参数名 | 描述 |
| ---------------------------- | -------------------------------- |
| [--sdk](#-sdk) | 设置交叉工具链的sdk根目录 |
-| [--toolchains](#-toolchains) | 设置工具链bin目录录 |
+| [--toolchains](#-toolchains) | 设置工具链bin目录 |
| [--cross](#-cross) | 设置交叉工具链工具前缀 |
| [--as](#-as) | 设置`asm`汇编器 |
| [--cc](#-cc) | 设置`c`编译器 |