update README

This commit is contained in:
2024-08-11 19:15:56 +02:00
parent f1fed86329
commit 9176aee8b6

View File

@@ -1,7 +1,6 @@
# Blitz3
This project is used to compile a GDExtension (godot engine cpp extension), and try to use xmake to manage the project. The best FPS you've ever seen !
Forked from [Github](https://github.com/chaosddp/gdextension-cpp-xmake-template)
## Install xmake ## Install xmake
@@ -9,54 +8,27 @@ Install xmake from [here](https://xmake.io/#/guide/installation).
## How to use ## How to use
You must have godot in your path You must have [godot](https://godotengine.org/) in your path
First modify the *xmake.lua* to change the project name, and other configurations as needed.
```lua
-- project name, this will be the output shared library name
PROJECT_NAME = "gdexample"
-- project version
VERSION = "0.0.1"
-- where is the godot project saved, default is "demo"
GODOT_PROJECT_FOLDER = "demo"
-- where to save the export project, default is "publish"
PUBLISH_FOLDER = "publish"
```
After change the configurations, you can run the following commands to build, run and export.
```sh ```sh
# 1. gen gdextension file (only once) # 1. build the project
xmake gengdextension xmake f -m debug && xmake
# 2. build the project # 2. open the editor at least once
xmake
# 3. open the editor at least once (works only in debug mode)
xmake run Editor xmake run Editor
# 4. run the demo (works only in debug mode) # 3. run the demo
xmake run xmake run
# 5. export the project, the executable will be under "publish" folder by default # 4. export the project, the executable will be under "publish" folder by default
xmake p xmake p
# 6. clean the build and publish # 5. clean the build and publish
xmake clean xmake clean
# 7. generate a class that inherits from godot class, like Sprite2D # 6. generate a class that inherits from godot class, like Sprite2D
# by default the generated files will save under "src" folder, you can change it by -d folder/under/src # by default the generated files will save under "src" folder, you can change it by -d folder/under/src
xmake ext-class -n MySprite2D -b Sprite2D -s myexample1 -d sample xmake ext-class -n MySprite2D -b Sprite2D -s myexample1 -d sample
``` ```
For better support in vscode, you can use command "Xmake: UpdateIntellisense" to generate *compile_commands.json*, then update "compileCommands" field in *c_cpp_properties.json* to point to the file.
NOTE: not tested on other platforms except windows and linux.