From 3f454d142d18bcde67062b7c4b476926b3a3cefe Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 14 Dec 2023 19:42:29 +0000 Subject: [PATCH 1/4] Bump actions/upload-artifact from 3 to 4 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 3 to 4. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] (cherry picked from commit b17e668c15ec14b3b56cc4f1ce9199bf17467dc6) --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b5c24530f..8b526b9d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -175,7 +175,7 @@ jobs: ./run-tests.sh - name: Upload artifact - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: ${{ matrix.artifact-name }} path: ${{ matrix.artifact-path }} From 2dee0cc4decaf657079eec42b9ba77e1746269a7 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Thu, 20 Feb 2025 09:23:08 -0600 Subject: [PATCH 2/4] Style: Replace `_NO_DISCARD_` macro with `[[nodiscard]]` (cherry picked from commit 89fd27608fa9d10194cac76d19c7df4b92cbff30) --- include/godot_cpp/core/defs.hpp | 4 ---- include/godot_cpp/variant/aabb.hpp | 2 +- include/godot_cpp/variant/basis.hpp | 2 +- include/godot_cpp/variant/color.hpp | 2 +- include/godot_cpp/variant/plane.hpp | 2 +- include/godot_cpp/variant/projection.hpp | 2 +- include/godot_cpp/variant/quaternion.hpp | 2 +- include/godot_cpp/variant/rect2.hpp | 2 +- include/godot_cpp/variant/rect2i.hpp | 2 +- include/godot_cpp/variant/transform2d.hpp | 2 +- include/godot_cpp/variant/transform3d.hpp | 2 +- include/godot_cpp/variant/vector2.hpp | 2 +- include/godot_cpp/variant/vector2i.hpp | 2 +- include/godot_cpp/variant/vector3.hpp | 2 +- include/godot_cpp/variant/vector3i.hpp | 2 +- include/godot_cpp/variant/vector4.hpp | 2 +- include/godot_cpp/variant/vector4i.hpp | 2 +- 17 files changed, 16 insertions(+), 20 deletions(-) diff --git a/include/godot_cpp/core/defs.hpp b/include/godot_cpp/core/defs.hpp index 5b985ffc3..07ce14d3d 100644 --- a/include/godot_cpp/core/defs.hpp +++ b/include/godot_cpp/core/defs.hpp @@ -74,10 +74,6 @@ namespace godot { #endif #endif -#ifndef _NO_DISCARD_ -#define _NO_DISCARD_ [[nodiscard]] -#endif - // Windows badly defines a lot of stuff we'll never use. Undefine it. #ifdef _WIN32 #undef min // override standard definition diff --git a/include/godot_cpp/variant/aabb.hpp b/include/godot_cpp/variant/aabb.hpp index b827112af..46eaca961 100644 --- a/include/godot_cpp/variant/aabb.hpp +++ b/include/godot_cpp/variant/aabb.hpp @@ -43,7 +43,7 @@ namespace godot { class Variant; -struct _NO_DISCARD_ AABB { +struct [[nodiscard]] AABB { Vector3 position; Vector3 size; diff --git a/include/godot_cpp/variant/basis.hpp b/include/godot_cpp/variant/basis.hpp index f3ebe15fe..4b7a6b44b 100644 --- a/include/godot_cpp/variant/basis.hpp +++ b/include/godot_cpp/variant/basis.hpp @@ -37,7 +37,7 @@ namespace godot { -struct _NO_DISCARD_ Basis { +struct [[nodiscard]] Basis { Vector3 rows[3] = { Vector3(1, 0, 0), Vector3(0, 1, 0), diff --git a/include/godot_cpp/variant/color.hpp b/include/godot_cpp/variant/color.hpp index 0e837bc9f..86f1a3960 100644 --- a/include/godot_cpp/variant/color.hpp +++ b/include/godot_cpp/variant/color.hpp @@ -37,7 +37,7 @@ namespace godot { class String; -struct _NO_DISCARD_ Color { +struct [[nodiscard]] Color { union { struct { float r; diff --git a/include/godot_cpp/variant/plane.hpp b/include/godot_cpp/variant/plane.hpp index 829f801f4..d2184ca44 100644 --- a/include/godot_cpp/variant/plane.hpp +++ b/include/godot_cpp/variant/plane.hpp @@ -38,7 +38,7 @@ namespace godot { class Variant; -struct _NO_DISCARD_ Plane { +struct [[nodiscard]] Plane { Vector3 normal; real_t d = 0; diff --git a/include/godot_cpp/variant/projection.hpp b/include/godot_cpp/variant/projection.hpp index 1de6c0244..cc715778e 100644 --- a/include/godot_cpp/variant/projection.hpp +++ b/include/godot_cpp/variant/projection.hpp @@ -44,7 +44,7 @@ struct Rect2; struct Transform3D; struct Vector2; -struct _NO_DISCARD_ Projection { +struct [[nodiscard]] Projection { enum Planes { PLANE_NEAR, PLANE_FAR, diff --git a/include/godot_cpp/variant/quaternion.hpp b/include/godot_cpp/variant/quaternion.hpp index 8d0afd788..5cf23a357 100644 --- a/include/godot_cpp/variant/quaternion.hpp +++ b/include/godot_cpp/variant/quaternion.hpp @@ -37,7 +37,7 @@ namespace godot { -struct _NO_DISCARD_ Quaternion { +struct [[nodiscard]] Quaternion { union { struct { real_t x; diff --git a/include/godot_cpp/variant/rect2.hpp b/include/godot_cpp/variant/rect2.hpp index 31c81aa27..14cbeb51a 100644 --- a/include/godot_cpp/variant/rect2.hpp +++ b/include/godot_cpp/variant/rect2.hpp @@ -40,7 +40,7 @@ class String; struct Rect2i; struct Transform2D; -struct _NO_DISCARD_ Rect2 { +struct [[nodiscard]] Rect2 { Point2 position; Size2 size; diff --git a/include/godot_cpp/variant/rect2i.hpp b/include/godot_cpp/variant/rect2i.hpp index 57b090592..2c42aa7f1 100644 --- a/include/godot_cpp/variant/rect2i.hpp +++ b/include/godot_cpp/variant/rect2i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Rect2; -struct _NO_DISCARD_ Rect2i { +struct [[nodiscard]] Rect2i { Point2i position; Size2i size; diff --git a/include/godot_cpp/variant/transform2d.hpp b/include/godot_cpp/variant/transform2d.hpp index d73323f31..f83f0399c 100644 --- a/include/godot_cpp/variant/transform2d.hpp +++ b/include/godot_cpp/variant/transform2d.hpp @@ -39,7 +39,7 @@ namespace godot { class String; -struct _NO_DISCARD_ Transform2D { +struct [[nodiscard]] Transform2D { // Warning #1: basis of Transform2D is stored differently from Basis. In terms of columns array, the basis matrix looks like "on paper": // M = (columns[0][0] columns[1][0]) // (columns[0][1] columns[1][1]) diff --git a/include/godot_cpp/variant/transform3d.hpp b/include/godot_cpp/variant/transform3d.hpp index 6fa5999ed..2ad84ff3d 100644 --- a/include/godot_cpp/variant/transform3d.hpp +++ b/include/godot_cpp/variant/transform3d.hpp @@ -39,7 +39,7 @@ namespace godot { -struct _NO_DISCARD_ Transform3D { +struct [[nodiscard]] Transform3D { Basis basis; Vector3 origin; diff --git a/include/godot_cpp/variant/vector2.hpp b/include/godot_cpp/variant/vector2.hpp index 8f08985f3..8252f348a 100644 --- a/include/godot_cpp/variant/vector2.hpp +++ b/include/godot_cpp/variant/vector2.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector2i; -struct _NO_DISCARD_ Vector2 { +struct [[nodiscard]] Vector2 { static const int AXIS_COUNT = 2; enum Axis { diff --git a/include/godot_cpp/variant/vector2i.hpp b/include/godot_cpp/variant/vector2i.hpp index 0d787c3fc..bee40d5cc 100644 --- a/include/godot_cpp/variant/vector2i.hpp +++ b/include/godot_cpp/variant/vector2i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector2; -struct _NO_DISCARD_ Vector2i { +struct [[nodiscard]] Vector2i { static const int AXIS_COUNT = 2; enum Axis { diff --git a/include/godot_cpp/variant/vector3.hpp b/include/godot_cpp/variant/vector3.hpp index f256c3895..69d772656 100644 --- a/include/godot_cpp/variant/vector3.hpp +++ b/include/godot_cpp/variant/vector3.hpp @@ -41,7 +41,7 @@ struct Basis; struct Vector2; struct Vector3i; -struct _NO_DISCARD_ Vector3 { +struct [[nodiscard]] Vector3 { static const int AXIS_COUNT = 3; enum Axis { diff --git a/include/godot_cpp/variant/vector3i.hpp b/include/godot_cpp/variant/vector3i.hpp index b2cdbbdfd..d489b415c 100644 --- a/include/godot_cpp/variant/vector3i.hpp +++ b/include/godot_cpp/variant/vector3i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector3; -struct _NO_DISCARD_ Vector3i { +struct [[nodiscard]] Vector3i { static const int AXIS_COUNT = 3; enum Axis { diff --git a/include/godot_cpp/variant/vector4.hpp b/include/godot_cpp/variant/vector4.hpp index e0e197f82..ff95fa7a3 100644 --- a/include/godot_cpp/variant/vector4.hpp +++ b/include/godot_cpp/variant/vector4.hpp @@ -38,7 +38,7 @@ namespace godot { class String; -struct _NO_DISCARD_ Vector4 { +struct [[nodiscard]] Vector4 { static const int AXIS_COUNT = 4; enum Axis { diff --git a/include/godot_cpp/variant/vector4i.hpp b/include/godot_cpp/variant/vector4i.hpp index 8e9510fd0..4325fe99f 100644 --- a/include/godot_cpp/variant/vector4i.hpp +++ b/include/godot_cpp/variant/vector4i.hpp @@ -39,7 +39,7 @@ namespace godot { class String; struct Vector4; -struct _NO_DISCARD_ Vector4i { +struct [[nodiscard]] Vector4i { static const int AXIS_COUNT = 4; enum Axis { From 40e65753f97e82bdd9d90483f90f4d186210902b Mon Sep 17 00:00:00 2001 From: David Snopek Date: Fri, 21 Feb 2025 14:11:07 -0600 Subject: [PATCH 3/4] Check that precision of `extension_api.json` matches build options (cherry picked from commit 0a73df5f531ca1b8409d5dd984f7b857b7ae56ac) --- binding_generator.py | 9 +++++++-- misc/scripts/check_get_file_list.py | 1 + tools/godotcpp.py | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/binding_generator.py b/binding_generator.py index 30217bd38..ec2c5885f 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -278,10 +278,15 @@ def generate_bindings(api_filepath, use_template_get_node, bits="64", precision= api = {} with open(api_filepath, encoding="utf-8") as api_file: api = json.load(api_file) - _generate_bindings(api, use_template_get_node, bits, precision, output_dir) + _generate_bindings(api, api_filepath, use_template_get_node, bits, precision, output_dir) -def _generate_bindings(api, use_template_get_node, bits="64", precision="single", output_dir="."): +def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", precision="single", output_dir="."): + if "precision" in api["header"] and precision != api["header"]["precision"]: + raise Exception( + f"Cannot do a precision={precision} build using '{api_filepath}' which was generated by Godot built with precision={api['header']['precision']}" + ) + target_dir = Path(output_dir) / "gen" shutil.rmtree(target_dir, ignore_errors=True) diff --git a/misc/scripts/check_get_file_list.py b/misc/scripts/check_get_file_list.py index ac90777a5..6ea5d6f73 100755 --- a/misc/scripts/check_get_file_list.py +++ b/misc/scripts/check_get_file_list.py @@ -19,6 +19,7 @@ def test(profile_filepath=""): api = generate_trimmed_api(api_filepath, profile_filepath) _generate_bindings( api, + api_filepath, use_template_get_node=False, bits=bits, precision=precision, diff --git a/tools/godotcpp.py b/tools/godotcpp.py index 58392e3a4..fcc1ab1f9 100644 --- a/tools/godotcpp.py +++ b/tools/godotcpp.py @@ -153,6 +153,7 @@ def scons_generate_bindings(target, source, env): _generate_bindings( api, + str(source[0]), env["generate_template_get_node"], "32" if "32" in env["arch"] else "64", env["precision"], From dacaa81f2fa0fe864a7de08ca196b88ae047132a Mon Sep 17 00:00:00 2001 From: zhmt Date: Fri, 7 Feb 2025 15:58:31 +0800 Subject: [PATCH 4/4] binding_generator.py: Don't error if directory already exists It should be ok when folders exist. Exception shouldn't be thrown. Update binding_generator.py It should be ok when folds exist. It will fail to build without this patch, in vs code on windows with compiler ( visual studio community 2022 amd 64) . Co-Authored-By: Chris Cranford (cherry picked from commit d79959c79e61af7a1c3d4e7824ebbc4301aab3bf) --- binding_generator.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/binding_generator.py b/binding_generator.py index ec2c5885f..3d5531615 100644 --- a/binding_generator.py +++ b/binding_generator.py @@ -290,7 +290,7 @@ def _generate_bindings(api, api_filepath, use_template_get_node, bits="64", prec target_dir = Path(output_dir) / "gen" shutil.rmtree(target_dir, ignore_errors=True) - target_dir.mkdir(parents=True) + target_dir.mkdir(parents=True, exist_ok=True) real_t = "double" if precision == "double" else "float" print("Built-in type config: " + real_t + "_" + bits)