LiteLoaderBDS-1.16.40/Tools/ScriptX/docs/zh/QuickStart.md
2023-03-03 10:18:21 -08:00

46 lines
1.2 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 快速体验
为了能快速体验到ScriptX这里列出运行单测的主要步骤。
因为UnitTest需要具体的 V8/JavaScriptCore/Lua 库笔者已经自行编译了macwindows平台并且配置了单测的CMake文件再编译时自动下载。
如果用CLion的话是最简单的了直接打开 `test/CMakeLists.txt` 即可。
**注意是 test目录下的cmake不是根目录的**
VisualStudio亦可直接打开cmake工程同上。
或者可以以用cmake生成VS工程
```bash
mkdir project
cd project
cmake -G "Visual Studio 15 2017 Win64" path/to/ScriptX/test
# 32 bit
# cmake -G "Visual Studio 15 2017"
```
使用XCode需要用cmake生成一个Xcode工程
```bash
mkdir project
cd project
cmake -G Xcode path/to/ScriptX/test
```
然后运行 UnitTests target即可。
需要注意windows平台的JavaScriptCore只有32位的库。
最后需要选择不同后端可以通过CMake命令行或者修改 `test/cmake/TestEnv.cmake` 文件做到。
### 使用 Demo
单元测试本身可以作为各种API的使用实例。
同时笔者还提供了一个最简化的Demo`test/src/Demo.cc`
该Demo模拟小游戏环境
1. 小游戏引擎向JS注入宿主能力
2. 小游戏引擎注入基础库
3. 执行游戏脚本