Skip to content

Commit 420378e

Browse files
committed
update docs
1 parent 56c29b3 commit 420378e

File tree

10 files changed

+380
-3
lines changed

10 files changed

+380
-3
lines changed

docs/api/description/builtin-policies.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,14 @@ We can also turn it on quickly via the command line option.
268268
$ xmake f --policies=build.optimization.lto
269269
```
270270
271+
## build.c++.dynamic_debugging <Badge type="tip" text="v3.0.6" />
272+
273+
Enable C++ Dynamic Debugging for MSVC (requires MSVC toolset 14.44+, x64 only, incompatible with LTCG/PGO/OPT-ICF).
274+
275+
```lua
276+
set_policy("build.c++.dynamic_debugging", true)
277+
```
278+
271279
## build.cuda.devlink <Badge type="tip" text="v2.7.7" />
272280
273281
Version 2.7.7 can be configured to show that device links to specific targets are turned on.

docs/api/description/builtin-rules.md

Lines changed: 87 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,11 +324,49 @@ Used to compile and generate ios/macos applications
324324

325325
```lua
326326
target("test")
327-
     add_rules("xcode.application")
328-
     add_files("src/*.m", "src/**.storyboard", "src/*.xcassets")
329-
     add_files("src/Info.plist")
327+
add_rules("xcode.application")
328+
add_files("src/*.m", "src/**.storyboard", "src/*.xcassets")
329+
add_files("src/Info.plist")
330330
```
331331

332+
## android.native_app
333+
334+
Used to build Android Native applications.
335+
336+
```lua
337+
add_rules("mode.debug", "mode.release")
338+
339+
add_requires("raylib 5.5.0")
340+
341+
target("raydemo_custom_glue")
342+
set_kind("binary")
343+
set_languages("c++17")
344+
add_files("src/main.cpp", "src/android_native_app_glue.c")
345+
add_syslinks("log")
346+
add_packages("raylib")
347+
add_rules("android.native_app", {
348+
android_sdk_version = "35",
349+
android_manifest = "android/AndroidManifest.xml",
350+
android_res = "android/res",
351+
keystore = "android/debug.jks",
352+
keystore_pass = "123456",
353+
package_name = "com.raylib.custom_glue",
354+
native_app_glue = false, -- Disable default glue
355+
logcat_filters = {"raydemo_custom_glue", "raylib"}
356+
})
357+
```
358+
359+
### Parameter Description
360+
361+
- `android_sdk_version`: Set Android SDK version
362+
- `android_manifest`: Set AndroidManifest.xml file path
363+
- `android_res`: Set resource directory
364+
- `keystore`: Set signing keystore file
365+
- `keystore_pass`: Set signing keystore password
366+
- `package_name`: Set package name
367+
- `native_app_glue`: Whether to use the default `android_native_app_glue` library, default is true. If set to false, you need to handle the entry and event loop yourself.
368+
- `logcat_filters`: Set logcat filter keywords
369+
332370
## wdk.env.kmdf
333371

334372
Application of the compilation environment setting of kmdf under WDK, need to cooperate with: `wdk.[driver|binary|static|shared]` and other rules to use.
@@ -616,6 +654,52 @@ cat build/.gens/test/macosx/x86_64/release/rules/c++/bin2c/image.png.h
616654
If you are using a compiler that supports the C23 `#embed` feature (such as clang or gcc), you can also use the `#embed` directive directly to embed binary files. You need to set the C23 language standard first via `set_languages("c23")`, and then use [add_embeddirs](project-target.md#add_embeddirs) to set the search path. This approach is more aligned with the C23 standard and does not require generating additional header files.
617655
:::
618656

657+
## utils.bin2obj
658+
659+
New rule added in v3.0.6 to convert binary files to object files and link them into the target program.
660+
661+
Compared to `utils.bin2c`, it generates object files directly, skipping the generation of C header files, so it is faster when dealing with large files.
662+
663+
For example, embedding a 120MB file:
664+
- `utils.bin2c`: 354s
665+
- `utils.bin2obj`: 1.8s
666+
667+
### Usage
668+
669+
```lua
670+
target("myapp")
671+
set_kind("binary")
672+
add_rules("utils.bin2obj", {extensions = {".bin", ".ico"}})
673+
add_files("src/*.c")
674+
-- Embed data.bin and ensure it is zero-terminated
675+
add_files("assets/data.bin", {zeroend = true})
676+
```
677+
678+
### Access Data
679+
680+
In C/C++ code, we can access the embedded data via symbols. The symbol name generation rule is: `_binary_<filename>_start` and `_binary_<filename>_end`.
681+
Non-alphanumeric characters in the filename are replaced with underscores.
682+
683+
```c
684+
#include <stdio.h>
685+
#include <stdint.h>
686+
687+
extern const uint8_t _binary_data_bin_start[];
688+
extern const uint8_t _binary_data_bin_end[];
689+
690+
int main() {
691+
// Calculate size
692+
const uint32_t size = (uint32_t)(_binary_data_bin_end - _binary_data_bin_start);
693+
694+
// Access data
695+
printf("Data size: %u bytes\n", size);
696+
for (uint32_t i = 0; i < size; i++) {
697+
printf("%02x ", _binary_data_bin_start[i]);
698+
}
699+
return 0;
700+
}
701+
```
702+
619703
## utils.glsl2spv
620704

621705
This rule can be used in v2.6.1 and above. Import glsl shader files such as `*.vert/*.frag` into the project, and then realize automatic compilation to generate `*.spv` files.

docs/api/scripts/extension-modules/core/base/tty.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,37 @@ local term = tty.term()
442442
print("Terminal:", term) -- Output: "xterm", "vscode", etc.
443443
```
444444

445+
## tty.session_id
446+
447+
- Get terminal session ID
448+
449+
#### Function Prototype
450+
451+
::: tip API
452+
```lua
453+
tty.session_id()
454+
```
455+
:::
456+
457+
#### Parameter Description
458+
459+
No parameters
460+
461+
#### Return Value
462+
463+
| Type | Description |
464+
|------|-------------|
465+
| string | Returns the terminal session ID |
466+
467+
#### Usage
468+
469+
```lua
470+
import("core.base.tty")
471+
472+
local session_id = tty.session_id()
473+
print("Session ID:", session_id)
474+
```
475+
445476
## tty.has_emoji
446477

447478
- Check if terminal supports emoji

docs/guide/extensions/builtin-plugins.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -722,6 +722,9 @@ This plug-in can help users quickly generate installation packages and source co
722722
- RPM binary installation package
723723
- SRPM source code installation package
724724
- DEB binary installation package
725+
- MacOS App Bundle (Dmg)
726+
- Linux AppImage installation package
727+
- Qt installation package
725728
726729
Here is a complete example, we can take a brief look at it first:
727730
@@ -1033,6 +1036,58 @@ xpack("test")
10331036
-- TODO
10341037
```
10351038
1039+
### Generate MacOS App Bundle (Dmg) <Badge type="tip" text="v3.0.6" />
1040+
1041+
```lua
1042+
xpack("test")
1043+
set_formats("dmg")
1044+
add_targets("demo")
1045+
```
1046+
1047+
### Generate AppImage installation package <Badge type="tip" text="v3.0.6" />
1048+
1049+
Requires `appimagetool` to be installed.
1050+
1051+
```lua
1052+
xpack("test")
1053+
set_formats("appimage")
1054+
add_targets("demo")
1055+
```
1056+
1057+
### Generate Qt installation package <Badge type="tip" text="v3.0.6" />
1058+
1059+
We support generating Qt installation packages, such as `qtinstaller`, `qtdmg`, `qtzip`, etc. It will automatically call `windeployqt`/`macdeployqt`/`linuxdeployqt` to deploy the required Qt libraries.
1060+
1061+
#### Open Installer Framework (Qt)
1062+
1063+
Requires `Qt` SDK to be installed.
1064+
1065+
```lua
1066+
xpack("test")
1067+
set_formats("qtinstaller")
1068+
add_targets("demo")
1069+
```
1070+
1071+
#### Drag-and-Drop (Qt)
1072+
1073+
Requires `Qt` SDK to be installed.
1074+
1075+
```lua
1076+
xpack("test")
1077+
set_formats("qtdmg")
1078+
add_targets("demo")
1079+
```
1080+
1081+
#### Zip (Qt)
1082+
1083+
Requires `Qt` SDK to be installed.
1084+
1085+
```lua
1086+
xpack("test")
1087+
set_formats("qtzip")
1088+
add_targets("demo")
1089+
```
1090+
10361091
### Packaging command
10371092
10381093
#### Specify packaging format

docs/posts/xmake-update-v3.0.6.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,16 @@ $ xmake check syntax
165165

166166
If there are syntax errors, it will report the specific file and line number.
167167

168+
### MSVC C++ Dynamic Debugging
169+
170+
We have added support for C++ dynamic debugging in MSVC (requires MSVC toolset 14.44+, x64 only).
171+
172+
It is incompatible with LTCG/PGO/OPT-ICF.
173+
174+
```lua
175+
set_policy("build.c++.dynamic_debugging", true)
176+
```
177+
168178
---
169179

170180
## Changelog

docs/zh/api/description/builtin-policies.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,14 @@ set_policy("build.optimization.lto", true)
261261
$ xmake f --policies=build.optimization.lto
262262
```
263263
264+
## build.c++.dynamic_debugging <Badge type="tip" text="v3.0.6" />
265+
266+
启用 MSVC 的 C++ 动态调试功能(需要 MSVC 工具集 14.44+,仅 x64,与 LTCG/PGO/OPT-ICF 不兼容)。
267+
268+
```lua
269+
set_policy("build.c++.dynamic_debugging", true)
270+
```
271+
264272
## build.cuda.devlink <Badge type="tip" text="v2.7.7" />
265273
266274
2.7.7 版本可以通过这个配置,显示开启对特定目标的设备链接。

docs/zh/api/description/builtin-rules.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,44 @@ target("test")
332332
add_files("src/Info.plist")
333333
```
334334

335+
## android.native_app
336+
337+
用于构建 Android Native 应用程序。
338+
339+
```lua
340+
add_rules("mode.debug", "mode.release")
341+
342+
add_requires("raylib 5.5.0")
343+
344+
target("raydemo_custom_glue")
345+
set_kind("binary")
346+
set_languages("c++17")
347+
add_files("src/main.cpp", "src/android_native_app_glue.c")
348+
add_syslinks("log")
349+
add_packages("raylib")
350+
add_rules("android.native_app", {
351+
android_sdk_version = "35",
352+
android_manifest = "android/AndroidManifest.xml",
353+
android_res = "android/res",
354+
keystore = "android/debug.jks",
355+
keystore_pass = "123456",
356+
package_name = "com.raylib.custom_glue",
357+
native_app_glue = false, -- 禁用默认 glue
358+
logcat_filters = {"raydemo_custom_glue", "raylib"}
359+
})
360+
```
361+
362+
### 参数说明
363+
364+
- `android_sdk_version`: 设置 Android SDK 版本
365+
- `android_manifest`: 设置 AndroidManifest.xml 文件路径
366+
- `android_res`: 设置资源目录
367+
- `keystore`: 设置签名密钥文件
368+
- `keystore_pass`: 设置签名密钥密码
369+
- `package_name`: 设置包名
370+
- `native_app_glue`: 是否使用默认的 `android_native_app_glue` 库,默认为 true。如果设置为 false,则需要自己处理入口和事件循环。
371+
- `logcat_filters`: 设置 logcat 过滤关键字
372+
335373
## wdk.env.kmdf
336374

337375
应用WDK下kmdf的编译环境设置,需要配合:`wdk.[driver|binary|static|shared]`等规则来使用。
@@ -605,6 +643,53 @@ cat build/.gens/test/macosx/x86_64/release/rules/c++/bin2c/image.png.h
605643
如果你使用支持 C23 `#embed` 特性的编译器(如 clang 或 gcc),也可以直接使用 `#embed` 指令来嵌入二进制文件。需要先通过 `set_languages("c23")` 设置 C23 语言标准,然后使用 [add_embeddirs](project-target.md#add_embeddirs) 来设置搜索路径。这种方式更符合 C23 标准,无需生成额外的头文件。
606644
:::
607645

646+
## utils.bin2obj
647+
648+
v3.0.6 以上版本可以使用此规则,相比 `utils.bin2c` 具有极快的构建速度。因为它跳过了 C 代码生成和编译步骤,直接生成对象文件(COFF, ELF, Mach-O)参与链接。
649+
650+
**性能对比 (120MB 文件):**
651+
- **bin2obj**: ~1.8s
652+
- **bin2c**: ~354s
653+
654+
它支持多种架构(x86, ARM, RISC-V 等)和格式(Windows COFF, Linux/Android ELF, macOS/iOS Mach-O)。
655+
656+
**基本用法**
657+
658+
```lua
659+
target("myapp")
660+
set_kind("binary")
661+
add_rules("utils.bin2obj", {extensions = {".bin", ".ico"}})
662+
add_files("src/*.c")
663+
-- 嵌入 data.bin,并确保以零结尾
664+
add_files("assets/data.bin", {zeroend = true})
665+
```
666+
667+
**在 C/C++ 中访问数据**
668+
669+
符号名称会根据文件名自动生成(例如 `_binary_<filename>_start``_binary_<filename>_end`)。
670+
671+
```c
672+
#include <stdio.h>
673+
#include <stdint.h>
674+
675+
extern const uint8_t _binary_data_bin_start[];
676+
extern const uint8_t _binary_data_bin_end[];
677+
678+
int main() {
679+
// 计算大小
680+
const uint32_t size = (uint32_t)(_binary_data_bin_end - _binary_data_bin_start);
681+
682+
// 访问数据
683+
printf("Data size: %u bytes\n", size);
684+
for (uint32_t i = 0; i < size; i++) {
685+
printf("%02x ", _binary_data_bin_start[i]);
686+
}
687+
return 0;
688+
}
689+
```
690+
691+
此外,`glsl2spv``hlsl2spv` 规则也新增了对 `bin2obj` 的支持,可以直接将编译后的 SPIR-V 文件作为对象文件嵌入。
692+
608693
## utils.glsl2spv
609694

610695
v2.6.1 以上版本可以使用此规则,在项目中引入 `*.vert/*.frag` 等 glsl shader 文件,然后实现自动编译生成 `*.spv` 文件。

docs/zh/api/scripts/extension-modules/core/base/tty.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,37 @@ local term = tty.term()
442442
print("终端:", term) -- 输出: "xterm"、"vscode" 等
443443
```
444444

445+
## tty.session_id
446+
447+
- 获取终端会话 ID
448+
449+
#### 函数原型
450+
451+
::: tip API
452+
```lua
453+
tty.session_id()
454+
```
455+
:::
456+
457+
#### 参数说明
458+
459+
无参数
460+
461+
#### 返回值说明
462+
463+
| 类型 | 描述 |
464+
|------|------|
465+
| string | 返回终端会话 ID |
466+
467+
#### 用法说明
468+
469+
```lua
470+
import("core.base.tty")
471+
472+
local session_id = tty.session_id()
473+
print("会话 ID:", session_id)
474+
```
475+
445476
## tty.has_emoji
446477

447478
- 检查终端是否支持表情符号

0 commit comments

Comments
 (0)