diff options
author | George L. Albany <Megacake1234@gmail.com> | 2023-01-26 12:23:27 +0100 |
---|---|---|
committer | George L. Albany <Megacake1234@gmail.com> | 2023-01-26 12:23:27 +0100 |
commit | d20ea768a1be4b3a805e68dbe2ea6fd33a108292 (patch) | |
tree | 0613955a85c7970023214051f43a279b7182a54b | |
parent | 1c13eadaa98b68fa64f222781d9160ec94fb884e (diff) |
feat(vscode): Add dev_build task and debugger launcher
feat(git): Ignore clangd cache and user VSCode files
feat(build): Make dev_build=yes overwrite the non-dev_build extension library
feat(docs): Added instructions in README.md to run Godot with our extension and attach a debugger
fix(docs): Corrected README.md Project Export header steps being off
TODO: vscode Debug launch configuration relies on /bin/godot4 in both Windows and Linux PATH, likely should be an environment variable.
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | .vscode/launch.json | 26 | ||||
-rw-r--r-- | .vscode/tasks.json | 14 | ||||
-rw-r--r-- | README.md | 16 | ||||
-rw-r--r-- | SConstruct | 3 |
5 files changed, 61 insertions, 6 deletions
@@ -31,6 +31,14 @@ *.out *.app +# clangd +.cache/* + +# VSCode +.vscode/* +!.vscode/launch.json +!.vscode/tasks.json + # Godot 4+ specific ignores .godot/ game/bin/openvic2/* diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..2cabcf6 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,26 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "type": "cppdbg", + "request": "launch", + "name": "Debug", + "program": "/bin/godot4", // TODO: Godot environment variable? + "args": [], + "cwd": "${workspaceFolder}/game", + "preLaunchTask": "dev_build", + "windows": { + "type": "cppvsdb", + "request": "launch", + "name": "Debug", + "program": "/bin/godot4", // TODO: Common Godot 4 Windows install or Godot environment variable? + "args": [], + "cwd": "${workspaceFolder}\\game", + "preLaunchTask": "dev_build", + } + } + ] +}
\ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 0260cd5..f8bcc92 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -15,6 +15,20 @@ "problemMatcher": "$msCompile" }, { + "label": "dev_build", + "group": "build", + "type": "shell", + "command": "scons", + "args": [ + // enable for debugging with breakpoints + "dev_build=yes" + ], + "dependsOn": [ + "build" + ], + "problemMatcher": "$msCompile" + }, + { "label": "clean", "group": "build", "type": "shell", @@ -14,12 +14,18 @@ Main Repo for the OpenVic2 Project ## Project Export 1. Build the extension with `scons` or `scons target=template_debug`. (or `scons target=template_release` for release) -1. Open `game/project.godot` with Godot 4 Beta 14. -2. Click `Project` at the top left, click `Export`. -3. If you do not have the templates, you must download the templates, there is highlighted white text at the bottom of the Export subwindow that opens up the template manager for you to download. -4. Click `Export All`: +2. Open `game/project.godot` with Godot 4 Beta 14. +3. Click `Project` at the top left, click `Export`. +4. If you do not have the templates, you must download the templates, there is highlighted white text at the bottom of the Export subwindow that opens up the template manager for you to download. +5. Click `Export All`: * If you built with the default or debug target you must export with `Debug`. * If you built with the release target you must export `Release`. -5. Files will be found in platform specific directories in `game/export`: +6. Files will be found in platform specific directories in `game/export`: * On Windows run `game/export/Windows/OpenVic2.exe`. * On Linux x86_64 run `game/export/Linux-x86_64/OpenVic2.sh`. + +## Extension Debugging +1. If in a clean build, build the extension with `scons`. +2. Build with `scons dev_build=yes`. +3. [Setup your IDE](https://godotengine.org/qa/108346/how-can-i-debug-runtime-errors-of-native-library-in-godot) so your Command/Host/Launching App is your Godot 4 binary and the Working Directory is the `game` directory. +4. Start the debugger. @@ -24,8 +24,9 @@ if env["platform"] == "macos": source=sources, ) else: + suffix = ".{}.{}.{}".format(env["platform"], env["target"], env["arch"]) library = env.SharedLibrary( - "game/bin/openvic2/libopenvic2{}{}".format(env["suffix"], env["SHLIBSUFFIX"]), + "game/bin/openvic2/libopenvic2{}{}".format(suffix, env["SHLIBSUFFIX"]), source=sources, ) |