From 68372606b53109df8d2f21764c058bc9f04b137d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 27 Sep 2021 12:51:47 +0200
Subject: [PATCH 01/37] headers: Sync with Godot 3.4 beta 5

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index 68174528c..0f91de28a 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit 68174528c996b0a598b30a8abe7a7f289df9af90
+Subproject commit 0f91de28a593670a9cbea3dd78163a31ddfcbff4

From a1337a2dd71c5f0c0850b860b1a03eaa853f9f62 Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Fri, 1 Oct 2021 19:24:48 +0200
Subject: [PATCH 02/37] [OSX] Add universal build support.

---
 SConstruct | 19 ++++++++++++-------
 1 file changed, 12 insertions(+), 7 deletions(-)

diff --git a/SConstruct b/SConstruct
index 695021731..8b1d136cb 100644
--- a/SConstruct
+++ b/SConstruct
@@ -151,8 +151,8 @@ opts.Add(
 opts.Add(EnumVariable(
     'macos_arch',
     'Target macOS architecture',
-    'x86_64',
-    ['x86_64', 'arm64']
+    'universal',
+    ['universal', 'x86_64', 'arm64']
 ))
 opts.Add(EnumVariable(
     'ios_arch',
@@ -228,7 +228,14 @@ elif env['platform'] == 'osx':
             'Only 64-bit builds are supported for the macOS target.'
         )
 
-    env.Append(CCFLAGS=['-std=c++14', '-arch', env['macos_arch']])
+    if env["macos_arch"] == "universal":
+        env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
+        env.Append(CCFLAGS=["-arch", "x86_64", "-arch", "arm64"])
+    else:
+        env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
+        env.Append(CCFLAGS=["-arch", env["macos_arch"]])
+
+    env.Append(CCFLAGS=['-std=c++14'])
 
     if env['macos_deployment_target'] != 'default':
         env.Append(CCFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
@@ -239,8 +246,6 @@ elif env['platform'] == 'osx':
         env.Append(LINKFLAGS=['-isysroot', env['macos_sdk_path']])
 
     env.Append(LINKFLAGS=[
-        '-arch',
-        env['macos_arch'],
         '-framework',
         'Cocoa',
         '-Wl,-undefined,dynamic_lookup',
@@ -472,8 +477,8 @@ if env['platform'] == 'android':
 elif env['platform'] == 'ios':
     arch_suffix = env['ios_arch']
 elif env['platform'] == 'osx':
-    if env['macos_arch'] != 'x86_64':
-         arch_suffix = env['macos_arch']
+    if env['macos_arch'] != 'universal':
+        arch_suffix = env['macos_arch']
 elif env['platform'] == 'javascript':
     arch_suffix = 'wasm'
 

From de89011ca4ee3578d6b05542cc802fe7cc143238 Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Fri, 1 Oct 2021 19:31:56 +0200
Subject: [PATCH 03/37] [CI] Use MacOS universal build instead of 2 builds.

Switch to the now available macOS 11 for building.
---
 .github/workflows/ci.yml | 33 +++------------------------------
 1 file changed, 3 insertions(+), 30 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 00068f93c..5d6a55a63 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -108,7 +108,7 @@ jobs:
 
   macos:
     name: Build (macOS, Clang)
-    runs-on: macos-10.15
+    runs-on: macos-11
     steps:
       - name: Checkout
         uses: actions/checkout@v2
@@ -133,45 +133,18 @@ jobs:
       - name: Upload artifact
         uses: actions/upload-artifact@v2
         with:
-          name: godot-cpp-macos-x86_64-release
+          name: godot-cpp-macos-universal-release
           path: bin/libgodot-cpp.osx.release.64.a
           if-no-files-found: error
 
       - name: Build test GDNative library
         run: |
-          scons target=release platform=osx bits=64 -j $(sysctl -n hw.logicalcpu) -C test
+          scons target=release platform=osx bits=64 macos_arch=universal -j $(sysctl -n hw.logicalcpu) -C test
 
       - name: Run test GDNative library
         run: |
           ./Godot.app/Contents/MacOS/Godot --path test -s script.gd
 
-  macos-arm64:
-    name: Build (macOS, Clang, cross-compile arm64)
-    runs-on: macos-latest
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v2
-        with:
-          submodules: recursive
-
-      - name: Set up Python (for SCons)
-        uses: actions/setup-python@v2
-        with:
-          python-version: '3.x'
-
-      - name: Install dependencies
-        run: |
-          python -m pip install scons
-
-      - name: Build godot-cpp
-        run: |
-          # The default SDK in github the actions environemnt seems to have problems compiling for arm64.
-          # Use the latest 11.x SDK.
-          SDK_BASE=/Library/Developer/CommandLineTools/SDKs
-          SDK_VER=$(ls $SDK_BASE | grep "MacOSX11." | sort -r | head -n1)
-          echo $SDK_BASE/$SDK_VER/
-          scons target=release generate_bindings=yes macos_arch=arm64 macos_deployment_target=10.15 macos_sdk_path="$SDK_BASE/$SDK_VER/" -j $(sysctl -n hw.logicalcpu)
-
   static-checks:
     name: Static Checks (clang-format)
     runs-on: ubuntu-20.04

From 1070a29d770309be89e44f4b8dd57814882547ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 4 Nov 2021 15:32:51 +0100
Subject: [PATCH 04/37] Add `.gitignore` for test, ignore potential log files

---
 .gitignore      |  1 +
 test/.gitignore | 21 +++++++++++++++++++++
 2 files changed, 22 insertions(+)
 create mode 100644 test/.gitignore

diff --git a/.gitignore b/.gitignore
index ce186c6d3..f164f670f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,5 +1,6 @@
 # Misc
 logs/*
+*.log
 
 # Binaries
 *.o
diff --git a/test/.gitignore b/test/.gitignore
new file mode 100644
index 000000000..e0b51db7b
--- /dev/null
+++ b/test/.gitignore
@@ -0,0 +1,21 @@
+# Godot 4+ specific ignores
+.godot/
+
+# Godot-specific ignores
+.import/
+export.cfg
+export_presets.cfg
+# Dummy HTML5 export presets file for continuous integration
+!.github/dist/export_presets.cfg
+
+# Imported translations (automatically generated from CSV files)
+*.translation
+
+# Mono-specific ignores
+.mono/
+data_*/
+mono_crash.*.json
+
+# System/tool-specific ignores
+.directory
+*~

From c12e9a319548a9e8d495ebbadcab7a68af9a970c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 4 Nov 2021 15:37:57 +0100
Subject: [PATCH 05/37] test: Style cleanup after opening in 3.4

---
 test/project.godot |  2 --
 test/script.gd     | 50 +++++++++++++++++++++++-----------------------
 2 files changed, 25 insertions(+), 27 deletions(-)

diff --git a/test/project.godot b/test/project.godot
index c9e426ae2..a3e6045da 100644
--- a/test/project.godot
+++ b/test/project.godot
@@ -10,10 +10,8 @@ config_version=4
 
 _global_script_classes=[  ]
 _global_script_class_icons={
-
 }
 
 [application]
 
 config/name="Test CI project"
-
diff --git a/test/script.gd b/test/script.gd
index d9b0fe102..94f8ecbb7 100644
--- a/test/script.gd
+++ b/test/script.gd
@@ -1,30 +1,30 @@
-
 extends MainLoop
 
+
 func _initialize():
-    OS.exit_code = 1
-    var native_script = load("res://gdexample.gdns")
-    print("Native Script ", native_script)
-    if native_script == null || !is_instance_valid(native_script):
-        return
-    print("Library ", native_script.library)
-    if native_script.library == null || !is_instance_valid(native_script.library):
-        return
-    var ref = native_script.new()
-    print("Reference ", ref)
-    if ref == null || !is_instance_valid(ref):
-        return
-    print("Reference name ", ref.name)
-    if ref.name != "SimpleClass":
-        return
-    print("Reference value ", ref.value)
-    if ref.value != 0:
-        return
-    print("Call method ", ref.method(1))
-    if ref.method(1) != 1:
-        return
-    OS.exit_code = 0
+	OS.exit_code = 1
+	var native_script = load("res://gdexample.gdns")
+	print("Native Script ", native_script)
+	if not native_script || !is_instance_valid(native_script):
+		return
+	print("Library ", native_script.library)
+	if not native_script.library || !is_instance_valid(native_script.library):
+		return
+	var ref = native_script.new()
+	print("Reference ", ref)
+	if not ref || !is_instance_valid(ref):
+		return
+	print("Reference name ", ref.name)
+	if ref.name != "SimpleClass":
+		return
+	print("Reference value ", ref.value)
+	if ref.value != 0:
+		return
+	print("Call method ", ref.method(1))
+	if ref.method(1) != 1:
+		return
+	OS.exit_code = 0
 
-func _idle(_delta):
-    return true
 
+func _idle(_delta):
+	return true

From 68ce78179f90be9bec8cc88106dba0c244bdc4f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 4 Nov 2021 15:39:20 +0100
Subject: [PATCH 06/37] headers: Track tag godot-3.4-stable

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index 0f91de28a..d1596b939 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit 0f91de28a593670a9cbea3dd78163a31ddfcbff4
+Subproject commit d1596b939d6c9f5df86655ea617713ef321ad938

From a0f2ab1f31b0fda65487b2bafe42527524573eaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 2 Dec 2021 10:32:56 +0100
Subject: [PATCH 07/37] CI: Update Godot binary to 3.4-stable for tests

---
 .github/workflows/ci.yml | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 5d6a55a63..10ad5c773 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -21,8 +21,8 @@ jobs:
           sudo apt-get update -qq
           sudo apt-get install -qqq build-essential pkg-config
           python -m pip install scons
-          curl -LO https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_linux_server.64.zip
-          unzip Godot_v3.3.3-stable_linux_server.64.zip
+          curl -LO https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_linux_server.64.zip
+          unzip Godot_v3.4-stable_linux_server.64.zip
 
       - name: Build godot-cpp
         run: |
@@ -41,7 +41,7 @@ jobs:
 
       - name: Run test GDNative library
         run: |
-          ./Godot_v3.3.3-stable_linux_server.64 --path test -s script.gd
+          ./Godot_v3.4-stable_linux_server.64 --path test -s script.gd
 
   windows-msvc:
     name: Build (Windows, MSVC)
@@ -123,8 +123,8 @@ jobs:
       - name: Install dependencies
         run: |
           python -m pip install scons
-          curl -LO https://downloads.tuxfamily.org/godotengine/3.3.3/Godot_v3.3.3-stable_osx.universal.zip
-          unzip Godot_v3.3.3-stable_osx.universal.zip
+          curl -LO https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_osx.universal.zip
+          unzip Godot_v3.4-stable_osx.universal.zip
 
       - name: Build godot-cpp
         run: |

From a93f7f9e73bf10899daa6b207c68d97f80d82d8a Mon Sep 17 00:00:00 2001
From: BimDav <67792882+BimDav@users.noreply.github.com>
Date: Fri, 3 Dec 2021 11:11:32 +0100
Subject: [PATCH 08/37] Call Variant destructor in operator=

---
 src/core/Variant.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/core/Variant.cpp b/src/core/Variant.cpp
index a0b50df20..2f2be90f0 100644
--- a/src/core/Variant.cpp
+++ b/src/core/Variant.cpp
@@ -188,6 +188,7 @@ Variant::Variant(const PoolColorArray &p_color_array) {
 }
 
 Variant &Variant::operator=(const Variant &v) {
+	godot::api->godot_variant_destroy(&_godot_variant);
 	godot::api->godot_variant_new_copy(&_godot_variant, &v._godot_variant);
 	return *this;
 }

From c1f632a1464bc55e1bb77165ca98f2fd91661489 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9o=20Monnom?= <theo.monnom@outlook.com>
Date: Sun, 5 Dec 2021 17:49:50 +0100
Subject: [PATCH 09/37] Generate bin files in the current CMake source dir

Use CMAKE_CURRENT_SOURCE_DIR to generate the binary in the current CMake directory instead of building it at the top level of the source tree
---
 CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8281129ad..80b8b4c6b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -40,7 +40,7 @@ cmake_minimum_required(VERSION 3.6)
 option(GENERATE_TEMPLATE_GET_NODE "Generate a template version of the Node class's get_node." ON)
 
 # Change the output directory to the bin directory
-set(BUILD_PATH ${CMAKE_SOURCE_DIR}/bin)
+set(BUILD_PATH ${CMAKE_CURRENT_SOURCE_DIR}/bin)
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_PATH}")
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_PATH}")
 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_PATH}")

From 09249530bdf4f892ebae2f0fa04b361f2b03edb5 Mon Sep 17 00:00:00 2001
From: Ivorius <lukas.tenbrink@gmail.com>
Date: Wed, 29 Dec 2021 15:04:57 +0100
Subject: [PATCH 10/37] In CMakeLists, use the new FindPython3 instead of
 FindPython

---
 CMakeLists.txt | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8281129ad..316f0f1c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -133,7 +133,7 @@ else()
 endif()
 
 # Generate source from the bindings file
-find_package(PythonInterp REQUIRED)
+find_package(Python3 3.4 REQUIRED) # pathlib should be present
 if(GENERATE_TEMPLATE_GET_NODE)
 	set(GENERATE_BINDING_PARAMETERS "True")
 else()
@@ -141,14 +141,14 @@ else()
 endif()
 
 message(STATUS "Generating Bindings")
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True)"
+execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", headers=True)"
 	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 	RESULT_VARIABLE HEADERS_FILE_LIST_RESULT
 	OUTPUT_VARIABLE HEADERS_FILE_LIST
 )
 set(HEADERS_FILE_LIST ${HEADERS_FILE_LIST})
 
-execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", sources=True)"
+execute_process(COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.print_file_list(\"${GODOT_CUSTOM_API_FILE}\", \"${CMAKE_CURRENT_BINARY_DIR}\", sources=True)"
 	WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 	RESULT_VARIABLE SOURCES_FILE_LIST_RESULT
 	OUTPUT_VARIABLE SOURCES_FILE_LIST
@@ -156,7 +156,7 @@ execute_process(COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; b
 set(SOURCES_FILE_LIST ${SOURCES_FILE_LIST})
 
 add_custom_command(OUTPUT ${HEADERS_FILE_LIST} ${SOURCES_FILE_LIST}
-		COMMAND "${PYTHON_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_CUSTOM_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${CMAKE_CURRENT_BINARY_DIR}\")"
+		COMMAND "${Python3_EXECUTABLE}" "-c" "import binding_generator; binding_generator.generate_bindings(\"${GODOT_CUSTOM_API_FILE}\", \"${GENERATE_BINDING_PARAMETERS}\", \"${CMAKE_CURRENT_BINARY_DIR}\")"
 		VERBATIM
 		WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
 		MAIN_DEPENDENCY ${GODOT_CUSTOM_API_FILE}

From f230e51e98ac40471d3c295596fdcd95f199a7cd Mon Sep 17 00:00:00 2001
From: Aaron Franke <arnfranke@yahoo.com>
Date: Sat, 26 Feb 2022 14:40:06 -0600
Subject: [PATCH 11/37] [3.x] Run black format on SConstruct files and bindings
 generator

---
 SConstruct           | 620 +++++++++++++++++++++----------------------
 binding_generator.py | 318 ++++++++++++----------
 test/SConstruct      | 151 ++++++-----
 3 files changed, 574 insertions(+), 515 deletions(-)

diff --git a/SConstruct b/SConstruct
index 8b1d136cb..95815e21b 100644
--- a/SConstruct
+++ b/SConstruct
@@ -5,24 +5,35 @@ import sys
 import subprocess
 
 if sys.version_info < (3,):
+
     def decode_utf8(x):
         return x
+
 else:
     import codecs
+
     def decode_utf8(x):
         return codecs.utf_8_decode(x)[0]
 
+
 # Workaround for MinGW. See:
 # http://www.scons.org/wiki/LongCmdLinesOnWin32
 if os.name == "nt":
     import subprocess
 
-    def mySubProcess(cmdline,env):
-        #print "SPAWNED : " + cmdline
+    def mySubProcess(cmdline, env):
+        # print "SPAWNED : " + cmdline
         startupinfo = subprocess.STARTUPINFO()
         startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
-        proc = subprocess.Popen(cmdline, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
-            stderr=subprocess.PIPE, startupinfo=startupinfo, shell = False, env = env)
+        proc = subprocess.Popen(
+            cmdline,
+            stdin=subprocess.PIPE,
+            stdout=subprocess.PIPE,
+            stderr=subprocess.PIPE,
+            startupinfo=startupinfo,
+            shell=False,
+            env=env,
+        )
         data, err = proc.communicate()
         rv = proc.wait()
         if rv:
@@ -33,158 +44,120 @@ if os.name == "nt":
 
     def mySpawn(sh, escape, cmd, args, env):
 
-        newargs = ' '.join(args[1:])
+        newargs = " ".join(args[1:])
         cmdline = cmd + " " + newargs
 
-        rv=0
-        if len(cmdline) > 32000 and cmd.endswith("ar") :
+        rv = 0
+        if len(cmdline) > 32000 and cmd.endswith("ar"):
             cmdline = cmd + " " + args[1] + " " + args[2] + " "
-            for i in range(3,len(args)) :
-                rv = mySubProcess( cmdline + args[i], env )
-                if rv :
+            for i in range(3, len(args)):
+                rv = mySubProcess(cmdline + args[i], env)
+                if rv:
                     break
         else:
-            rv = mySubProcess( cmdline, env )
+            rv = mySubProcess(cmdline, env)
 
         return rv
 
+
 def add_sources(sources, dir, extension):
     for f in os.listdir(dir):
-        if f.endswith('.' + extension):
-            sources.append(dir + '/' + f)
+        if f.endswith("." + extension):
+            sources.append(dir + "/" + f)
 
 
 # Try to detect the host platform automatically.
 # This is used if no `platform` argument is passed
-if sys.platform.startswith('linux'):
-    host_platform = 'linux'
-elif sys.platform.startswith('freebsd'):
-    host_platform = 'freebsd'
-elif sys.platform == 'darwin':
-    host_platform = 'osx'
-elif sys.platform == 'win32' or sys.platform == 'msys':
-    host_platform = 'windows'
+if sys.platform.startswith("linux"):
+    host_platform = "linux"
+elif sys.platform.startswith("freebsd"):
+    host_platform = "freebsd"
+elif sys.platform == "darwin":
+    host_platform = "osx"
+elif sys.platform == "win32" or sys.platform == "msys":
+    host_platform = "windows"
 else:
-    raise ValueError(
-        'Could not detect platform automatically, please specify with '
-        'platform=<platform>'
-    )
+    raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
 
-env = Environment(ENV = os.environ)
+env = Environment(ENV=os.environ)
 
-is64 = sys.maxsize > 2**32
+is64 = sys.maxsize > 2 ** 32
 if (
-    env['TARGET_ARCH'] == 'amd64' or
-    env['TARGET_ARCH'] == 'emt64' or
-    env['TARGET_ARCH'] == 'x86_64' or
-    env['TARGET_ARCH'] == 'arm64-v8a'
+    env["TARGET_ARCH"] == "amd64"
+    or env["TARGET_ARCH"] == "emt64"
+    or env["TARGET_ARCH"] == "x86_64"
+    or env["TARGET_ARCH"] == "arm64-v8a"
 ):
     is64 = True
 
 opts = Variables([], ARGUMENTS)
-opts.Add(EnumVariable(
-    'platform',
-    'Target platform',
-    host_platform,
-    allowed_values=('linux', 'freebsd', 'osx', 'windows', 'android', 'ios', 'javascript'),
-    ignorecase=2
-))
-opts.Add(EnumVariable(
-    'bits',
-    'Target platform bits',
-    '64' if is64 else '32',
-    ('32', '64')
-))
-opts.Add(BoolVariable(
-    'use_llvm',
-    'Use the LLVM compiler - only effective when targeting Linux or FreeBSD',
-    False
-))
-opts.Add(BoolVariable(
-    'use_mingw',
-    'Use the MinGW compiler instead of MSVC - only effective on Windows',
-    False
-))
+opts.Add(
+    EnumVariable(
+        "platform",
+        "Target platform",
+        host_platform,
+        allowed_values=("linux", "freebsd", "osx", "windows", "android", "ios", "javascript"),
+        ignorecase=2,
+    )
+)
+opts.Add(EnumVariable("bits", "Target platform bits", "64" if is64 else "32", ("32", "64")))
+opts.Add(BoolVariable("use_llvm", "Use the LLVM compiler - only effective when targeting Linux or FreeBSD", False))
+opts.Add(BoolVariable("use_mingw", "Use the MinGW compiler instead of MSVC - only effective on Windows", False))
 # Must be the same setting as used for cpp_bindings
-opts.Add(EnumVariable(
-    'target',
-    'Compilation target',
-    'debug',
-    allowed_values=('debug', 'release'),
-    ignorecase=2
-))
-opts.Add(PathVariable(
-    'headers_dir',
-    'Path to the directory containing Godot headers',
-    'godot-headers',
-    PathVariable.PathIsDir
-))
-opts.Add(PathVariable(
-    'custom_api_file',
-    'Path to a custom JSON API file',
-    None,
-    PathVariable.PathIsFile
-))
-opts.Add(EnumVariable(
-    'generate_bindings',
-    'Generate GDNative API bindings',
-    'auto',
-    allowed_values = ['yes', 'no', 'auto', 'true'],
-    ignorecase = 2
-))
-opts.Add(EnumVariable(
-    'android_arch',
-    'Target Android architecture',
-    'armv7',
-    ['armv7','arm64v8','x86','x86_64']
-))
+opts.Add(EnumVariable("target", "Compilation target", "debug", allowed_values=("debug", "release"), ignorecase=2))
+opts.Add(
+    PathVariable(
+        "headers_dir",
+        "Path to the directory containing Godot headers",
+        "godot-headers",
+        PathVariable.PathIsDir,
+    )
+)
+opts.Add(PathVariable("custom_api_file", "Path to a custom JSON API file", None, PathVariable.PathIsFile))
 opts.Add(
-    'macos_deployment_target',
-    'macOS deployment target',
-    'default'
+    EnumVariable(
+        "generate_bindings",
+        "Generate GDNative API bindings",
+        "auto",
+        allowed_values=["yes", "no", "auto", "true"],
+        ignorecase=2,
+    )
+)
+opts.Add(
+    EnumVariable(
+        "android_arch",
+        "Target Android architecture",
+        "armv7",
+        ["armv7", "arm64v8", "x86", "x86_64"],
+    )
 )
+opts.Add("macos_deployment_target", "macOS deployment target", "default")
+opts.Add("macos_sdk_path", "macOS SDK path", "")
+opts.Add(EnumVariable("macos_arch", "Target macOS architecture", "universal", ["universal", "x86_64", "arm64"]))
+opts.Add(EnumVariable("ios_arch", "Target iOS architecture", "arm64", ["armv7", "arm64", "x86_64"]))
+opts.Add(BoolVariable("ios_simulator", "Target iOS Simulator", False))
 opts.Add(
-    'macos_sdk_path',
-    'macOS SDK path',
-    ''
+    "IPHONEPATH",
+    "Path to iPhone toolchain",
+    "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain",
 )
-opts.Add(EnumVariable(
-    'macos_arch',
-    'Target macOS architecture',
-    'universal',
-    ['universal', 'x86_64', 'arm64']
-))
-opts.Add(EnumVariable(
-    'ios_arch',
-    'Target iOS architecture',
-    'arm64',
-    ['armv7', 'arm64', 'x86_64']
-))
-opts.Add(BoolVariable(
-    'ios_simulator',
-    'Target iOS Simulator',
-    False
-))
 opts.Add(
-    'IPHONEPATH',
-    'Path to iPhone toolchain',
-    '/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain',
+    "android_api_level",
+    "Target Android API level",
+    "18" if ARGUMENTS.get("android_arch", "armv7") in ["armv7", "x86"] else "21",
 )
 opts.Add(
-    'android_api_level',
-    'Target Android API level',
-    '18' if ARGUMENTS.get("android_arch", 'armv7') in ['armv7', 'x86'] else '21'
+    "ANDROID_NDK_ROOT",
+    "Path to your Android NDK installation. By default, uses ANDROID_NDK_ROOT from your defined environment variables.",
+    os.environ.get("ANDROID_NDK_ROOT", None),
 )
 opts.Add(
-    'ANDROID_NDK_ROOT',
-    'Path to your Android NDK installation. By default, uses ANDROID_NDK_ROOT from your defined environment variables.',
-    os.environ.get("ANDROID_NDK_ROOT", None)
+    BoolVariable(
+        "generate_template_get_node",
+        "Generate a template version of the Node class's get_node.",
+        True,
+    )
 )
-opts.Add(BoolVariable(
-	'generate_template_get_node',
-	"Generate a template version of the Node class's get_node.",
-	True
-))
 
 opts.Update(env)
 Help(opts.GenerateHelpText(env))
@@ -192,41 +165,39 @@ Help(opts.GenerateHelpText(env))
 # This makes sure to keep the session environment variables on Windows.
 # This way, you can run SCons in a Visual Studio 2017 prompt and it will find
 # all the required tools
-if host_platform == 'windows' and env['platform'] != 'android':
-    if env['bits'] == '64':
-        env = Environment(TARGET_ARCH='amd64')
-    elif env['bits'] == '32':
-        env = Environment(TARGET_ARCH='x86')
+if host_platform == "windows" and env["platform"] != "android":
+    if env["bits"] == "64":
+        env = Environment(TARGET_ARCH="amd64")
+    elif env["bits"] == "32":
+        env = Environment(TARGET_ARCH="x86")
 
     opts.Update(env)
 
-if env['platform'] == 'linux' or env['platform'] == 'freebsd':
-    if env['use_llvm']:
-        env['CXX'] = 'clang++'
+if env["platform"] == "linux" or env["platform"] == "freebsd":
+    if env["use_llvm"]:
+        env["CXX"] = "clang++"
 
-    env.Append(CCFLAGS=['-fPIC', '-std=c++14', '-Wwrite-strings'])
+    env.Append(CCFLAGS=["-fPIC", "-std=c++14", "-Wwrite-strings"])
     env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
 
-    if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og', '-g'])
-    elif env['target'] == 'release':
-        env.Append(CCFLAGS=['-O3'])
+    if env["target"] == "debug":
+        env.Append(CCFLAGS=["-Og", "-g"])
+    elif env["target"] == "release":
+        env.Append(CCFLAGS=["-O3"])
 
-    if env['bits'] == '64':
-        env.Append(CCFLAGS=['-m64'])
-        env.Append(LINKFLAGS=['-m64'])
-    elif env['bits'] == '32':
-        env.Append(CCFLAGS=['-m32'])
-        env.Append(LINKFLAGS=['-m32'])
+    if env["bits"] == "64":
+        env.Append(CCFLAGS=["-m64"])
+        env.Append(LINKFLAGS=["-m64"])
+    elif env["bits"] == "32":
+        env.Append(CCFLAGS=["-m32"])
+        env.Append(LINKFLAGS=["-m32"])
 
-elif env['platform'] == 'osx':
+elif env["platform"] == "osx":
     # Use Clang on macOS by default
-    env['CXX'] = 'clang++'
+    env["CXX"] = "clang++"
 
-    if env['bits'] == '32':
-        raise ValueError(
-            'Only 64-bit builds are supported for the macOS target.'
-        )
+    if env["bits"] == "32":
+        raise ValueError("Only 64-bit builds are supported for the macOS target.")
 
     if env["macos_arch"] == "universal":
         env.Append(LINKFLAGS=["-arch", "x86_64", "-arch", "arm64"])
@@ -235,175 +206,204 @@ elif env['platform'] == 'osx':
         env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
         env.Append(CCFLAGS=["-arch", env["macos_arch"]])
 
-    env.Append(CCFLAGS=['-std=c++14'])
+    env.Append(CCFLAGS=["-std=c++14"])
 
-    if env['macos_deployment_target'] != 'default':
-        env.Append(CCFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
-        env.Append(LINKFLAGS=['-mmacosx-version-min=' + env['macos_deployment_target']])
+    if env["macos_deployment_target"] != "default":
+        env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
+        env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
 
-    if env['macos_sdk_path']:
-        env.Append(CCFLAGS=['-isysroot', env['macos_sdk_path']])
-        env.Append(LINKFLAGS=['-isysroot', env['macos_sdk_path']])
+    if env["macos_sdk_path"]:
+        env.Append(CCFLAGS=["-isysroot", env["macos_sdk_path"]])
+        env.Append(LINKFLAGS=["-isysroot", env["macos_sdk_path"]])
 
-    env.Append(LINKFLAGS=[
-        '-framework',
-        'Cocoa',
-        '-Wl,-undefined,dynamic_lookup',
-    ])
+    env.Append(
+        LINKFLAGS=[
+            "-framework",
+            "Cocoa",
+            "-Wl,-undefined,dynamic_lookup",
+        ]
+    )
 
-    if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og', '-g'])
-    elif env['target'] == 'release':
-        env.Append(CCFLAGS=['-O3'])
+    if env["target"] == "debug":
+        env.Append(CCFLAGS=["-Og", "-g"])
+    elif env["target"] == "release":
+        env.Append(CCFLAGS=["-O3"])
 
-elif env['platform'] == 'ios':
-    if env['ios_simulator']:
-        sdk_name = 'iphonesimulator'
-        env.Append(CCFLAGS=['-mios-simulator-version-min=10.0'])
-        env['LIBSUFFIX'] = ".simulator" + env['LIBSUFFIX']
+elif env["platform"] == "ios":
+    if env["ios_simulator"]:
+        sdk_name = "iphonesimulator"
+        env.Append(CCFLAGS=["-mios-simulator-version-min=10.0"])
+        env["LIBSUFFIX"] = ".simulator" + env["LIBSUFFIX"]
     else:
-        sdk_name = 'iphoneos'
-        env.Append(CCFLAGS=['-miphoneos-version-min=10.0'])
+        sdk_name = "iphoneos"
+        env.Append(CCFLAGS=["-miphoneos-version-min=10.0"])
 
     try:
-        sdk_path = decode_utf8(subprocess.check_output(['xcrun', '--sdk', sdk_name, '--show-sdk-path']).strip())
+        sdk_path = decode_utf8(subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-path"]).strip())
     except (subprocess.CalledProcessError, OSError):
         raise ValueError("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
 
-    compiler_path = env['IPHONEPATH'] + '/usr/bin/'
-    env['ENV']['PATH'] = env['IPHONEPATH'] + "/Developer/usr/bin/:" + env['ENV']['PATH']
-
-    env['CC'] = compiler_path + 'clang'
-    env['CXX'] = compiler_path + 'clang++'
-    env['AR'] = compiler_path + 'ar'
-    env['RANLIB'] = compiler_path + 'ranlib'
-
-    env.Append(CCFLAGS=['-std=c++14', '-arch', env['ios_arch'], '-isysroot', sdk_path])
-    env.Append(LINKFLAGS=[
-        '-arch',
-        env['ios_arch'],
-        '-framework',
-        'Cocoa',
-        '-Wl,-undefined,dynamic_lookup',
-        '-isysroot', sdk_path,
-        '-F' + sdk_path
-    ])
-
-    if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og', '-g'])
-    elif env['target'] == 'release':
-        env.Append(CCFLAGS=['-O3'])
-
-elif env['platform'] == 'windows':
-    if host_platform == 'windows' and not env['use_mingw']:
+    compiler_path = env["IPHONEPATH"] + "/usr/bin/"
+    env["ENV"]["PATH"] = env["IPHONEPATH"] + "/Developer/usr/bin/:" + env["ENV"]["PATH"]
+
+    env["CC"] = compiler_path + "clang"
+    env["CXX"] = compiler_path + "clang++"
+    env["AR"] = compiler_path + "ar"
+    env["RANLIB"] = compiler_path + "ranlib"
+
+    env.Append(CCFLAGS=["-std=c++14", "-arch", env["ios_arch"], "-isysroot", sdk_path])
+    env.Append(
+        LINKFLAGS=[
+            "-arch",
+            env["ios_arch"],
+            "-framework",
+            "Cocoa",
+            "-Wl,-undefined,dynamic_lookup",
+            "-isysroot",
+            sdk_path,
+            "-F" + sdk_path,
+        ]
+    )
+
+    if env["target"] == "debug":
+        env.Append(CCFLAGS=["-Og", "-g"])
+    elif env["target"] == "release":
+        env.Append(CCFLAGS=["-O3"])
+
+elif env["platform"] == "windows":
+    if host_platform == "windows" and not env["use_mingw"]:
         # MSVC
-        env.Append(LINKFLAGS=['/WX'])
-        if env['target'] == 'debug':
-            env.Append(CCFLAGS=['/Z7', '/Od', '/EHsc', '/D_DEBUG', '/MDd'])
-        elif env['target'] == 'release':
-            env.Append(CCFLAGS=['/O2', '/EHsc', '/DNDEBUG', '/MD'])
+        env.Append(LINKFLAGS=["/WX"])
+        if env["target"] == "debug":
+            env.Append(CCFLAGS=["/Z7", "/Od", "/EHsc", "/D_DEBUG", "/MDd"])
+        elif env["target"] == "release":
+            env.Append(CCFLAGS=["/O2", "/EHsc", "/DNDEBUG", "/MD"])
 
-    elif host_platform == 'linux' or host_platform == 'freebsd' or host_platform == 'osx':
+    elif host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx":
         # Cross-compilation using MinGW
-        if env['bits'] == '64':
-            env['CXX'] = 'x86_64-w64-mingw32-g++'
-            env['AR'] = "x86_64-w64-mingw32-ar"
-            env['RANLIB'] = "x86_64-w64-mingw32-ranlib"
-            env['LINK'] = "x86_64-w64-mingw32-g++"
-        elif env['bits'] == '32':
-            env['CXX'] = 'i686-w64-mingw32-g++'
-            env['AR'] = "i686-w64-mingw32-ar"
-            env['RANLIB'] = "i686-w64-mingw32-ranlib"
-            env['LINK'] = "i686-w64-mingw32-g++"
-    
-    elif host_platform == 'windows' and env['use_mingw']:
+        if env["bits"] == "64":
+            env["CXX"] = "x86_64-w64-mingw32-g++"
+            env["AR"] = "x86_64-w64-mingw32-ar"
+            env["RANLIB"] = "x86_64-w64-mingw32-ranlib"
+            env["LINK"] = "x86_64-w64-mingw32-g++"
+        elif env["bits"] == "32":
+            env["CXX"] = "i686-w64-mingw32-g++"
+            env["AR"] = "i686-w64-mingw32-ar"
+            env["RANLIB"] = "i686-w64-mingw32-ranlib"
+            env["LINK"] = "i686-w64-mingw32-g++"
+
+    elif host_platform == "windows" and env["use_mingw"]:
         # Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
-        env = Environment(ENV = os.environ, tools=["mingw"])
+        env = Environment(ENV=os.environ, tools=["mingw"])
         opts.Update(env)
-        #env = env.Clone(tools=['mingw'])
+        # env = env.Clone(tools=['mingw'])
 
         env["SPAWN"] = mySpawn
 
     # Native or cross-compilation using MinGW
-    if host_platform == 'linux' or host_platform == 'freebsd' or host_platform == 'osx' or env['use_mingw']:
+    if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env["use_mingw"]:
         # These options are for a release build even using target=debug
-        env.Append(CCFLAGS=['-O3', '-std=c++14', '-Wwrite-strings'])
-        env.Append(LINKFLAGS=[
-            '--static',
-            '-Wl,--no-undefined',
-            '-static-libgcc',
-            '-static-libstdc++',
-        ])
-
-elif env['platform'] == 'android':
-    if host_platform == 'windows':
+        env.Append(CCFLAGS=["-O3", "-std=c++14", "-Wwrite-strings"])
+        env.Append(
+            LINKFLAGS=[
+                "--static",
+                "-Wl,--no-undefined",
+                "-static-libgcc",
+                "-static-libstdc++",
+            ]
+        )
+
+elif env["platform"] == "android":
+    if host_platform == "windows":
         # Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
-        env = Environment(ENV = os.environ, tools=["mingw"])
+        env = Environment(ENV=os.environ, tools=["mingw"])
         opts.Update(env)
-        #env = env.Clone(tools=['mingw'])
+        # env = env.Clone(tools=['mingw'])
 
         env["SPAWN"] = mySpawn
 
     # Verify NDK root
-    if not 'ANDROID_NDK_ROOT' in env:
-        raise ValueError("To build for Android, ANDROID_NDK_ROOT must be defined. Please set ANDROID_NDK_ROOT to the root folder of your Android NDK installation.")
+    if not "ANDROID_NDK_ROOT" in env:
+        raise ValueError(
+            "To build for Android, ANDROID_NDK_ROOT must be defined. Please set ANDROID_NDK_ROOT to the root folder of your Android NDK installation."
+        )
 
     # Validate API level
-    api_level = int(env['android_api_level'])
-    if env['android_arch'] in ['x86_64', 'arm64v8'] and api_level < 21:
+    api_level = int(env["android_api_level"])
+    if env["android_arch"] in ["x86_64", "arm64v8"] and api_level < 21:
         print("WARN: 64-bit Android architectures require an API level of at least 21; setting android_api_level=21")
-        env['android_api_level'] = '21'
+        env["android_api_level"] = "21"
         api_level = 21
 
     # Setup toolchain
-    toolchain = env['ANDROID_NDK_ROOT'] + "/toolchains/llvm/prebuilt/"
+    toolchain = env["ANDROID_NDK_ROOT"] + "/toolchains/llvm/prebuilt/"
     if host_platform == "windows":
         toolchain += "windows"
         import platform as pltfm
+
         if pltfm.machine().endswith("64"):
             toolchain += "-x86_64"
     elif host_platform == "linux":
         toolchain += "linux-x86_64"
     elif host_platform == "osx":
         toolchain += "darwin-x86_64"
-    env.PrependENVPath('PATH', toolchain + "/bin") # This does nothing half of the time, but we'll put it here anyways
+    env.PrependENVPath("PATH", toolchain + "/bin")  # This does nothing half of the time, but we'll put it here anyways
 
     # Get architecture info
     arch_info_table = {
-        "armv7" : {
-            "march":"armv7-a", "target":"armv7a-linux-androideabi", "tool_path":"arm-linux-androideabi", "compiler_path":"armv7a-linux-androideabi",
-            "ccflags" : ['-mfpu=neon']
-            },
-        "arm64v8" : {
-            "march":"armv8-a", "target":"aarch64-linux-android", "tool_path":"aarch64-linux-android", "compiler_path":"aarch64-linux-android",
-            "ccflags" : []
-            },
-        "x86" : {
-            "march":"i686", "target":"i686-linux-android", "tool_path":"i686-linux-android", "compiler_path":"i686-linux-android",
-            "ccflags" : ['-mstackrealign']
-            },
-        "x86_64" : {"march":"x86-64", "target":"x86_64-linux-android", "tool_path":"x86_64-linux-android", "compiler_path":"x86_64-linux-android",
-            "ccflags" : []
-        }
+        "armv7": {
+            "march": "armv7-a",
+            "target": "armv7a-linux-androideabi",
+            "tool_path": "arm-linux-androideabi",
+            "compiler_path": "armv7a-linux-androideabi",
+            "ccflags": ["-mfpu=neon"],
+        },
+        "arm64v8": {
+            "march": "armv8-a",
+            "target": "aarch64-linux-android",
+            "tool_path": "aarch64-linux-android",
+            "compiler_path": "aarch64-linux-android",
+            "ccflags": [],
+        },
+        "x86": {
+            "march": "i686",
+            "target": "i686-linux-android",
+            "tool_path": "i686-linux-android",
+            "compiler_path": "i686-linux-android",
+            "ccflags": ["-mstackrealign"],
+        },
+        "x86_64": {
+            "march": "x86-64",
+            "target": "x86_64-linux-android",
+            "tool_path": "x86_64-linux-android",
+            "compiler_path": "x86_64-linux-android",
+            "ccflags": [],
+        },
     }
-    arch_info = arch_info_table[env['android_arch']]
+    arch_info = arch_info_table[env["android_arch"]]
 
     # Setup tools
-    env['CC'] = toolchain + "/bin/clang"
-    env['CXX'] = toolchain + "/bin/clang++"
-    env['AR'] = toolchain + "/bin/" + arch_info['tool_path'] + "-ar"
-    env["AS"] = toolchain + "/bin/" + arch_info['tool_path'] + "-as"
-    env["LD"] = toolchain + "/bin/" + arch_info['tool_path'] + "-ld"
-    env["STRIP"] = toolchain + "/bin/" + arch_info['tool_path'] + "-strip"
-    env["RANLIB"] = toolchain + "/bin/" + arch_info['tool_path'] + "-ranlib"
-
-    env.Append(CCFLAGS=['--target=' + arch_info['target'] + env['android_api_level'], '-march=' + arch_info['march'], '-fPIC'])
-    env.Append(CCFLAGS=arch_info['ccflags'])
-
-    if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-Og', '-g'])
-    elif env['target'] == 'release':
-        env.Append(CCFLAGS=['-O3'])
+    env["CC"] = toolchain + "/bin/clang"
+    env["CXX"] = toolchain + "/bin/clang++"
+    env["AR"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ar"
+    env["AS"] = toolchain + "/bin/" + arch_info["tool_path"] + "-as"
+    env["LD"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ld"
+    env["STRIP"] = toolchain + "/bin/" + arch_info["tool_path"] + "-strip"
+    env["RANLIB"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ranlib"
+
+    env.Append(
+        CCFLAGS=[
+            "--target=" + arch_info["target"] + env["android_api_level"],
+            "-march=" + arch_info["march"],
+            "-fPIC",
+        ]
+    )
+    env.Append(CCFLAGS=arch_info["ccflags"])
+
+    if env["target"] == "debug":
+        env.Append(CCFLAGS=["-Og", "-g"])
+    elif env["target"] == "release":
+        env.Append(CCFLAGS=["-O3"])
 
 elif env["platform"] == "javascript":
     env["ENV"] = os.environ
@@ -430,64 +430,62 @@ elif env["platform"] == "javascript":
     env["LIBSUFFIX"] = ".a"
     env["LIBPREFIXES"] = ["$LIBPREFIX"]
     env["LIBSUFFIXES"] = ["$LIBSUFFIX"]
-    env.Replace(SHLINKFLAGS='$LINKFLAGS')
-    env.Replace(SHLINKFLAGS='$LINKFLAGS')
-
-    if env['target'] == 'debug':
-        env.Append(CCFLAGS=['-O0', '-g'])
-    elif env['target'] == 'release':
-        env.Append(CCFLAGS=['-O3'])
-
-env.Append(CPPPATH=[
-    '.',
-    env['headers_dir'],
-    'include',
-    'include/gen',
-    'include/core',
-])
+    env.Replace(SHLINKFLAGS="$LINKFLAGS")
+    env.Replace(SHLINKFLAGS="$LINKFLAGS")
+
+    if env["target"] == "debug":
+        env.Append(CCFLAGS=["-O0", "-g"])
+    elif env["target"] == "release":
+        env.Append(CCFLAGS=["-O3"])
+
+env.Append(
+    CPPPATH=[
+        ".",
+        env["headers_dir"],
+        "include",
+        "include/gen",
+        "include/core",
+    ]
+)
 
 # Generate bindings?
-json_api_file = ''
+json_api_file = ""
 
-if 'custom_api_file' in env:
-    json_api_file = env['custom_api_file']
+if "custom_api_file" in env:
+    json_api_file = env["custom_api_file"]
 else:
-    json_api_file = os.path.join(os.getcwd(), env['headers_dir'], 'api.json')
+    json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "api.json")
 
-if env['generate_bindings'] == 'auto':
+if env["generate_bindings"] == "auto":
     # Check if generated files exist
-    should_generate_bindings = not os.path.isfile(os.path.join(os.getcwd(), 'src', 'gen', 'Object.cpp'))
+    should_generate_bindings = not os.path.isfile(os.path.join(os.getcwd(), "src", "gen", "Object.cpp"))
 else:
-    should_generate_bindings = env['generate_bindings'] in ['yes', 'true']
+    should_generate_bindings = env["generate_bindings"] in ["yes", "true"]
 
 if should_generate_bindings:
     # Actually create the bindings here
     import binding_generator
 
-    binding_generator.generate_bindings(json_api_file, env['generate_template_get_node'])
+    binding_generator.generate_bindings(json_api_file, env["generate_template_get_node"])
 
 # Sources to compile
 sources = []
-add_sources(sources, 'src/core', 'cpp')
-add_sources(sources, 'src/gen', 'cpp')
-
-arch_suffix = env['bits']
-if env['platform'] == 'android':
-    arch_suffix = env['android_arch']
-elif env['platform'] == 'ios':
-    arch_suffix = env['ios_arch']
-elif env['platform'] == 'osx':
-    if env['macos_arch'] != 'universal':
-        arch_suffix = env['macos_arch']
-elif env['platform'] == 'javascript':
-    arch_suffix = 'wasm'
+add_sources(sources, "src/core", "cpp")
+add_sources(sources, "src/gen", "cpp")
+
+arch_suffix = env["bits"]
+if env["platform"] == "android":
+    arch_suffix = env["android_arch"]
+elif env["platform"] == "ios":
+    arch_suffix = env["ios_arch"]
+elif env["platform"] == "osx":
+    if env["macos_arch"] != "universal":
+        arch_suffix = env["macos_arch"]
+elif env["platform"] == "javascript":
+    arch_suffix = "wasm"
 
 library = env.StaticLibrary(
-    target='bin/' + 'libgodot-cpp.{}.{}.{}{}'.format(
-        env['platform'],
-        env['target'],
-        arch_suffix,
-        env['LIBSUFFIX']
-    ), source=sources
+    target="bin/" + "libgodot-cpp.{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["LIBSUFFIX"]),
+    source=sources,
 )
 Default(library)
diff --git a/binding_generator.py b/binding_generator.py
index 9542b002f..4a42e56ba 100644
--- a/binding_generator.py
+++ b/binding_generator.py
@@ -17,11 +17,11 @@ def correct_method_name(method_list):
 
 def print_file_list(api_filepath, output_dir, headers=False, sources=False):
     global classes
-    end = ';'
+    end = ";"
     with open(api_filepath) as api_file:
         classes = json.load(api_file)
-    include_gen_folder = Path(output_dir) / 'include' / 'gen'
-    source_gen_folder = Path(output_dir) / 'src' / 'gen'
+    include_gen_folder = Path(output_dir) / "include" / "gen"
+    source_gen_folder = Path(output_dir) / "src" / "gen"
     for _class in classes:
         header_filename = include_gen_folder / (strip_name(_class["name"]) + ".hpp")
         source_filename = source_gen_folder / (strip_name(_class["name"]) + ".cpp")
@@ -29,9 +29,9 @@ def print_file_list(api_filepath, output_dir, headers=False, sources=False):
             print(str(header_filename.as_posix()), end=end)
         if sources:
             print(str(source_filename.as_posix()), end=end)
-    icall_header_filename = include_gen_folder / '__icalls.hpp'
-    register_types_filename = source_gen_folder / '__register_types.cpp'
-    init_method_bindings_filename = source_gen_folder / '__init_method_bindings.cpp'
+    icall_header_filename = include_gen_folder / "__icalls.hpp"
+    register_types_filename = source_gen_folder / "__register_types.cpp"
+    init_method_bindings_filename = source_gen_folder / "__init_method_bindings.cpp"
     if headers:
         print(str(icall_header_filename.as_posix()), end=end)
     if sources:
@@ -45,8 +45,8 @@ def generate_bindings(api_filepath, use_template_get_node, output_dir="."):
         classes = json.load(api_file)
 
     icalls = set()
-    include_gen_folder = Path(output_dir) / 'include' / 'gen'
-    source_gen_folder = Path(output_dir) / 'src' / 'gen'
+    include_gen_folder = Path(output_dir) / "include" / "gen"
+    source_gen_folder = Path(output_dir) / "src" / "gen"
 
     try:
         include_gen_folder.mkdir(parents=True)
@@ -82,27 +82,28 @@ def generate_bindings(api_filepath, use_template_get_node, output_dir="."):
         with source_filename.open("w+") as source_file:
             source_file.write(impl)
 
-    icall_header_filename = include_gen_folder / '__icalls.hpp'
+    icall_header_filename = include_gen_folder / "__icalls.hpp"
     with icall_header_filename.open("w+") as icall_header_file:
         icall_header_file.write(generate_icall_header(icalls))
 
-    register_types_filename = source_gen_folder / '__register_types.cpp'
+    register_types_filename = source_gen_folder / "__register_types.cpp"
     with register_types_filename.open("w+") as register_types_file:
         register_types_file.write(generate_type_registry(classes))
 
-    init_method_bindings_filename = source_gen_folder / '__init_method_bindings.cpp'
+    init_method_bindings_filename = source_gen_folder / "__init_method_bindings.cpp"
     with init_method_bindings_filename.open("w+") as init_method_bindings_file:
         init_method_bindings_file.write(generate_init_method_bindings(classes))
 
 
 def is_reference_type(t):
     for c in classes:
-        if c['name'] != t:
+        if c["name"] != t:
             continue
-        if c['is_reference']:
+        if c["is_reference"]:
             return True
     return False
 
+
 def make_gdnative_type(t, ref_allowed):
     if is_enum(t):
         return remove_enum_prefix(t) + " "
@@ -131,7 +132,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
     source.append("#include <cstdint>")
     source.append("")
 
-
     source.append("#include <core/CoreTypes.hpp>")
 
     class_name = strip_name(c["name"])
@@ -145,7 +145,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
         source.append("#include <core/TagDB.hpp>")
         ref_allowed = False
 
-
     included = []
 
     for used_class in used_classes:
@@ -153,36 +152,38 @@ def generate_class_header(used_classes, c, use_template_get_node):
             used_class_name = remove_enum_prefix(extract_nested_type(used_class))
             if used_class_name not in included:
                 included.append(used_class_name)
-                source.append("#include \"" + used_class_name + ".hpp\"")
+                source.append('#include "' + used_class_name + '.hpp"')
         elif is_enum(used_class) and is_nested_type(used_class) and not is_nested_type(used_class, class_name):
             used_class_name = remove_enum_prefix(used_class)
             if used_class_name not in included:
                 included.append(used_class_name)
-                source.append("#include \"" + used_class_name + ".hpp\"")
+                source.append('#include "' + used_class_name + '.hpp"')
 
     source.append("")
 
     if c["base_class"] != "":
-        source.append("#include \"" + strip_name(c["base_class"]) + ".hpp\"")
-
+        source.append('#include "' + strip_name(c["base_class"]) + '.hpp"')
 
     source.append("namespace godot {")
     source.append("")
 
-
     for used_type in used_classes:
         if is_enum(used_type) or is_nested_type(used_type, class_name):
             continue
         else:
             source.append("class " + strip_name(used_type) + ";")
 
-
     source.append("")
 
     vararg_templates = ""
 
     # generate the class definition here
-    source.append("class " + class_name + (" : public _Wrapped" if c["base_class"] == "" else (" : public " + strip_name(c["base_class"])) ) + " {")
+    source.append(
+        "class "
+        + class_name
+        + (" : public _Wrapped" if c["base_class"] == "" else (" : public " + strip_name(c["base_class"])))
+        + " {"
+    )
 
     if c["base_class"] == "":
         source.append("public: enum { ___CLASS_IS_SCRIPT = 0, };")
@@ -213,7 +214,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
 
     source.append("")
 
-
     if c["singleton"]:
         source.append("\tstatic inline " + class_name + " *get_singleton()")
         source.append("\t{")
@@ -229,10 +229,18 @@ def generate_class_header(used_classes, c, use_template_get_node):
     # class name:
     # Two versions needed needed because when the user implements a custom class,
     # we want to override `___get_class_name` while `___get_godot_class_name` can keep returning the base name
-    source.append("\tstatic inline const char *___get_class_name() { return (const char *) \"" + strip_name(c["name"]) + "\"; }")
-    source.append("\tstatic inline const char *___get_godot_class_name() { return (const char *) \"" + strip_name(c["name"]) + "\"; }")
-
-    source.append("\tstatic inline Object *___get_from_variant(Variant a) { godot_object *o = (godot_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }")
+    source.append(
+        '\tstatic inline const char *___get_class_name() { return (const char *) "' + strip_name(c["name"]) + '"; }'
+    )
+    source.append(
+        '\tstatic inline const char *___get_godot_class_name() { return (const char *) "'
+        + strip_name(c["name"])
+        + '"; }'
+    )
+
+    source.append(
+        "\tstatic inline Object *___get_from_variant(Variant a) { godot_object *o = (godot_object*) a; return (o) ? (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, o) : nullptr; }"
+    )
 
     enum_values = []
 
@@ -250,7 +258,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
         if name not in enum_values:
             source.append("\tconst static int " + name + " = " + str(c["constants"][name]) + ";")
 
-
     if c["instanciable"]:
         source.append("")
         source.append("")
@@ -258,7 +265,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
 
     source.append("\n\t// methods")
 
-
     if class_name == "Object":
         source.append("#ifndef GODOT_CPP_NO_OBJECT_CAST")
         source.append("\ttemplate<class T>")
@@ -273,8 +279,7 @@ def generate_class_header(used_classes, c, use_template_get_node):
         # method_signature += "virtual " if method["is_virtual"] else ""
         method_signature += make_gdnative_type(method["return_type"], ref_allowed)
         method_name = escape_cpp(method["name"])
-        method_signature +=  method_name + "("
-
+        method_signature += method_name + "("
 
         has_default_argument = False
         method_arguments = ""
@@ -285,7 +290,6 @@ def generate_class_header(used_classes, c, use_template_get_node):
             method_signature += argument_name
             method_arguments += argument_name
 
-
             # default arguments
             def escape_default_arg(_type, default_value):
                 if _type == "Color":
@@ -294,7 +298,15 @@ def escape_default_arg(_type, default_value):
                     return default_value.lower()
                 if _type == "Array":
                     return "Array()"
-                if _type in ["PoolVector2Array", "PoolStringArray", "PoolVector3Array", "PoolColorArray", "PoolIntArray", "PoolRealArray", "PoolByteArray"]:
+                if _type in [
+                    "PoolVector2Array",
+                    "PoolStringArray",
+                    "PoolVector3Array",
+                    "PoolColorArray",
+                    "PoolIntArray",
+                    "PoolRealArray",
+                    "PoolByteArray",
+                ]:
                     return _type + "()"
                 if _type == "Vector2":
                     return "Vector2" + default_value
@@ -309,7 +321,7 @@ def escape_default_arg(_type, default_value):
                 if _type == "Variant":
                     return "Variant()" if default_value == "Null" else default_value
                 if _type == "String" or _type == "NodePath":
-                    return "\"" + default_value + "\""
+                    return '"' + default_value + '"'
                 if _type == "RID":
                     return "RID()"
 
@@ -318,15 +330,10 @@ def escape_default_arg(_type, default_value):
 
                 return default_value
 
-
-
-
             if argument["has_default_value"] or has_default_argument:
                 method_signature += " = " + escape_default_arg(argument["type"], argument["default_value"])
                 has_default_argument = True
 
-
-
             if i != len(method["arguments"]) - 1:
                 method_signature += ", "
                 method_arguments += ","
@@ -335,12 +342,20 @@ def escape_default_arg(_type, default_value):
             if len(method["arguments"]) > 0:
                 method_signature += ", "
                 method_arguments += ", "
-            vararg_templates += "\ttemplate <class... Args> " + method_signature + "Args... args){\n\t\treturn " + method_name + "(" + method_arguments + "Array::make(args...));\n\t}\n"""
+            vararg_templates += (
+                "\ttemplate <class... Args> "
+                + method_signature
+                + "Args... args){\n\t\treturn "
+                + method_name
+                + "("
+                + method_arguments
+                + "Array::make(args...));\n\t}\n"
+                ""
+            )
             method_signature += "const Array& __var_args = Array()"
 
         method_signature += ")" + (" const" if method["is_const"] else "")
 
-
         source.append("\t" + method_signature + ";")
 
     source.append(vararg_templates)
@@ -370,20 +385,16 @@ def escape_default_arg(_type, default_value):
 
     source.append("#endif")
 
-
     return "\n".join(source)
 
 
-
-
-
 def generate_class_implementation(icalls, used_classes, c, use_template_get_node):
     class_name = strip_name(c["name"])
 
     ref_allowed = class_name != "Object" and class_name != "Reference"
 
     source = []
-    source.append("#include \"" + class_name + ".hpp\"")
+    source.append('#include "' + class_name + '.hpp"')
     source.append("")
     source.append("")
 
@@ -394,8 +405,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
     source.append("#include <core/Godot.hpp>")
     source.append("")
 
-
-    source.append("#include \"__icalls.hpp\"")
+    source.append('#include "__icalls.hpp"')
     source.append("")
     source.append("")
 
@@ -403,17 +413,15 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
         if is_enum(used_class):
             continue
         else:
-            source.append("#include \"" + strip_name(used_class) + ".hpp\"")
+            source.append('#include "' + strip_name(used_class) + '.hpp"')
 
     source.append("")
     source.append("")
 
     source.append("namespace godot {")
 
-
     core_object_name = "this"
 
-
     source.append("")
     source.append("")
 
@@ -424,7 +432,7 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
 
         # FIXME Test if inlining has a huge impact on binary size
         source.append(class_name + "::" + class_name + "() {")
-        source.append("\t_owner = godot::api->godot_global_get_singleton((char *) \"" + strip_name(c["name"]) + "\");")
+        source.append('\t_owner = godot::api->godot_global_get_singleton((char *) "' + strip_name(c["name"]) + '");')
         source.append("}")
 
         source.append("")
@@ -440,10 +448,18 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
     source.append("void " + class_name + "::___init_method_bindings() {")
 
     for method in c["methods"]:
-        source.append("\t___mb.mb_" + method["name"] + " = godot::api->godot_method_bind_get_method(\"" + c["name"] + "\", \"" + ("get_node" if use_template_get_node and method["name"] == "get_node_internal" else method["name"]) + "\");")
+        source.append(
+            "\t___mb.mb_"
+            + method["name"]
+            + ' = godot::api->godot_method_bind_get_method("'
+            + c["name"]
+            + '", "'
+            + ("get_node" if use_template_get_node and method["name"] == "get_node_internal" else method["name"])
+            + '");'
+        )
 
     source.append("\tgodot_string_name class_name;")
-    source.append("\tgodot::api->godot_string_name_new_data(&class_name, \"" + c["name"] + "\");")
+    source.append('\tgodot::api->godot_string_name_new_data(&class_name, "' + c["name"] + '");')
     source.append("\t_detail_class_tag = godot::core_1_2_api->godot_get_class_tag(&class_name);")
     source.append("\tgodot::api->godot_string_name_destroy(&class_name);")
 
@@ -453,7 +469,13 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
     if c["instanciable"]:
         source.append(class_name + " *" + strip_name(c["name"]) + "::_new()")
         source.append("{")
-        source.append("\treturn (" + class_name + " *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, godot::api->godot_get_class_constructor((char *)\"" + c["name"] + "\")());")
+        source.append(
+            "\treturn ("
+            + class_name
+            + ' *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, godot::api->godot_get_class_constructor((char *)"'
+            + c["name"]
+            + '")());'
+        )
         source.append("}")
 
     for method in c["methods"]:
@@ -478,7 +500,6 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
 
         source.append(method_signature + " {")
 
-
         if method["name"] == "free":
             # dirty hack because Object::free is marked virtual but doesn't actually exist...
             source.append("\tgodot::api->godot_object_destroy(_owner);")
@@ -496,7 +517,9 @@ def generate_class_implementation(icalls, used_classes, c, use_template_get_node
                 elif return_type_is_ref:
                     return_statement += "return Ref<" + strip_name(method["return_type"]) + ">::__internal_constructor("
                 else:
-                    return_statement += "return " + ("(" + strip_name(method["return_type"]) + " *) " if is_class_type(method["return_type"]) else "")
+                    return_statement += "return " + (
+                        "(" + strip_name(method["return_type"]) + " *) " if is_class_type(method["return_type"]) else ""
+                    )
             else:
                 return_statement += "return "
 
@@ -507,8 +530,6 @@ def get_icall_type_name(name):
                 return "Object"
             return name
 
-
-
         if method["has_varargs"]:
 
             if len(method["arguments"]) != 0:
@@ -519,7 +540,6 @@ def get_icall_type_name(name):
 
             source.append("")
 
-
             for i, argument in enumerate(method["arguments"]):
                 source.append("\t__given_args[" + str(i) + "] = " + escape_cpp(argument["name"]) + ";")
 
@@ -531,7 +551,9 @@ def get_icall_type_name(name):
             else:
                 size = "(" + str(len(method["arguments"])) + ")"
 
-            source.append("\tgodot_variant **__args = (godot_variant **) alloca(sizeof(godot_variant *) * " + size + ");")
+            source.append(
+                "\tgodot_variant **__args = (godot_variant **) alloca(sizeof(godot_variant *) * " + size + ");"
+            )
 
             source.append("")
 
@@ -542,24 +564,35 @@ def get_icall_type_name(name):
 
             if method["has_varargs"]:
                 source.append("\tfor (int i = 0; i < __var_args.size(); i++) {")
-                source.append("\t\t__args[i + " + str(len(method["arguments"])) + "] = (godot_variant *) &((Array &) __var_args)[i];")
+                source.append(
+                    "\t\t__args[i + "
+                    + str(len(method["arguments"]))
+                    + "] = (godot_variant *) &((Array &) __var_args)[i];"
+                )
                 source.append("\t}")
 
             source.append("")
 
             source.append("\tVariant __result;")
-            source.append("\t*(godot_variant *) &__result = godot::api->godot_method_bind_call(___mb.mb_" + method["name"] + ", ((const Object *) " + core_object_name + ")->_owner, (const godot_variant **) __args, " + size + ", nullptr);")
+            source.append(
+                "\t*(godot_variant *) &__result = godot::api->godot_method_bind_call(___mb.mb_"
+                + method["name"]
+                + ", ((const Object *) "
+                + core_object_name
+                + ")->_owner, (const godot_variant **) __args, "
+                + size
+                + ", nullptr);"
+            )
 
             source.append("")
 
             if is_class_type(method["return_type"]):
                 source.append("\tObject *obj = Object::___get_from_variant(__result);")
-                source.append("\tif (obj->has_method(\"reference\"))")
-                source.append("\t\tobj->callv(\"reference\", Array());")
+                source.append('\tif (obj->has_method("reference"))')
+                source.append('\t\tobj->callv("reference", Array());')
 
                 source.append("")
 
-
             for i, argument in enumerate(method["arguments"]):
                 source.append("\tgodot::api->godot_variant_destroy((godot_variant *) &__given_args[" + str(i) + "]);")
 
@@ -571,12 +604,17 @@ def get_icall_type_name(name):
                     if return_type_is_ref:
                         cast += "Ref<" + strip_name(method["return_type"]) + ">::__internal_constructor(__result);"
                     else:
-                        cast += "(" + strip_name(method["return_type"]) + " *) " + strip_name(method["return_type"] + "::___get_from_variant(") + "__result);"
+                        cast += (
+                            "("
+                            + strip_name(method["return_type"])
+                            + " *) "
+                            + strip_name(method["return_type"] + "::___get_from_variant(")
+                            + "__result);"
+                        )
                 else:
                     cast += "__result;"
                 source.append("\treturn " + cast)
 
-
         else:
 
             args = []
@@ -607,17 +645,11 @@ def get_icall_type_name(name):
         source.append("}")
         source.append("")
 
-
-
     source.append("}")
 
-
     return "\n".join(source)
 
 
-
-
-
 def generate_icall_header(icalls):
 
     source = []
@@ -632,7 +664,7 @@ def generate_icall_header(icalls):
 
     source.append("#include <core/GodotGlobal.hpp>")
     source.append("#include <core/CoreTypes.hpp>")
-    source.append("#include \"Object.hpp\"")
+    source.append('#include "Object.hpp"')
     source.append("")
     source.append("")
 
@@ -645,7 +677,9 @@ def generate_icall_header(icalls):
 
         method_signature = "static inline "
 
-        method_signature += get_icall_return_type(ret_type) + get_icall_name(icall) + "(godot_method_bind *mb, const Object *inst"
+        method_signature += (
+            get_icall_return_type(ret_type) + get_icall_name(icall) + "(godot_method_bind *mb, const Object *inst"
+        )
 
         for i, arg in enumerate(args):
             method_signature += ", const "
@@ -668,11 +702,12 @@ def generate_icall_header(icalls):
         source.append(method_signature + " {")
 
         if ret_type != "void":
-            source.append("\t" + ("godot_object *" if is_class_type(ret_type) else get_icall_return_type(ret_type)) + "ret;")
+            source.append(
+                "\t" + ("godot_object *" if is_class_type(ret_type) else get_icall_return_type(ret_type)) + "ret;"
+            )
             if is_class_type(ret_type):
                 source.append("\tret = nullptr;")
 
-
         source.append("\tconst void *args[" + ("1" if len(args) == 0 else "") + "] = {")
 
         for i, arg in enumerate(args):
@@ -689,12 +724,18 @@ def generate_icall_header(icalls):
         source.append("\t};")
         source.append("")
 
-        source.append("\tgodot::api->godot_method_bind_ptrcall(mb, inst->_owner, args, " + ("nullptr" if ret_type == "void" else "&ret") + ");")
+        source.append(
+            "\tgodot::api->godot_method_bind_ptrcall(mb, inst->_owner, args, "
+            + ("nullptr" if ret_type == "void" else "&ret")
+            + ");"
+        )
 
         if ret_type != "void":
             if is_class_type(ret_type):
                 source.append("\tif (ret) {")
-                source.append("\t\treturn (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);")
+                source.append(
+                    "\t\treturn (Object *) godot::nativescript_1_1_api->godot_nativescript_get_instance_binding_data(godot::_RegisterState::language_index, ret);"
+                )
                 source.append("\t}")
                 source.append("")
                 source.append("\treturn (Object *) ret;")
@@ -715,7 +756,7 @@ def generate_icall_header(icalls):
 def generate_type_registry(classes):
     source = []
 
-    source.append("#include \"TagDB.hpp\"")
+    source.append('#include "TagDB.hpp"')
     source.append("#include <typeinfo>")
     source.append("\n")
 
@@ -741,14 +782,21 @@ def generate_type_registry(classes):
         if base_class_name == "":
             base_class_type_hash = "0"
 
-        source.append("\tgodot::_TagDB::register_global_type(\"" + c["name"] + "\", " + class_type_hash + ", " + base_class_type_hash + ");")
+        source.append(
+            '\tgodot::_TagDB::register_global_type("'
+            + c["name"]
+            + '", '
+            + class_type_hash
+            + ", "
+            + base_class_type_hash
+            + ");"
+        )
 
     source.append("}")
 
     source.append("")
     source.append("}")
 
-
     return "\n".join(source)
 
 
@@ -799,9 +847,6 @@ def get_icall_name(sig):
     return name
 
 
-
-
-
 def get_used_classes(c):
     classes = []
     for method in c["methods"]:
@@ -814,86 +859,91 @@ def get_used_classes(c):
     return classes
 
 
-
-
-
 def strip_name(name):
     if len(name) == 0:
         return name
-    if name[0] == '_':
+    if name[0] == "_":
         return name[1:]
     return name
 
+
 def extract_nested_type(nested_type):
-    return strip_name(nested_type[:nested_type.find("::")])
+    return strip_name(nested_type[: nested_type.find("::")])
+
 
 def remove_nested_type_prefix(name):
-    return name if name.find("::") == -1 else strip_name(name[name.find("::") + 2:])
+    return name if name.find("::") == -1 else strip_name(name[name.find("::") + 2 :])
+
 
 def remove_enum_prefix(name):
-    return strip_name(name[name.find("enum.") + 5:])
+    return strip_name(name[name.find("enum.") + 5 :])
+
 
-def is_nested_type(name, type = ""):
+def is_nested_type(name, type=""):
     return name.find(type + "::") != -1
 
+
 def is_enum(name):
     return name.find("enum.") == 0
 
+
 def is_class_type(name):
     return not is_core_type(name) and not is_primitive(name)
 
+
 def is_core_type(name):
-    core_types = ["Array",
-                  "Basis",
-                  "Color",
-                  "Dictionary",
-                  "Error",
-                  "NodePath",
-                  "Plane",
-                  "PoolByteArray",
-                  "PoolIntArray",
-                  "PoolRealArray",
-                  "PoolStringArray",
-                  "PoolVector2Array",
-                  "PoolVector3Array",
-                  "PoolColorArray",
-                  "PoolIntArray",
-                  "PoolRealArray",
-                  "Quat",
-                  "Rect2",
-                  "AABB",
-                  "RID",
-                  "String",
-                  "Transform",
-                  "Transform2D",
-                  "Variant",
-                  "Vector2",
-                  "Vector3"]
+    core_types = [
+        "Array",
+        "Basis",
+        "Color",
+        "Dictionary",
+        "Error",
+        "NodePath",
+        "Plane",
+        "PoolByteArray",
+        "PoolIntArray",
+        "PoolRealArray",
+        "PoolStringArray",
+        "PoolVector2Array",
+        "PoolVector3Array",
+        "PoolColorArray",
+        "PoolIntArray",
+        "PoolRealArray",
+        "Quat",
+        "Rect2",
+        "AABB",
+        "RID",
+        "String",
+        "Transform",
+        "Transform2D",
+        "Variant",
+        "Vector2",
+        "Vector3",
+    ]
     return name in core_types
 
 
-
-
 def is_primitive(name):
     core_types = ["int", "bool", "real", "float", "void"]
     return name in core_types
 
+
 def escape_cpp(name):
     escapes = {
-        "class":    "_class",
-        "enum":     "_enum",
-        "char":     "_char",
-        "short":    "_short",
-        "bool":     "_bool",
-        "int":      "_int",
-        "default":  "_default",
-        "case":     "_case",
-        "switch":   "_switch",
-        "export":   "_export",
+        "class": "_class",
+        "enum": "_enum",
+        "char": "_char",
+        "short": "_short",
+        "bool": "_bool",
+        "int": "_int",
+        "default": "_default",
+        "case": "_case",
+        "switch": "_switch",
+        "export": "_export",
         "template": "_template",
-        "new":      "new_",
+        "new": "new_",
         "operator": "_operator",
-        "typename": "_typename"
+        "typename": "_typename",
     }
     if name in escapes:
         return escapes[name]
diff --git a/test/SConstruct b/test/SConstruct
index a3423137a..63f219c3b 100644
--- a/test/SConstruct
+++ b/test/SConstruct
@@ -4,30 +4,34 @@ import sys
 
 # Try to detect the host platform automatically.
 # This is used if no `platform` argument is passed
-if sys.platform.startswith('linux'):
-    host_platform = 'linux'
-elif sys.platform == 'darwin':
-    host_platform = 'osx'
-elif sys.platform == 'win32' or sys.platform == 'msys':
-    host_platform = 'windows'
+if sys.platform.startswith("linux"):
+    host_platform = "linux"
+elif sys.platform == "darwin":
+    host_platform = "osx"
+elif sys.platform == "win32" or sys.platform == "msys":
+    host_platform = "windows"
 else:
-    raise ValueError(
-        'Could not detect platform automatically, please specify with '
-        'platform=<platform>'
-    )
+    raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
 
-env = Environment(ENV = os.environ)
+env = Environment(ENV=os.environ)
 
 opts = Variables([], ARGUMENTS)
 
 # Define our options
-opts.Add(EnumVariable('target', "Compilation target", 'debug', ['d', 'debug', 'r', 'release']))
-opts.Add(EnumVariable('platform', "Compilation platform", host_platform, ['', 'windows', 'x11', 'linux', 'osx']))
-opts.Add(EnumVariable('p', "Compilation target, alias for 'platform'", host_platform, ['', 'windows', 'x11', 'linux', 'osx']))
-opts.Add(EnumVariable('bits', 'Target platform bits', '64', ('32', '64')))
-opts.Add(BoolVariable('use_llvm', "Use the LLVM / Clang compiler", 'no'))
-opts.Add(PathVariable('target_path', 'The path where the lib is installed.', 'bin/', PathVariable.PathAccept))
-opts.Add(PathVariable('target_name', 'The library name.', 'libgdexample', PathVariable.PathAccept))
+opts.Add(EnumVariable("target", "Compilation target", "debug", ["d", "debug", "r", "release"]))
+opts.Add(EnumVariable("platform", "Compilation platform", host_platform, ["", "windows", "x11", "linux", "osx"]))
+opts.Add(
+    EnumVariable(
+        "p",
+        "Compilation target, alias for 'platform'",
+        host_platform,
+        ["", "windows", "x11", "linux", "osx"],
+    )
+)
+opts.Add(EnumVariable("bits", "Target platform bits", "64", ("32", "64")))
+opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler", "no"))
+opts.Add(PathVariable("target_path", "The path where the lib is installed.", "bin/", PathVariable.PathAccept))
+opts.Add(PathVariable("target_name", "The library name.", "libgdexample", PathVariable.PathAccept))
 
 # Local dependency paths, adapt them to your setup
 godot_headers_path = "../godot-headers/"
@@ -45,25 +49,25 @@ Help(opts.GenerateHelpText(env))
 # This makes sure to keep the session environment variables on Windows.
 # This way, you can run SCons in a Visual Studio 2017 prompt and it will find
 # all the required tools
-if host_platform == 'windows' and env['platform'] != 'android':
-    if env['bits'] == '64':
-        env = Environment(TARGET_ARCH='amd64')
-    elif env['bits'] == '32':
-        env = Environment(TARGET_ARCH='x86')
+if host_platform == "windows" and env["platform"] != "android":
+    if env["bits"] == "64":
+        env = Environment(TARGET_ARCH="amd64")
+    elif env["bits"] == "32":
+        env = Environment(TARGET_ARCH="x86")
 
     opts.Update(env)
 
 # Process some arguments
-if env['use_llvm']:
-    env['CC'] = 'clang'
-    env['CXX'] = 'clang++'
+if env["use_llvm"]:
+    env["CC"] = "clang"
+    env["CXX"] = "clang++"
 
-if env['p'] != '':
-    env['platform'] = env['p']
+if env["p"] != "":
+    env["platform"] = env["p"]
 
-if env['platform'] == '':
+if env["platform"] == "":
     print("No valid target platform selected.")
-    quit();
+    quit()
 
 # For the reference:
 # - CCFLAGS are compilation flags shared between C and C++
@@ -74,62 +78,69 @@ if env['platform'] == '':
 # - LINKFLAGS are for linking flags
 
 # Check our platform specifics
-if env['platform'] == "osx":
-    env['target_path'] += 'osx/'
-    cpp_library += '.osx'
-    env.Append(CCFLAGS=['-arch', 'x86_64'])
-    env.Append(CXXFLAGS=['-std=c++17'])
-    env.Append(LINKFLAGS=['-arch', 'x86_64'])
-    if env['target'] in ('debug', 'd'):
-        env.Append(CCFLAGS=['-g', '-O2'])
+if env["platform"] == "osx":
+    env["target_path"] += "osx/"
+    cpp_library += ".osx"
+    env.Append(CCFLAGS=["-arch", "x86_64"])
+    env.Append(CXXFLAGS=["-std=c++17"])
+    env.Append(LINKFLAGS=["-arch", "x86_64"])
+    if env["target"] in ("debug", "d"):
+        env.Append(CCFLAGS=["-g", "-O2"])
     else:
-        env.Append(CCFLAGS=['-g', '-O3'])
-
-elif env['platform'] in ('x11', 'linux'):
-    env['target_path'] += 'x11/'
-    cpp_library += '.linux'
-    env.Append(CCFLAGS=['-fPIC'])
-    env.Append(CXXFLAGS=['-std=c++17'])
-    if env['target'] in ('debug', 'd'):
-        env.Append(CCFLAGS=['-g3', '-Og'])
+        env.Append(CCFLAGS=["-g", "-O3"])
+
+elif env["platform"] in ("x11", "linux"):
+    env["target_path"] += "x11/"
+    cpp_library += ".linux"
+    env.Append(CCFLAGS=["-fPIC"])
+    env.Append(CXXFLAGS=["-std=c++17"])
+    if env["target"] in ("debug", "d"):
+        env.Append(CCFLAGS=["-g3", "-Og"])
     else:
-        env.Append(CCFLAGS=['-g', '-O3'])
+        env.Append(CCFLAGS=["-g", "-O3"])
 
-elif env['platform'] == "windows":
-    env['target_path'] += 'win64/'
-    cpp_library += '.windows'
+elif env["platform"] == "windows":
+    env["target_path"] += "win64/"
+    cpp_library += ".windows"
     # This makes sure to keep the session environment variables on windows,
     # that way you can run scons in a vs 2017 prompt and it will find all the required tools
     env.Append(ENV=os.environ)
 
-    env.Append(CPPDEFINES=['WIN32', '_WIN32', '_WINDOWS', '_CRT_SECURE_NO_WARNINGS'])
-    env.Append(CCFLAGS=['-W3', '-GR'])
-    env.Append(CXXFLAGS=['-std:c++17'])
-    if env['target'] in ('debug', 'd'):
-        env.Append(CPPDEFINES=['_DEBUG'])
-        env.Append(CCFLAGS=['-EHsc', '-MDd', '-ZI'])
-        env.Append(LINKFLAGS=['-DEBUG'])
+    env.Append(CPPDEFINES=["WIN32", "_WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS"])
+    env.Append(CCFLAGS=["-W3", "-GR"])
+    env.Append(CXXFLAGS=["-std:c++17"])
+    if env["target"] in ("debug", "d"):
+        env.Append(CPPDEFINES=["_DEBUG"])
+        env.Append(CCFLAGS=["-EHsc", "-MDd", "-ZI"])
+        env.Append(LINKFLAGS=["-DEBUG"])
     else:
-        env.Append(CPPDEFINES=['NDEBUG'])
-        env.Append(CCFLAGS=['-O2', '-EHsc', '-MD'])
+        env.Append(CPPDEFINES=["NDEBUG"])
+        env.Append(CCFLAGS=["-O2", "-EHsc", "-MD"])
 
-if env['target'] in ('debug', 'd'):
-    cpp_library += '.debug'
+if env["target"] in ("debug", "d"):
+    cpp_library += ".debug"
 else:
-    cpp_library += '.release'
+    cpp_library += ".release"
 
-cpp_library += '.' + str(bits)
+cpp_library += "." + str(bits)
 
 # make sure our binding library is properly includes
-env.Append(CPPPATH=['.', godot_headers_path, cpp_bindings_path + 'include/', cpp_bindings_path + 'include/core/', cpp_bindings_path + 'include/gen/'])
-env.Append(LIBPATH=[cpp_bindings_path + 'bin/'])
+env.Append(
+    CPPPATH=[
+        ".",
+        godot_headers_path,
+        cpp_bindings_path + "include/",
+        cpp_bindings_path + "include/core/",
+        cpp_bindings_path + "include/gen/",
+    ]
+)
+env.Append(LIBPATH=[cpp_bindings_path + "bin/"])
 env.Append(LIBS=[cpp_library])
 
 # tweak this if you want to use different folders, or more folders, to store your source code in.
-env.Append(CPPPATH=['src/'])
-sources = Glob('src/*.cpp')
+env.Append(CPPPATH=["src/"])
+sources = Glob("src/*.cpp")
 
-library = env.SharedLibrary(target=env['target_path'] + env['target_name'] , source=sources)
+library = env.SharedLibrary(target=env["target_path"] + env["target_name"], source=sources)
 
 Default(library)
-

From 7a3ad31dc4d3ed7f5f28c105b9ff69f4205c87fc Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 4 Apr 2022 12:28:54 +0200
Subject: [PATCH 12/37] Update copyright year

---
 LICENSE.md                      | 2 +-
 include/core/AABB.hpp           | 4 ++--
 include/core/Array.hpp          | 4 ++--
 include/core/Basis.hpp          | 4 ++--
 include/core/CameraMatrix.hpp   | 4 ++--
 include/core/Color.hpp          | 4 ++--
 include/core/CoreTypes.hpp      | 4 ++--
 include/core/Defs.hpp           | 4 ++--
 include/core/Dictionary.hpp     | 4 ++--
 include/core/Godot.hpp          | 4 ++--
 include/core/GodotGlobal.hpp    | 4 ++--
 include/core/GodotProfiling.hpp | 4 ++--
 include/core/Math.hpp           | 4 ++--
 include/core/NodePath.hpp       | 4 ++--
 include/core/Plane.hpp          | 4 ++--
 include/core/PoolArrays.hpp     | 4 ++--
 include/core/Quat.hpp           | 4 ++--
 include/core/RID.hpp            | 4 ++--
 include/core/Rect2.hpp          | 4 ++--
 include/core/Ref.hpp            | 4 ++--
 include/core/String.hpp         | 4 ++--
 include/core/TagDB.hpp          | 4 ++--
 include/core/Transform.hpp      | 4 ++--
 include/core/Transform2D.hpp    | 4 ++--
 include/core/Variant.hpp        | 4 ++--
 include/core/Vector2.hpp        | 4 ++--
 include/core/Vector3.hpp        | 4 ++--
 include/core/Wrapped.hpp        | 4 ++--
 src/core/AABB.cpp               | 4 ++--
 src/core/Array.cpp              | 4 ++--
 src/core/Basis.cpp              | 4 ++--
 src/core/CameraMatrix.cpp       | 4 ++--
 src/core/Color.cpp              | 4 ++--
 src/core/Dictionary.cpp         | 4 ++--
 src/core/GodotGlobal.cpp        | 4 ++--
 src/core/NodePath.cpp           | 4 ++--
 src/core/Plane.cpp              | 4 ++--
 src/core/PoolArrays.cpp         | 4 ++--
 src/core/Quat.cpp               | 4 ++--
 src/core/RID.cpp                | 4 ++--
 src/core/Rect2.cpp              | 4 ++--
 src/core/String.cpp             | 4 ++--
 src/core/TagDB.cpp              | 4 ++--
 src/core/Transform.cpp          | 4 ++--
 src/core/Transform2D.cpp        | 4 ++--
 src/core/Variant.cpp            | 4 ++--
 src/core/Vector2.cpp            | 4 ++--
 src/core/Vector3.cpp            | 4 ++--
 test/src/init.cpp               | 4 ++--
 49 files changed, 97 insertions(+), 97 deletions(-)

diff --git a/LICENSE.md b/LICENSE.md
index 599ae1e39..654253a64 100644
--- a/LICENSE.md
+++ b/LICENSE.md
@@ -1,6 +1,6 @@
 # MIT License
 
-Copyright (c) 2017-2021 Godot Engine contributors.
+Copyright (c) 2017-2022 Godot Engine contributors.
 
 Permission is hereby granted, free of charge, to any person obtaining a copy
 of this software and associated documentation files (the "Software"), to deal
diff --git a/include/core/AABB.hpp b/include/core/AABB.hpp
index 5c6944f09..5d2f921e5 100644
--- a/include/core/AABB.hpp
+++ b/include/core/AABB.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Array.hpp b/include/core/Array.hpp
index 91948a4ff..06e70deac 100644
--- a/include/core/Array.hpp
+++ b/include/core/Array.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Basis.hpp b/include/core/Basis.hpp
index de956e69f..719a22398 100644
--- a/include/core/Basis.hpp
+++ b/include/core/Basis.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/CameraMatrix.hpp b/include/core/CameraMatrix.hpp
index 27b6f73e1..035f53b68 100644
--- a/include/core/CameraMatrix.hpp
+++ b/include/core/CameraMatrix.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Color.hpp b/include/core/Color.hpp
index 36d32544c..0432275d9 100644
--- a/include/core/Color.hpp
+++ b/include/core/Color.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/CoreTypes.hpp b/include/core/CoreTypes.hpp
index 95ba2a79d..165cef291 100644
--- a/include/core/CoreTypes.hpp
+++ b/include/core/CoreTypes.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Defs.hpp b/include/core/Defs.hpp
index 369240e08..a70e615aa 100644
--- a/include/core/Defs.hpp
+++ b/include/core/Defs.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Dictionary.hpp b/include/core/Dictionary.hpp
index 9f01c5226..7f575878f 100644
--- a/include/core/Dictionary.hpp
+++ b/include/core/Dictionary.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Godot.hpp b/include/core/Godot.hpp
index 265bc7148..34d297aaf 100644
--- a/include/core/Godot.hpp
+++ b/include/core/Godot.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/GodotGlobal.hpp b/include/core/GodotGlobal.hpp
index 6312d19d1..847bf3206 100644
--- a/include/core/GodotGlobal.hpp
+++ b/include/core/GodotGlobal.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/GodotProfiling.hpp b/include/core/GodotProfiling.hpp
index fc343430f..124a830fb 100644
--- a/include/core/GodotProfiling.hpp
+++ b/include/core/GodotProfiling.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Math.hpp b/include/core/Math.hpp
index 1f54f9816..f2468d327 100644
--- a/include/core/Math.hpp
+++ b/include/core/Math.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/NodePath.hpp b/include/core/NodePath.hpp
index f76537ba6..417320a89 100644
--- a/include/core/NodePath.hpp
+++ b/include/core/NodePath.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Plane.hpp b/include/core/Plane.hpp
index be015912b..a3c55db4c 100644
--- a/include/core/Plane.hpp
+++ b/include/core/Plane.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/PoolArrays.hpp b/include/core/PoolArrays.hpp
index 233b146c2..dff95405a 100644
--- a/include/core/PoolArrays.hpp
+++ b/include/core/PoolArrays.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Quat.hpp b/include/core/Quat.hpp
index fba5ec62c..e14d5a6f0 100644
--- a/include/core/Quat.hpp
+++ b/include/core/Quat.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/RID.hpp b/include/core/RID.hpp
index e36e1c345..04bee9c1b 100644
--- a/include/core/RID.hpp
+++ b/include/core/RID.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Rect2.hpp b/include/core/Rect2.hpp
index 9cd7d10fa..be088cf6e 100644
--- a/include/core/Rect2.hpp
+++ b/include/core/Rect2.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Ref.hpp b/include/core/Ref.hpp
index 77a0aa484..adcb2fb96 100644
--- a/include/core/Ref.hpp
+++ b/include/core/Ref.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/String.hpp b/include/core/String.hpp
index 91400c73e..acee82389 100644
--- a/include/core/String.hpp
+++ b/include/core/String.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/TagDB.hpp b/include/core/TagDB.hpp
index 71f5e5c67..b47005524 100644
--- a/include/core/TagDB.hpp
+++ b/include/core/TagDB.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Transform.hpp b/include/core/Transform.hpp
index 9dea7f2c6..853808ee1 100644
--- a/include/core/Transform.hpp
+++ b/include/core/Transform.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Transform2D.hpp b/include/core/Transform2D.hpp
index 659ac1a09..eb92c284f 100644
--- a/include/core/Transform2D.hpp
+++ b/include/core/Transform2D.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Variant.hpp b/include/core/Variant.hpp
index 7f388d39d..127ec4dd4 100644
--- a/include/core/Variant.hpp
+++ b/include/core/Variant.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Vector2.hpp b/include/core/Vector2.hpp
index a3a8897ae..73111a65c 100644
--- a/include/core/Vector2.hpp
+++ b/include/core/Vector2.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Vector3.hpp b/include/core/Vector3.hpp
index aa28c6155..ac3c7d5df 100644
--- a/include/core/Vector3.hpp
+++ b/include/core/Vector3.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/include/core/Wrapped.hpp b/include/core/Wrapped.hpp
index 26f2f0c8f..003a17804 100644
--- a/include/core/Wrapped.hpp
+++ b/include/core/Wrapped.hpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/AABB.cpp b/src/core/AABB.cpp
index 81ac1644b..5fdb4ce63 100644
--- a/src/core/AABB.cpp
+++ b/src/core/AABB.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Array.cpp b/src/core/Array.cpp
index 976838707..72663c9ea 100644
--- a/src/core/Array.cpp
+++ b/src/core/Array.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Basis.cpp b/src/core/Basis.cpp
index da5f71f91..6bae9d9f4 100644
--- a/src/core/Basis.cpp
+++ b/src/core/Basis.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/CameraMatrix.cpp b/src/core/CameraMatrix.cpp
index de5326361..29267c31a 100644
--- a/src/core/CameraMatrix.cpp
+++ b/src/core/CameraMatrix.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Color.cpp b/src/core/Color.cpp
index 8efc5c306..e0d477273 100644
--- a/src/core/Color.cpp
+++ b/src/core/Color.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Dictionary.cpp b/src/core/Dictionary.cpp
index 6f846c31c..95e89fb2e 100644
--- a/src/core/Dictionary.cpp
+++ b/src/core/Dictionary.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/GodotGlobal.cpp b/src/core/GodotGlobal.cpp
index b9cf88a37..511ed75b4 100644
--- a/src/core/GodotGlobal.cpp
+++ b/src/core/GodotGlobal.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/NodePath.cpp b/src/core/NodePath.cpp
index ff657734d..3d291e32c 100644
--- a/src/core/NodePath.cpp
+++ b/src/core/NodePath.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Plane.cpp b/src/core/Plane.cpp
index fcf0012e4..8fe51a76e 100644
--- a/src/core/Plane.cpp
+++ b/src/core/Plane.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/PoolArrays.cpp b/src/core/PoolArrays.cpp
index 576a0b7cf..aefacfd7e 100644
--- a/src/core/PoolArrays.cpp
+++ b/src/core/PoolArrays.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Quat.cpp b/src/core/Quat.cpp
index 40d23e99a..a8bb3e198 100644
--- a/src/core/Quat.cpp
+++ b/src/core/Quat.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/RID.cpp b/src/core/RID.cpp
index fbd4e5cc0..88bc071f9 100644
--- a/src/core/RID.cpp
+++ b/src/core/RID.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Rect2.cpp b/src/core/Rect2.cpp
index ab21e5ced..7c5fe561e 100644
--- a/src/core/Rect2.cpp
+++ b/src/core/Rect2.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/String.cpp b/src/core/String.cpp
index ea3f7f1ea..a7977abfa 100644
--- a/src/core/String.cpp
+++ b/src/core/String.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/TagDB.cpp b/src/core/TagDB.cpp
index dced8d179..4a2b13381 100644
--- a/src/core/TagDB.cpp
+++ b/src/core/TagDB.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Transform.cpp b/src/core/Transform.cpp
index 37dbb72a8..d430c72c7 100644
--- a/src/core/Transform.cpp
+++ b/src/core/Transform.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Transform2D.cpp b/src/core/Transform2D.cpp
index 01565e13e..7edc9c3e1 100644
--- a/src/core/Transform2D.cpp
+++ b/src/core/Transform2D.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Variant.cpp b/src/core/Variant.cpp
index 2f2be90f0..d72e7c512 100644
--- a/src/core/Variant.cpp
+++ b/src/core/Variant.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Vector2.cpp b/src/core/Vector2.cpp
index 006d2a053..4e70465a1 100644
--- a/src/core/Vector2.cpp
+++ b/src/core/Vector2.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/src/core/Vector3.cpp b/src/core/Vector3.cpp
index f0071a41c..4bf37c352 100644
--- a/src/core/Vector3.cpp
+++ b/src/core/Vector3.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */
diff --git a/test/src/init.cpp b/test/src/init.cpp
index b72e2ae0b..971497059 100644
--- a/test/src/init.cpp
+++ b/test/src/init.cpp
@@ -5,8 +5,8 @@
 /*                           GODOT ENGINE                                */
 /*                      https://godotengine.org                          */
 /*************************************************************************/
-/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur.                 */
-/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md).   */
+/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur.                 */
+/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md).   */
 /*                                                                       */
 /* Permission is hereby granted, free of charge, to any person obtaining */
 /* a copy of this software and associated documentation files (the       */

From 3427c97f2421e54edff26d24b35474ae4ab91c76 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Wed, 9 Mar 2022 13:07:46 +0100
Subject: [PATCH 13/37] CI: Install MinGW via `egor-tensin/setup-mingw`

Scoop install is being problematic since their 0.1.0 release.

(cherry picked from commit 3846201fbbb021380fb1b67e88cbfe00dc6c1dc3)
---
 .github/workflows/ci.yml | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 10ad5c773..d7e566d2e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -90,13 +90,11 @@ jobs:
         run: |
           python -m pip install scons
 
+      - name: Setup MinGW for Windows/MinGW build
+        uses: egor-tensin/setup-mingw@v2
+
       - name: Build godot-cpp
-        # Install GCC from Scoop as the default supplied GCC doesn't work ("Error 1").
         run: |
-          Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
-          scoop install gcc
-          g++ --version
-          gcc --version
           scons target=release generate_bindings=yes use_mingw=yes -j $env:NUMBER_OF_PROCESSORS
 
       - name: Upload artifact

From 7d00a6e05b0517ce090e877847567681e1ad2856 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 4 Apr 2022 13:47:02 +0200
Subject: [PATCH 14/37] headers: Sync with upstream 3.x commit 21c3048

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index d1596b939..dc5282301 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit d1596b939d6c9f5df86655ea617713ef321ad938
+Subproject commit dc528230136c88452a34c9ec47528f17c3a3a2dc

From ca7cd22326a57ebd4408bb780785e44658f4bd92 Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Thu, 10 Feb 2022 03:57:48 +0100
Subject: [PATCH 15/37] Library SCons boilerplate to build projects.

---
 SConstruct            |  63 +++++++++++-------
 test/SConstruct       | 150 +++---------------------------------------
 test/gdexample.gdnlib |   8 +--
 3 files changed, 55 insertions(+), 166 deletions(-)

diff --git a/SConstruct b/SConstruct
index 95815e21b..d32bce05a 100644
--- a/SConstruct
+++ b/SConstruct
@@ -159,6 +159,8 @@ opts.Add(
     )
 )
 
+opts.Add(BoolVariable("build_library", "Build the godot-cpp library.", True))
+
 opts.Update(env)
 Help(opts.GenerateHelpText(env))
 
@@ -173,11 +175,18 @@ if host_platform == "windows" and env["platform"] != "android":
 
     opts.Update(env)
 
+# Require C++14
+if host_platform == "windows" and env["platform"] == "windows" and not env["use_mingw"]:
+    # MSVC
+    env.Append(CCFLAGS=["/std:c++14"])
+else:
+    env.Append(CCFLAGS=["-std=c++14"])
+
 if env["platform"] == "linux" or env["platform"] == "freebsd":
     if env["use_llvm"]:
         env["CXX"] = "clang++"
 
-    env.Append(CCFLAGS=["-fPIC", "-std=c++14", "-Wwrite-strings"])
+    env.Append(CCFLAGS=["-fPIC", "-Wwrite-strings"])
     env.Append(LINKFLAGS=["-Wl,-R,'$$ORIGIN'"])
 
     if env["target"] == "debug":
@@ -206,8 +215,6 @@ elif env["platform"] == "osx":
         env.Append(LINKFLAGS=["-arch", env["macos_arch"]])
         env.Append(CCFLAGS=["-arch", env["macos_arch"]])
 
-    env.Append(CCFLAGS=["-std=c++14"])
-
     if env["macos_deployment_target"] != "default":
         env.Append(CCFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
         env.Append(LINKFLAGS=["-mmacosx-version-min=" + env["macos_deployment_target"]])
@@ -216,13 +223,7 @@ elif env["platform"] == "osx":
         env.Append(CCFLAGS=["-isysroot", env["macos_sdk_path"]])
         env.Append(LINKFLAGS=["-isysroot", env["macos_sdk_path"]])
 
-    env.Append(
-        LINKFLAGS=[
-            "-framework",
-            "Cocoa",
-            "-Wl,-undefined,dynamic_lookup",
-        ]
-    )
+    env.Append(LINKFLAGS=["-Wl,-undefined,dynamic_lookup"])
 
     if env["target"] == "debug":
         env.Append(CCFLAGS=["-Og", "-g"])
@@ -233,7 +234,6 @@ elif env["platform"] == "ios":
     if env["ios_simulator"]:
         sdk_name = "iphonesimulator"
         env.Append(CCFLAGS=["-mios-simulator-version-min=10.0"])
-        env["LIBSUFFIX"] = ".simulator" + env["LIBSUFFIX"]
     else:
         sdk_name = "iphoneos"
         env.Append(CCFLAGS=["-miphoneos-version-min=10.0"])
@@ -250,14 +250,13 @@ elif env["platform"] == "ios":
     env["CXX"] = compiler_path + "clang++"
     env["AR"] = compiler_path + "ar"
     env["RANLIB"] = compiler_path + "ranlib"
+    env["SHLIBSUFFIX"] = ".dylib"
 
-    env.Append(CCFLAGS=["-std=c++14", "-arch", env["ios_arch"], "-isysroot", sdk_path])
+    env.Append(CCFLAGS=["-arch", env["ios_arch"], "-isysroot", sdk_path])
     env.Append(
         LINKFLAGS=[
             "-arch",
             env["ios_arch"],
-            "-framework",
-            "Cocoa",
             "-Wl,-undefined,dynamic_lookup",
             "-isysroot",
             sdk_path,
@@ -296,14 +295,20 @@ elif env["platform"] == "windows":
         # Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
         env = Environment(ENV=os.environ, tools=["mingw"])
         opts.Update(env)
-        # env = env.Clone(tools=['mingw'])
+
+        # Still need to use C++14.
+        env.Append(CCFLAGS=["-std=c++14"])
+        # Don't want lib prefixes
+        env["IMPLIBPREFIX"] = ""
+        env["SHLIBPREFIX"] = ""
 
         env["SPAWN"] = mySpawn
+        env.Replace(ARFLAGS=["q"])
 
     # Native or cross-compilation using MinGW
     if host_platform == "linux" or host_platform == "freebsd" or host_platform == "osx" or env["use_mingw"]:
         # These options are for a release build even using target=debug
-        env.Append(CCFLAGS=["-O3", "-std=c++14", "-Wwrite-strings"])
+        env.Append(CCFLAGS=["-O3", "-Wwrite-strings"])
         env.Append(
             LINKFLAGS=[
                 "--static",
@@ -318,9 +323,10 @@ elif env["platform"] == "android":
         # Don't Clone the environment. Because otherwise, SCons will pick up msvc stuff.
         env = Environment(ENV=os.environ, tools=["mingw"])
         opts.Update(env)
-        # env = env.Clone(tools=['mingw'])
 
+        # Long line hack. Use custom spawn, quick AR append (to avoid files with the same names to override each other).
         env["SPAWN"] = mySpawn
+        env.Replace(ARFLAGS=["q"])
 
     # Verify NDK root
     if not "ANDROID_NDK_ROOT" in env:
@@ -390,6 +396,7 @@ elif env["platform"] == "android":
     env["LD"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ld"
     env["STRIP"] = toolchain + "/bin/" + arch_info["tool_path"] + "-strip"
     env["RANLIB"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ranlib"
+    env["SHLIBSUFFIX"] = ".so"
 
     env.Append(
         CCFLAGS=[
@@ -399,6 +406,7 @@ elif env["platform"] == "android":
         ]
     )
     env.Append(CCFLAGS=arch_info["ccflags"])
+    env.Append(LINKFLAGS=["--target=" + arch_info["target"] + env["android_api_level"], "-march=" + arch_info["march"]])
 
     if env["target"] == "debug":
         env.Append(CCFLAGS=["-Og", "-g"])
@@ -478,14 +486,25 @@ if env["platform"] == "android":
     arch_suffix = env["android_arch"]
 elif env["platform"] == "ios":
     arch_suffix = env["ios_arch"]
+    if env["ios_simulator"]:
+        arch_suffix += ".simulator"
 elif env["platform"] == "osx":
     if env["macos_arch"] != "universal":
         arch_suffix = env["macos_arch"]
 elif env["platform"] == "javascript":
     arch_suffix = "wasm"
+# Expose it to projects that import this env.
+env["arch_suffix"] = arch_suffix
 
-library = env.StaticLibrary(
-    target="bin/" + "libgodot-cpp.{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["LIBSUFFIX"]),
-    source=sources,
-)
-Default(library)
+library = None
+env["OBJSUFFIX"] = ".{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["OBJSUFFIX"])
+library_name = "libgodot-cpp.{}.{}.{}{}".format(env["platform"], env["target"], arch_suffix, env["LIBSUFFIX"])
+
+if env["build_library"]:
+    library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources)
+    Default(library)
+
+env.Append(CPPPATH=[env.Dir(f) for f in [env["headers_dir"], "include", "include/gen", "include/core"]])
+env.Append(LIBPATH=[env.Dir("bin")])
+env.Append(LIBS=library_name)
+Return("env")
diff --git a/test/SConstruct b/test/SConstruct
index 63f219c3b..9bfd43dc5 100644
--- a/test/SConstruct
+++ b/test/SConstruct
@@ -1,146 +1,16 @@
 #!/usr/bin/env python
-import os
-import sys
 
-# Try to detect the host platform automatically.
-# This is used if no `platform` argument is passed
-if sys.platform.startswith("linux"):
-    host_platform = "linux"
-elif sys.platform == "darwin":
-    host_platform = "osx"
-elif sys.platform == "win32" or sys.platform == "msys":
-    host_platform = "windows"
-else:
-    raise ValueError("Could not detect platform automatically, please specify with platform=<platform>")
-
-env = Environment(ENV=os.environ)
-
-opts = Variables([], ARGUMENTS)
-
-# Define our options
-opts.Add(EnumVariable("target", "Compilation target", "debug", ["d", "debug", "r", "release"]))
-opts.Add(EnumVariable("platform", "Compilation platform", host_platform, ["", "windows", "x11", "linux", "osx"]))
-opts.Add(
-    EnumVariable(
-        "p",
-        "Compilation target, alias for 'platform'",
-        host_platform,
-        ["", "windows", "x11", "linux", "osx"],
-    )
-)
-opts.Add(EnumVariable("bits", "Target platform bits", "64", ("32", "64")))
-opts.Add(BoolVariable("use_llvm", "Use the LLVM / Clang compiler", "no"))
-opts.Add(PathVariable("target_path", "The path where the lib is installed.", "bin/", PathVariable.PathAccept))
-opts.Add(PathVariable("target_name", "The library name.", "libgdexample", PathVariable.PathAccept))
-
-# Local dependency paths, adapt them to your setup
-godot_headers_path = "../godot-headers/"
-cpp_bindings_path = "../"
-cpp_library = "libgodot-cpp"
-
-# only support 64 at this time..
-bits = 64
-
-# Updates the environment with the option variables.
-opts.Update(env)
-# Generates help for the -h scons option.
-Help(opts.GenerateHelpText(env))
-
-# This makes sure to keep the session environment variables on Windows.
-# This way, you can run SCons in a Visual Studio 2017 prompt and it will find
-# all the required tools
-if host_platform == "windows" and env["platform"] != "android":
-    if env["bits"] == "64":
-        env = Environment(TARGET_ARCH="amd64")
-    elif env["bits"] == "32":
-        env = Environment(TARGET_ARCH="x86")
-
-    opts.Update(env)
-
-# Process some arguments
-if env["use_llvm"]:
-    env["CC"] = "clang"
-    env["CXX"] = "clang++"
-
-if env["p"] != "":
-    env["platform"] = env["p"]
-
-if env["platform"] == "":
-    print("No valid target platform selected.")
-    quit()
-
-# For the reference:
-# - CCFLAGS are compilation flags shared between C and C++
-# - CFLAGS are for C-specific compilation flags
-# - CXXFLAGS are for C++-specific compilation flags
-# - CPPFLAGS are for pre-processor flags
-# - CPPDEFINES are for pre-processor defines
-# - LINKFLAGS are for linking flags
-
-# Check our platform specifics
-if env["platform"] == "osx":
-    env["target_path"] += "osx/"
-    cpp_library += ".osx"
-    env.Append(CCFLAGS=["-arch", "x86_64"])
-    env.Append(CXXFLAGS=["-std=c++17"])
-    env.Append(LINKFLAGS=["-arch", "x86_64"])
-    if env["target"] in ("debug", "d"):
-        env.Append(CCFLAGS=["-g", "-O2"])
-    else:
-        env.Append(CCFLAGS=["-g", "-O3"])
-
-elif env["platform"] in ("x11", "linux"):
-    env["target_path"] += "x11/"
-    cpp_library += ".linux"
-    env.Append(CCFLAGS=["-fPIC"])
-    env.Append(CXXFLAGS=["-std=c++17"])
-    if env["target"] in ("debug", "d"):
-        env.Append(CCFLAGS=["-g3", "-Og"])
-    else:
-        env.Append(CCFLAGS=["-g", "-O3"])
-
-elif env["platform"] == "windows":
-    env["target_path"] += "win64/"
-    cpp_library += ".windows"
-    # This makes sure to keep the session environment variables on windows,
-    # that way you can run scons in a vs 2017 prompt and it will find all the required tools
-    env.Append(ENV=os.environ)
-
-    env.Append(CPPDEFINES=["WIN32", "_WIN32", "_WINDOWS", "_CRT_SECURE_NO_WARNINGS"])
-    env.Append(CCFLAGS=["-W3", "-GR"])
-    env.Append(CXXFLAGS=["-std:c++17"])
-    if env["target"] in ("debug", "d"):
-        env.Append(CPPDEFINES=["_DEBUG"])
-        env.Append(CCFLAGS=["-EHsc", "-MDd", "-ZI"])
-        env.Append(LINKFLAGS=["-DEBUG"])
-    else:
-        env.Append(CPPDEFINES=["NDEBUG"])
-        env.Append(CCFLAGS=["-O2", "-EHsc", "-MD"])
-
-if env["target"] in ("debug", "d"):
-    cpp_library += ".debug"
-else:
-    cpp_library += ".release"
-
-cpp_library += "." + str(bits)
-
-# make sure our binding library is properly includes
-env.Append(
-    CPPPATH=[
-        ".",
-        godot_headers_path,
-        cpp_bindings_path + "include/",
-        cpp_bindings_path + "include/core/",
-        cpp_bindings_path + "include/gen/",
-    ]
-)
-env.Append(LIBPATH=[cpp_bindings_path + "bin/"])
-env.Append(LIBS=[cpp_library])
+env = SConscript("../SConstruct")
 
 # tweak this if you want to use different folders, or more folders, to store your source code in.
-env.Append(CPPPATH=["src/"])
-sources = Glob("src/*.cpp")
-
-library = env.SharedLibrary(target=env["target_path"] + env["target_name"], source=sources)
+env.Append(CPPPATH=['src/'])
+sources = Glob('src/*.cpp')
+
+library = env.SharedLibrary(
+    "bin/libgdexample.{}.{}.{}{}".format(
+        env["platform"], env["target"], env["arch_suffix"], env["SHLIBSUFFIX"]
+    ),
+    source=sources,
+)
 
 Default(library)
diff --git a/test/gdexample.gdnlib b/test/gdexample.gdnlib
index 260b4eab6..9744b98e0 100644
--- a/test/gdexample.gdnlib
+++ b/test/gdexample.gdnlib
@@ -7,10 +7,10 @@ reloadable=false
 
 [entry]
 
-X11.64="res://bin/x11/libgdexample.so"
-Server.64="res://bin/x11/libgdexample.so"
-Windows.64="res://bin/win64/libgdexample.dll"
-OSX.64="res://bin/osx/libgdexample.dylib"
+X11.64="res://bin/libgdexample.linux.release.64.so"
+Server.64="res://bin/libgdexample.linux.release.64.so"
+Windows.64="res://bin/libgdexample.windows.release.64.dll"
+OSX.64="res://bin/libgdexample.osx.release.64.dylib"
 
 [dependencies]
 

From 9451c184b1898865cae0f2fdd6fbde1cf3667cbf Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Thu, 10 Feb 2022 05:53:40 +0100
Subject: [PATCH 16/37] [CI] Matrix build for all platforms.

Test is only run on macOS and Linux.
---
 .github/workflows/ci.yml | 180 +++++++++++++++------------------------
 1 file changed, 71 insertions(+), 109 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d7e566d2e..f7ff1fb9f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -2,9 +2,56 @@ name: Continuous integration
 on: [push, pull_request]
 
 jobs:
-  linux:
-    name: Build (Linux, GCC)
-    runs-on: ubuntu-18.04
+  build:
+    name: ${{ matrix.name }}
+    runs-on: ${{ matrix.os }}
+    strategy:
+      fail-fast: false
+      matrix:
+        include:
+          - name: 🐧 Linux (GCC)
+            os: ubuntu-18.04
+            platform: linux
+            artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
+            artifact-path: bin/libgodot-cpp.linux.release.64.a
+            godot_zip: Godot_v3.4-stable_linux_server.64.zip
+            executable: Godot_v3.4-stable_linux_server.64
+
+          - name: 🏁 Windows (x86_64, MSVC)
+            os: windows-2019
+            platform: windows
+            artifact-name: godot-cpp-windows-msvc2019-x86_64-release
+            artifact-path: bin/libgodot-cpp.windows.release.64.lib
+
+          - name: 🏁 Windows (x86_64, MinGW)
+            os: windows-2019
+            platform: windows
+            artifact-name: godot-cpp-linux-mingw-x86_64-release
+            artifact-path: bin/libgodot-cpp.windows.release.64.a
+            flags: use_mingw=yes
+
+          - name: 🍎 macOS (universal)
+            os: macos-11
+            platform: osx
+            artifact-name: godot-cpp-macos-universal-release
+            artifact-path: bin/libgodot-cpp.osx.release.64.a
+            flags: macos_arch=universal
+            godot_zip: Godot_v3.4-stable_osx.universal.zip
+            executable: Godot.app/Contents/MacOS/Godot
+
+          - name: 🤖 Android (arm64)
+            os: ubuntu-18.04
+            platform: android
+            artifact-name: godot-cpp-android-arm64-release
+            artifact-path: bin/libgodot-cpp.android.release.arm64v8.a
+            flags: android_arch=arm64v8
+
+          - name: 🍏 iOS (arm64)
+            os: macos-11
+            platform: ios
+            artifact-name: godot-cpp-ios-arm64-release
+            artifact-path: bin/libgodot-cpp.ios.release.arm64.a
+
     steps:
       - name: Checkout
         uses: actions/checkout@v2
@@ -16,133 +63,48 @@ jobs:
         with:
           python-version: '3.x'
 
-      - name: Install dependencies
+      - name: Linux dependencies
+        if: ${{ matrix.platform == 'linux' }}
         run: |
           sudo apt-get update -qq
           sudo apt-get install -qqq build-essential pkg-config
-          python -m pip install scons
-          curl -LO https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_linux_server.64.zip
-          unzip Godot_v3.4-stable_linux_server.64.zip
-
-      - name: Build godot-cpp
-        run: |
-          scons target=release generate_bindings=yes -j $(nproc)
-
-      - name: Upload artifact
-        uses: actions/upload-artifact@v2
-        with:
-          name: godot-cpp-linux-glibc2.27-x86_64-release
-          path: bin/libgodot-cpp.linux.release.64.a
-          if-no-files-found: error
 
-      - name: Build test GDNative library
-        run: |
-          scons target=release platform=linux bits=64 -j $(nproc) -C test
-
-      - name: Run test GDNative library
-        run: |
-          ./Godot_v3.4-stable_linux_server.64 --path test -s script.gd
-
-  windows-msvc:
-    name: Build (Windows, MSVC)
-    runs-on: windows-2019
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v2
-        with:
-          submodules: recursive
-
-      - name: Set up Python (for SCons)
-        uses: actions/setup-python@v2
-        with:
-          python-version: '3.x'
-
-      - name: Install dependencies
+      - name: Install scons
         run: |
           python -m pip install scons
 
-      - name: Build godot-cpp
-        run: |
-          scons target=release generate_bindings=yes -j $env:NUMBER_OF_PROCESSORS
-
-      - name: Upload artifact
-        uses: actions/upload-artifact@v2
-        with:
-          name: godot-cpp-windows-msvc2019-x86_64-release
-          path: bin/libgodot-cpp.windows.release.64.lib
-          if-no-files-found: error
-
-  windows-mingw:
-    name: Build (Windows, MinGW)
-    runs-on: windows-2019
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v2
-        with:
-          submodules: recursive
-
-      - name: Set up Python (for SCons)
-        uses: actions/setup-python@v2
-        with:
-          python-version: '3.x'
-
-      - name: Install dependencies
-        run: |
-          python -m pip install scons
-
-      - name: Setup MinGW for Windows/MinGW build
+      - name: Windows dependency (MinGW)
+        if: ${{ matrix.platform == 'windows' }}
         uses: egor-tensin/setup-mingw@v2
 
-      - name: Build godot-cpp
+      - name: Build godot-cpp (debug)
         run: |
-          scons target=release generate_bindings=yes use_mingw=yes -j $env:NUMBER_OF_PROCESSORS
-
-      - name: Upload artifact
-        uses: actions/upload-artifact@v2
-        with:
-          name: godot-cpp-linux-mingw-x86_64-release
-          path: bin/libgodot-cpp.windows.release.64.a
-          if-no-files-found: error
-
-  macos:
-    name: Build (macOS, Clang)
-    runs-on: macos-11
-    steps:
-      - name: Checkout
-        uses: actions/checkout@v2
-        with:
-          submodules: recursive
+          scons platform=${{ matrix.platform }} target=debug generate_bindings=yes ${{ matrix.flags }} -j2
 
-      - name: Set up Python (for SCons)
-        uses: actions/setup-python@v2
-        with:
-          python-version: '3.x'
+      - name: Build test without rebuilding godot-cpp (debug)
+        run: |
+          cd test
+          scons platform=${{ matrix.platform }} target=debug ${{ matrix.flags }} build_library=no -j2
 
-      - name: Install dependencies
+      - name: Build test and godot-cpp (release)
         run: |
-          python -m pip install scons
-          curl -LO https://downloads.tuxfamily.org/godotengine/3.4/Godot_v3.4-stable_osx.universal.zip
-          unzip Godot_v3.4-stable_osx.universal.zip
+          cd test
+          scons platform=${{ matrix.platform }} target=release ${{ matrix.flags }} -j2
 
-      - name: Build godot-cpp
+      - name: Run test GDNative library
+        if: ${{ matrix.platform == 'linux' || matrix.platform == 'osx' }}
         run: |
-          scons target=release generate_bindings=yes -j $(sysctl -n hw.logicalcpu)
+          curl -LO https://downloads.tuxfamily.org/godotengine/3.4/${{ matrix.godot_zip }}
+          unzip ${{ matrix.godot_zip }}
+          ./${{ matrix.executable }} --path test -s script.gd
 
       - name: Upload artifact
         uses: actions/upload-artifact@v2
         with:
-          name: godot-cpp-macos-universal-release
-          path: bin/libgodot-cpp.osx.release.64.a
+          name: ${{ matrix.artifact-name }}
+          path: ${{ matrix.artifact-path }}
           if-no-files-found: error
 
-      - name: Build test GDNative library
-        run: |
-          scons target=release platform=osx bits=64 macos_arch=universal -j $(sysctl -n hw.logicalcpu) -C test
-
-      - name: Run test GDNative library
-        run: |
-          ./Godot.app/Contents/MacOS/Godot --path test -s script.gd
-
   static-checks:
     name: Static Checks (clang-format)
     runs-on: ubuntu-20.04

From f9f6767722e17a1d690f7ce975e1e7f8065b61e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 5 May 2022 00:17:14 +0200
Subject: [PATCH 17/37] headers: Sync with upstream 3.x commit 21827a7

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index dc5282301..0cd4170ca 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit dc528230136c88452a34c9ec47528f17c3a3a2dc
+Subproject commit 0cd4170caa9a56691d4dbd5068a9e5633cf95c08

From 95258f61f494b6b77286287134428b4c6d99c653 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Wed, 18 May 2022 12:56:09 +0200
Subject: [PATCH 18/37] headers: Sync with upstream 3.x commit f33899d

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index 0cd4170ca..1d792d19f 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit 0cd4170caa9a56691d4dbd5068a9e5633cf95c08
+Subproject commit 1d792d19f26d097961db4e69b3b8c7f9e6f2a6cc

From c7b81a15f6d77ff9050076eacfb173f5439a2357 Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Wed, 8 Jun 2022 23:02:21 +0200
Subject: [PATCH 19/37] [SCons] Fix android build with modern NDKs.

---
 SConstruct | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/SConstruct b/SConstruct
index d32bce05a..8343fa0fd 100644
--- a/SConstruct
+++ b/SConstruct
@@ -391,11 +391,11 @@ elif env["platform"] == "android":
     # Setup tools
     env["CC"] = toolchain + "/bin/clang"
     env["CXX"] = toolchain + "/bin/clang++"
-    env["AR"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ar"
-    env["AS"] = toolchain + "/bin/" + arch_info["tool_path"] + "-as"
-    env["LD"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ld"
-    env["STRIP"] = toolchain + "/bin/" + arch_info["tool_path"] + "-strip"
-    env["RANLIB"] = toolchain + "/bin/" + arch_info["tool_path"] + "-ranlib"
+    env["AR"] = toolchain + "/bin/llvm-ar"
+    env["AS"] = toolchain + "/bin/llvm-as"
+    env["LD"] = toolchain + "/bin/llvm-ld"
+    env["STRIP"] = toolchain + "/bin/llvm-strip"
+    env["RANLIB"] = toolchain + "/bin/llvm-ranlib"
     env["SHLIBSUFFIX"] = ".so"
 
     env.Append(

From 7bff71a9f522147c8ef7bac44c1fe450f08145ba Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Mon, 27 Jun 2022 10:40:24 +0200
Subject: [PATCH 20/37] Fix Rect2::distance_to not returning 0.

Was relying on comparison with 1e20 which cannot be represented as
float, causing some epsilon to always be returned and compilers
complaining when using -Werror.
---
 src/core/Rect2.cpp | 24 +++++++++++++++++-------
 1 file changed, 17 insertions(+), 7 deletions(-)

diff --git a/src/core/Rect2.cpp b/src/core/Rect2.cpp
index 7c5fe561e..2b4aaaf4d 100644
--- a/src/core/Rect2.cpp
+++ b/src/core/Rect2.cpp
@@ -46,25 +46,35 @@ namespace godot {
 #endif
 
 real_t Rect2::distance_to(const Vector2 &p_point) const {
-	real_t dist = 1e20;
+	real_t dist = 0.0;
+	bool inside = true;
 
 	if (p_point.x < position.x) {
-		dist = MIN(dist, position.x - p_point.x);
+		real_t d = position.x - p_point.x;
+		dist = d;
+		inside = false;
 	}
 	if (p_point.y < position.y) {
-		dist = MIN(dist, position.y - p_point.y);
+		real_t d = position.y - p_point.y;
+		dist = inside ? d : MIN(dist, d);
+		inside = false;
 	}
 	if (p_point.x >= (position.x + size.x)) {
-		dist = MIN(p_point.x - (position.x + size.x), dist);
+		real_t d = p_point.x - (position.x + size.x);
+		dist = inside ? d : MIN(dist, d);
+		inside = false;
 	}
 	if (p_point.y >= (position.y + size.y)) {
-		dist = MIN(p_point.y - (position.y + size.y), dist);
+		real_t d = p_point.y - (position.y + size.y);
+		dist = inside ? d : MIN(dist, d);
+		inside = false;
 	}
 
-	if (dist == 1e20)
+	if (inside) {
 		return 0;
-	else
+	} else {
 		return dist;
+	}
 }
 
 Rect2 Rect2::clip(const Rect2 &p_rect) const { /// return a clipped rect

From 2b9843d573b6852610a2bb0cc683d3167c790540 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Tue, 28 Jun 2022 21:51:33 +0200
Subject: [PATCH 21/37] headers: Sync with upstream 3.x commit 28d387f72

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index 1d792d19f..219afc98f 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit 1d792d19f26d097961db4e69b3b8c7f9e6f2a6cc
+Subproject commit 219afc98f7e80664584f3988d7861aeaa31bbd8d

From e7ebeccd2527589cc5b8ddaec583355c103bc944 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Sun, 17 Jul 2022 12:34:42 +0200
Subject: [PATCH 22/37] SCons: Default `num_jobs` to max CPUs minus 1 if not
 specified

This doesn't change the behavior when `--jobs`/`-j` is specified as a
command-line argument or in `SCONSFLAGS`.

The SCons hack used to know if `num_jobs` was set by the user is derived
from the MongoDB setup.

We use `os.cpu_count()` for portability (available since Python 3.4).

With 4 CPUs or less, we use the max. With more than 4 we use max - 1 to
preserve some bandwidth for the user's other programs.

Makefile: Dehardcode -j4, SCons defaults to max - 1

(cherry picked from commits cdcd473371018bc2e268d9f8eab4e2de231828d4 and
c2b35fb226bd5e706fce7a9e23926fffefc0498d)
---
 .github/workflows/ci.yml |  6 +++---
 Makefile                 |  2 +-
 SConstruct               | 19 +++++++++++++++++++
 3 files changed, 23 insertions(+), 4 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index f7ff1fb9f..03525bcb1 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -79,17 +79,17 @@ jobs:
 
       - name: Build godot-cpp (debug)
         run: |
-          scons platform=${{ matrix.platform }} target=debug generate_bindings=yes ${{ matrix.flags }} -j2
+          scons platform=${{ matrix.platform }} target=debug generate_bindings=yes ${{ matrix.flags }}
 
       - name: Build test without rebuilding godot-cpp (debug)
         run: |
           cd test
-          scons platform=${{ matrix.platform }} target=debug ${{ matrix.flags }} build_library=no -j2
+          scons platform=${{ matrix.platform }} target=debug ${{ matrix.flags }} build_library=no
 
       - name: Build test and godot-cpp (release)
         run: |
           cd test
-          scons platform=${{ matrix.platform }} target=release ${{ matrix.flags }} -j2
+          scons platform=${{ matrix.platform }} target=release ${{ matrix.flags }}
 
       - name: Run test GDNative library
         if: ${{ matrix.platform == 'linux' || matrix.platform == 'osx' }}
diff --git a/Makefile b/Makefile
index 12ed82136..742905827 100644
--- a/Makefile
+++ b/Makefile
@@ -3,7 +3,7 @@ HEADERS = godot-headers
 TARGET = debug
 USE_CLANG = no
 
-BASE = scons use_llvm=$(USE_CLANG) generate_bindings=$(GENERATE_BINDINGS) target=$(TARGET) headers=$(HEADERS) -j4
+BASE = scons use_llvm=$(USE_CLANG) generate_bindings=$(GENERATE_BINDINGS) target=$(TARGET) headers=$(HEADERS)
 LINUX = $(BASE) platform=linux
 WINDOWS = $(BASE) platform=windows
 OSX = $(BASE) platform=osx
diff --git a/SConstruct b/SConstruct
index 8343fa0fd..9a2a460b8 100644
--- a/SConstruct
+++ b/SConstruct
@@ -81,6 +81,25 @@ else:
 
 env = Environment(ENV=os.environ)
 
+# Default num_jobs to local cpu count if not user specified.
+# SCons has a peculiarity where user-specified options won't be overridden
+# by SetOption, so we can rely on this to know if we should use our default.
+initial_num_jobs = env.GetOption("num_jobs")
+altered_num_jobs = initial_num_jobs + 1
+env.SetOption("num_jobs", altered_num_jobs)
+# os.cpu_count() requires Python 3.4+.
+if hasattr(os, "cpu_count") and env.GetOption("num_jobs") == altered_num_jobs:
+    cpu_count = os.cpu_count()
+    if cpu_count is None:
+        print("Couldn't auto-detect CPU count to configure build parallelism. Specify it with the -j argument.")
+    else:
+        safer_cpu_count = cpu_count if cpu_count <= 4 else cpu_count - 1
+        print(
+            "Auto-detected %d CPU cores available for build parallelism. Using %d cores by default. You can override it with the -j argument."
+            % (cpu_count, safer_cpu_count)
+        )
+        env.SetOption("num_jobs", safer_cpu_count)
+
 is64 = sys.maxsize > 2 ** 32
 if (
     env["TARGET_ARCH"] == "amd64"

From bf0d95369dffec5cb28c9c1a12f58293c32bb31d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 18 Jul 2022 11:55:30 +0200
Subject: [PATCH 23/37] CMake: Don't use `-fPIC` on Windows (#732)

(cherry picked from commits 3c73d1a7a26de39fc2dc019a69c1caf5bb543629
and 9b4519280ab8066e144818faa78d6a317f8ab4ed)
---
 CMakeLists.txt | 30 +++++++++++++-----------------
 1 file changed, 13 insertions(+), 17 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0a8ba1d8b..b0c7afc0a 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,36 +1,36 @@
 # cmake arguments
 # CMAKE_BUILD_TYPE:			Compilation target (Debug or Release defaults to Debug)
-# 
+#
 # godot-cpp cmake arguments
 # GODOT_HEADERS_DIR:		This is where the gdnative include folder is (godot_source/modules/gdnative/include)
 # GODOT_CUSTOM_API_FILE:	This is if you have another path for the godot_api.json
-# 
+#
 # Android cmake arguments
 # CMAKE_TOOLCHAIN_FILE:		The path to the android cmake toolchain ($ANDROID_NDK/build/cmake/android.toolchain.cmake)
 # ANDROID_NDK:				The path to the android ndk root folder
 # ANDROID_TOOLCHAIN_NAME:	The android toolchain (arm-linux-androideabi-4.9 or aarch64-linux-android-4.9 or x86-4.9 or x86_64-4.9)
 # ANDROID_PLATFORM:			The android platform version (android-23)
 # More info here: https://godot.readthedocs.io/en/latest/development/compiling/compiling_for_android.html
-# 
+#
 # Examples
-# 
+#
 # Builds a debug version:
 # cmake .
 # cmake --build .
-# 
+#
 # Builds a release version with clang
 # CC=/usr/bin/clang CXX=/usr/bin/clang++ cmake -DCMAKE_BUILD_TYPE=Release -G "Unix Makefiles" .
 # cmake --build .
-# 
+#
 # Builds an android armeabi-v7a debug version:
 # cmake -DCMAKE_TOOLCHAIN_FILE=$ANDROID_NDK/build/cmake/android.toolchain.cmake -DANDROID_NDK=$ANDROID_NDK \
 #		-DANDROID_TOOLCHAIN_NAME=arm-linux-androideabi-4.9 -DANDROID_PLATFORM=android-23 -DCMAKE_BUILD_TYPE=Debug .
 # cmake --build .
-# 
+#
 # Protip
 # Generate the buildfiles in a sub directory to not clutter the root directory with build files:
 # mkdir build && cd build && cmake -G "Unix Makefiles" .. && cmake --build .
-# 
+#
 # Todo
 # Test build for Windows, Mac and mingw.
 
@@ -97,17 +97,13 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
 	#	string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
 	#endif()
 
-else()
-
-#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-	# using Clang
-#elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
-	# using GCC and maybe MinGW?
-
+else()  # GCC/Clang
 	set(GODOT_LINKER_FLAGS "-static-libgcc -static-libstdc++ -Wl,-R,'$$ORIGIN'")
 
-	# Hmm.. maybe to strikt?
-	set(GODOT_COMPILE_FLAGS "-fPIC -g -Wwrite-strings")
+	if(NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
+		set(GODOT_COMPILE_FLAGS "-fPIC")
+	endif()
+	set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -g -Wwrite-strings")
 	set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wchar-subscripts -Wcomment -Wdisabled-optimization")
 	set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wformat -Wformat=2 -Wformat-security -Wformat-y2k")
 	set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -Wimport -Winit-self -Winline -Winvalid-pch -Werror")

From 43fae056d0b375e583010f69a0a08ade2cd87bcd Mon Sep 17 00:00:00 2001
From: Joshua Cooper <josh@joshdotc.com>
Date: Sat, 5 Feb 2022 15:34:24 -0500
Subject: [PATCH 24/37] CMake: fix CMAKE_BUILD_TYPE and BITS check

(cherry picked from commit 165ad14b0fe39234dd257e421948c23f6571177f)
---
 CMakeLists.txt | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b0c7afc0a..b91f0d2af 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -52,7 +52,7 @@ SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${BUILD_PATH}")
 SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${BUILD_PATH}")
 
 # Default build type is Debug in the SConstruct
-if(CMAKE_BUILD_TYPE STREQUAL "")
+if("${CMAKE_BUILD_TYPE}" STREQUAL "")
 	set(CMAKE_BUILD_TYPE Debug)
 endif()
 
@@ -67,6 +67,13 @@ set(CMAKE_CXX_STANDARD 14)
 set(CMAKE_CXX_STANDARD_REQUIRED ON)
 set(CMAKE_CXX_EXTENSIONS OFF)
 
+if(NOT DEFINED BITS)
+	set(BITS 32)
+	if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+		set(BITS 64)
+	endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
+endif()
+
 # Input from user for godot headers and the api file
 set(GODOT_HEADERS_DIR "godot-headers" CACHE STRING "")
 set(GODOT_CUSTOM_API_FILE "godot-headers/api.json" CACHE STRING "")
@@ -190,11 +197,6 @@ set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LI
 
 # Create the correct name (godot.os.build_type.system_bits)
 
-set(BITS 32)
-if(CMAKE_SIZEOF_VOID_P EQUAL 8)
-	set(BITS 64)
-endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
-
 string(TOLOWER "${CMAKE_SYSTEM_NAME}" SYSTEM_NAME)
 string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE)
 

From 15e173d1596b55e87b16475c08fc97d54832b47b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 18 Jul 2022 14:46:34 +0200
Subject: [PATCH 25/37] headers: Sync with upstream 3.x commit 3f6dd3352

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index 219afc98f..e7f1ef2b0 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit 219afc98f7e80664584f3988d7861aeaa31bbd8d
+Subproject commit e7f1ef2b05b349b412ea4af5da6f0180288e0784

From db93fbb5f71c58fea55361f44ecff21e1d9271ab Mon Sep 17 00:00:00 2001
From: Hugo Locurcio <hugo.locurcio@hugo.pro>
Date: Tue, 23 Nov 2021 22:41:52 +0100
Subject: [PATCH 26/37] Print a warning with unknown SCons variables to ease
 troubleshooting

(cherry picked from commit 1e2eafe7773aec847049e8be4ca9b5dd929729c1)
---
 SConstruct | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/SConstruct b/SConstruct
index 9a2a460b8..ed85d6eae 100644
--- a/SConstruct
+++ b/SConstruct
@@ -183,6 +183,13 @@ opts.Add(BoolVariable("build_library", "Build the godot-cpp library.", True))
 opts.Update(env)
 Help(opts.GenerateHelpText(env))
 
+# Detect and print a warning listing unknown SCons variables to ease troubleshooting.
+unknown = opts.UnknownVariables()
+if unknown:
+    print("WARNING: Unknown SCons variables were passed and will be ignored:")
+    for item in unknown.items():
+        print("    " + item[0] + "=" + item[1])
+
 # This makes sure to keep the session environment variables on Windows.
 # This way, you can run SCons in a Visual Studio 2017 prompt and it will find
 # all the required tools

From a930046796b06ac89364c7616ccac59a6ebaa85f Mon Sep 17 00:00:00 2001
From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com>
Date: Fri, 8 Apr 2022 19:14:25 +0000
Subject: [PATCH 27/37] Bump actions/upload-artifact from 2 to 3

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
(cherry picked from commit 4963e6f3fc395948aed784a44587430e643c358f)
---
 .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 03525bcb1..1241c38c3 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -99,7 +99,7 @@ jobs:
           ./${{ matrix.executable }} --path test -s script.gd
 
       - name: Upload artifact
-        uses: actions/upload-artifact@v2
+        uses: actions/upload-artifact@v3
         with:
           name: ${{ matrix.artifact-name }}
           path: ${{ matrix.artifact-path }}

From dac7dc2a3563788dc7cc86f003f87613dfbd775a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Mon, 18 Jul 2022 11:42:01 +0200
Subject: [PATCH 28/37] CI: Use setup-python@v4

(cherry picked from commit c7a30aec030c23f088fa3b1e90fcd695c9de5349)
---
 .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 1241c38c3..abd210b5f 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -59,7 +59,7 @@ jobs:
           submodules: recursive
 
       - name: Set up Python (for SCons)
-        uses: actions/setup-python@v2
+        uses: actions/setup-python@v4
         with:
           python-version: '3.x'
 

From 7a193d385729616e0b21831beb91f7ff25865bc2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Fri, 22 Jul 2022 11:07:49 +0200
Subject: [PATCH 29/37] headers: Sync with upstream 3.x commit 38b95cc2f

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index e7f1ef2b0..e8d27f945 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit e7f1ef2b05b349b412ea4af5da6f0180288e0784
+Subproject commit e8d27f9452e42ef343ceb9e1d114767892ec6346

From 867374da404887337909e8b7b9de5a8acbc47569 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Wed, 3 Aug 2022 10:13:24 +0200
Subject: [PATCH 30/37] headers: Sync with upstream 3.x commit a1c0be731

---
 godot-headers | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/godot-headers b/godot-headers
index e8d27f945..1049927a5 160000
--- a/godot-headers
+++ b/godot-headers
@@ -1 +1 @@
-Subproject commit e8d27f9452e42ef343ceb9e1d114767892ec6346
+Subproject commit 1049927a596402cd2e8215cd6624868929f5f18d

From 02333f8dae5430453dfa7abcdc8fb23338964bd3 Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Thu, 28 Jul 2022 05:48:30 +0200
Subject: [PATCH 31/37] [CI] Fix Android builds after GH container update.

(cherry picked from commit 0943dfc34a75436e754b6f56c7ed2a061df99585)
---
 .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 abd210b5f..d98dd75d2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -44,7 +44,7 @@ jobs:
             platform: android
             artifact-name: godot-cpp-android-arm64-release
             artifact-path: bin/libgodot-cpp.android.release.arm64v8.a
-            flags: android_arch=arm64v8
+            flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME android_arch=arm64v8
 
           - name: 🍏 iOS (arm64)
             os: macos-11

From 62714899ff708164f481a9c81df3765afa8fdc63 Mon Sep 17 00:00:00 2001
From: Aaron Franke <arnfranke@yahoo.com>
Date: Wed, 7 Sep 2022 22:23:32 -0500
Subject: [PATCH 32/37] Upgrade 3.x CI to Godot 3.5-stable

---
 .github/workflows/ci.yml | 10 +++++-----
 .gitignore               |  1 +
 2 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d98dd75d2..a7e4aa9b4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,8 +14,8 @@ jobs:
             platform: linux
             artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
             artifact-path: bin/libgodot-cpp.linux.release.64.a
-            godot_zip: Godot_v3.4-stable_linux_server.64.zip
-            executable: Godot_v3.4-stable_linux_server.64
+            godot_zip: Godot_v3.5-stable_linux_server.64.zip
+            executable: Godot_v3.5-stable_linux_server.64
 
           - name: 🏁 Windows (x86_64, MSVC)
             os: windows-2019
@@ -36,7 +36,7 @@ jobs:
             artifact-name: godot-cpp-macos-universal-release
             artifact-path: bin/libgodot-cpp.osx.release.64.a
             flags: macos_arch=universal
-            godot_zip: Godot_v3.4-stable_osx.universal.zip
+            godot_zip: Godot_v3.5-stable_osx.universal.zip
             executable: Godot.app/Contents/MacOS/Godot
 
           - name: 🤖 Android (arm64)
@@ -94,7 +94,7 @@ jobs:
       - name: Run test GDNative library
         if: ${{ matrix.platform == 'linux' || matrix.platform == 'osx' }}
         run: |
-          curl -LO https://downloads.tuxfamily.org/godotengine/3.4/${{ matrix.godot_zip }}
+          curl -LO https://downloads.tuxfamily.org/godotengine/3.5/${{ matrix.godot_zip }}
           unzip ${{ matrix.godot_zip }}
           ./${{ matrix.executable }} --path test -s script.gd
 
@@ -106,7 +106,7 @@ jobs:
           if-no-files-found: error
 
   static-checks:
-    name: Static Checks (clang-format)
+    name: 📊 Static Checks (clang-format)
     runs-on: ubuntu-20.04
     steps:
       - name: Checkout
diff --git a/.gitignore b/.gitignore
index f164f670f..a3be9ca4f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,4 +1,5 @@
 # Misc
+gen/*
 logs/*
 *.log
 

From 686db8ea6e5a6fdeff3abaf4392325d3166057d3 Mon Sep 17 00:00:00 2001
From: Fabio Alessandrelli <fabio.alessandrelli@gmail.com>
Date: Thu, 29 Dec 2022 16:17:49 +0100
Subject: [PATCH 33/37] [SCons] Backport SCons generator, cache.

---
 .github/actions/godot-cache/action.yml | 22 +++++++++++
 .github/workflows/ci.yml               | 31 +++++++++++++++-
 .gitignore                             |  3 ++
 SConstruct                             | 49 ++++++++++---------------
 binding_generator.py                   | 51 ++++++++++++++------------
 misc/scripts/check_get_file_list.py    | 31 ++++++++++++++++
 6 files changed, 133 insertions(+), 54 deletions(-)
 create mode 100644 .github/actions/godot-cache/action.yml
 create mode 100755 misc/scripts/check_get_file_list.py

diff --git a/.github/actions/godot-cache/action.yml b/.github/actions/godot-cache/action.yml
new file mode 100644
index 000000000..2d7afc851
--- /dev/null
+++ b/.github/actions/godot-cache/action.yml
@@ -0,0 +1,22 @@
+name: Setup Godot build cache
+description: Setup Godot build cache.
+inputs:
+  cache-name:
+    description: The cache base name (job name by default).
+    default: "${{github.job}}"
+  scons-cache:
+    description: The scons cache path.
+    default: "${{github.workspace}}/.scons-cache/"
+runs:
+  using: "composite"
+  steps:
+    # Upload cache on completion and check it out now
+    - name: Load .scons_cache directory
+      uses: actions/cache@v3
+      with:
+        path: ${{inputs.scons-cache}}
+        key: ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+        restore-keys: |
+          ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}-${{github.sha}}
+          ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}-${{github.ref}}
+          ${{inputs.cache-name}}-${{env.GODOT_BASE_BRANCH}}
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index a7e4aa9b4..3e472285e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,6 +1,14 @@
 name: Continuous integration
 on: [push, pull_request]
 
+env:
+  # Only used for the cache key. Increment version to force clean build.
+  GODOT_BASE_BRANCH: 3.x
+
+concurrency:
+  group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}
+  cancel-in-progress: true
+
 jobs:
   build:
     name: ${{ matrix.name }}
@@ -16,12 +24,14 @@ jobs:
             artifact-path: bin/libgodot-cpp.linux.release.64.a
             godot_zip: Godot_v3.5-stable_linux_server.64.zip
             executable: Godot_v3.5-stable_linux_server.64
+            cache-name: linux-x86_64
 
           - name: 🏁 Windows (x86_64, MSVC)
             os: windows-2019
             platform: windows
             artifact-name: godot-cpp-windows-msvc2019-x86_64-release
             artifact-path: bin/libgodot-cpp.windows.release.64.lib
+            cache-name: windows-x86_64-msvc
 
           - name: 🏁 Windows (x86_64, MinGW)
             os: windows-2019
@@ -29,6 +39,7 @@ jobs:
             artifact-name: godot-cpp-linux-mingw-x86_64-release
             artifact-path: bin/libgodot-cpp.windows.release.64.a
             flags: use_mingw=yes
+            cache-name: windows-x86_64-mingw
 
           - name: 🍎 macOS (universal)
             os: macos-11
@@ -38,6 +49,7 @@ jobs:
             flags: macos_arch=universal
             godot_zip: Godot_v3.5-stable_osx.universal.zip
             executable: Godot.app/Contents/MacOS/Godot
+            cache-name: macos-unversal
 
           - name: 🤖 Android (arm64)
             os: ubuntu-18.04
@@ -45,12 +57,17 @@ jobs:
             artifact-name: godot-cpp-android-arm64-release
             artifact-path: bin/libgodot-cpp.android.release.arm64v8.a
             flags: ANDROID_NDK_ROOT=$ANDROID_NDK_LATEST_HOME android_arch=arm64v8
+            cache-name: android-arm64
 
           - name: 🍏 iOS (arm64)
             os: macos-11
             platform: ios
             artifact-name: godot-cpp-ios-arm64-release
             artifact-path: bin/libgodot-cpp.ios.release.arm64.a
+            cache-name: ios-arm64
+
+    env:
+      SCONS_CACHE: ${{ github.workspace }}/.scons-cache/
 
     steps:
       - name: Checkout
@@ -58,6 +75,12 @@ jobs:
         with:
           submodules: recursive
 
+      - name: Setup Godot build cache
+        uses: ./.github/actions/godot-cache
+        with:
+          cache-name: ${{ matrix.cache-name }}
+        continue-on-error: true
+
       - name: Set up Python (for SCons)
         uses: actions/setup-python@v4
         with:
@@ -79,7 +102,7 @@ jobs:
 
       - name: Build godot-cpp (debug)
         run: |
-          scons platform=${{ matrix.platform }} target=debug generate_bindings=yes ${{ matrix.flags }}
+          scons platform=${{ matrix.platform }} target=debug ${{ matrix.flags }}
 
       - name: Build test without rebuilding godot-cpp (debug)
         run: |
@@ -111,6 +134,8 @@ jobs:
     steps:
       - name: Checkout
         uses: actions/checkout@v2
+        with:
+          submodules: recursive
 
       - name: Make apt sources.list use the default Ubuntu repositories
         run: |
@@ -127,3 +152,7 @@ jobs:
       - name: Style checks via clang-format
         run: |
           bash ./misc/scripts/clang_format.sh
+
+      - name: Bindings generation checks (ensures get_file_list returns all generated files)
+        run: |
+          python ./misc/scripts/check_get_file_list.py
diff --git a/.gitignore b/.gitignore
index a3be9ca4f..b031b692e 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,6 +3,9 @@ gen/*
 logs/*
 *.log
 
+# The default cache directory
+.scons_cache/
+
 # Binaries
 *.o
 *.os
diff --git a/SConstruct b/SConstruct
index ed85d6eae..f653d5481 100644
--- a/SConstruct
+++ b/SConstruct
@@ -3,6 +3,7 @@
 import os
 import sys
 import subprocess
+from binding_generator import scons_generate_bindings, scons_emit_files
 
 if sys.version_info < (3,):
 
@@ -133,15 +134,7 @@ opts.Add(
     )
 )
 opts.Add(PathVariable("custom_api_file", "Path to a custom JSON API file", None, PathVariable.PathIsFile))
-opts.Add(
-    EnumVariable(
-        "generate_bindings",
-        "Generate GDNative API bindings",
-        "auto",
-        allowed_values=["yes", "no", "auto", "true"],
-        ignorecase=2,
-    )
-)
+opts.Add(BoolVariable("generate_bindings", "Force GDNative API bindings generation.", False))
 opts.Add(
     EnumVariable(
         "android_arch",
@@ -472,17 +465,14 @@ elif env["platform"] == "javascript":
     elif env["target"] == "release":
         env.Append(CCFLAGS=["-O3"])
 
-env.Append(
-    CPPPATH=[
-        ".",
-        env["headers_dir"],
-        "include",
-        "include/gen",
-        "include/core",
-    ]
-)
+# Cache
+scons_cache_path = os.environ.get("SCONS_CACHE")
+if scons_cache_path is not None:
+    CacheDir(scons_cache_path)
+    Decider("MD5")
 
-# Generate bindings?
+# Generate bindings
+env.Append(BUILDERS={"GenerateBindings": Builder(action=scons_generate_bindings, emitter=scons_emit_files)})
 json_api_file = ""
 
 if "custom_api_file" in env:
@@ -490,22 +480,22 @@ if "custom_api_file" in env:
 else:
     json_api_file = os.path.join(os.getcwd(), env["headers_dir"], "api.json")
 
-if env["generate_bindings"] == "auto":
-    # Check if generated files exist
-    should_generate_bindings = not os.path.isfile(os.path.join(os.getcwd(), "src", "gen", "Object.cpp"))
-else:
-    should_generate_bindings = env["generate_bindings"] in ["yes", "true"]
+bindings = env.GenerateBindings(
+    env.Dir("."), [json_api_file, "binding_generator.py"]
+)
 
-if should_generate_bindings:
-    # Actually create the bindings here
-    import binding_generator
+# Forces bindings regeneration.
+if env["generate_bindings"]:
+    AlwaysBuild(bindings)
+    NoCache(bindings)
 
-    binding_generator.generate_bindings(json_api_file, env["generate_template_get_node"])
+# Includes
+env.Append(CPPPATH=[[env.Dir(d) for d in [".", env["headers_dir"], "include", "include/gen", "include/core"]]])
 
 # Sources to compile
 sources = []
 add_sources(sources, "src/core", "cpp")
-add_sources(sources, "src/gen", "cpp")
+sources.extend(f for f in bindings if str(f).endswith(".cpp"))
 
 arch_suffix = env["bits"]
 if env["platform"] == "android":
@@ -530,7 +520,6 @@ if env["build_library"]:
     library = env.StaticLibrary(target=env.File("bin/%s" % library_name), source=sources)
     Default(library)
 
-env.Append(CPPPATH=[env.Dir(f) for f in [env["headers_dir"], "include", "include/gen", "include/core"]])
 env.Append(LIBPATH=[env.Dir("bin")])
 env.Append(LIBS=library_name)
 Return("env")
diff --git a/binding_generator.py b/binding_generator.py
index 4a42e56ba..da4bb61c4 100644
--- a/binding_generator.py
+++ b/binding_generator.py
@@ -15,9 +15,9 @@ def correct_method_name(method_list):
 classes = []
 
 
-def print_file_list(api_filepath, output_dir, headers=False, sources=False):
+def get_file_list(api_filepath, output_dir, headers=False, sources=False):
     global classes
-    end = ";"
+    files = []
     with open(api_filepath) as api_file:
         classes = json.load(api_file)
     include_gen_folder = Path(output_dir) / "include" / "gen"
@@ -26,17 +26,35 @@ def print_file_list(api_filepath, output_dir, headers=False, sources=False):
         header_filename = include_gen_folder / (strip_name(_class["name"]) + ".hpp")
         source_filename = source_gen_folder / (strip_name(_class["name"]) + ".cpp")
         if headers:
-            print(str(header_filename.as_posix()), end=end)
+            files.append(str(header_filename.as_posix()))
         if sources:
-            print(str(source_filename.as_posix()), end=end)
+            files.append(str(source_filename.as_posix()))
     icall_header_filename = include_gen_folder / "__icalls.hpp"
     register_types_filename = source_gen_folder / "__register_types.cpp"
     init_method_bindings_filename = source_gen_folder / "__init_method_bindings.cpp"
     if headers:
-        print(str(icall_header_filename.as_posix()), end=end)
+        files.append(str(icall_header_filename.as_posix()))
     if sources:
-        print(str(register_types_filename.as_posix()), end=end)
-        print(str(init_method_bindings_filename.as_posix()), end=end)
+        files.append(str(register_types_filename.as_posix()))
+        files.append(str(init_method_bindings_filename.as_posix()))
+    return files
+
+
+def print_file_list(api_filepath, output_dir, headers=False, sources=False):
+    for f in get_file_list(api_filepath, output_dir, headers, sources):
+        print(f, end=";")
+
+
+def scons_emit_files(target, source, env):
+    files = [env.File(f) for f in get_file_list(str(source[0]), target[0].abspath, True, True)]
+    env.Clean(target, files)
+    env["godot_cpp_gen_dir"] = target[0].abspath
+    return files, source
+
+
+def scons_generate_bindings(target, source, env):
+    generate_bindings(str(source[0]), env["generate_template_get_node"], env["godot_cpp_gen_dir"])
+    return None
 
 
 def generate_bindings(api_filepath, use_template_get_node, output_dir="."):
@@ -48,25 +66,12 @@ def generate_bindings(api_filepath, use_template_get_node, output_dir="."):
     include_gen_folder = Path(output_dir) / "include" / "gen"
     source_gen_folder = Path(output_dir) / "src" / "gen"
 
-    try:
-        include_gen_folder.mkdir(parents=True)
-    except os.error as e:
-        if e.errno == errno.EEXIST:
-            print(str(source_gen_folder) + ": " + os.strerror(e.errno))
-        else:
-            exit(1)
-
-    try:
-        source_gen_folder.mkdir(parents=True)
-    except os.error as e:
-        if e.errno == errno.EEXIST:
-            print(str(source_gen_folder) + ": " + os.strerror(e.errno))
-        else:
-            exit(1)
+    include_gen_folder.mkdir(parents=True, exist_ok=True)
+    source_gen_folder.mkdir(parents=True, exist_ok=True)
 
     for c in classes:
         # print(c['name'])
-        used_classes = get_used_classes(c)
+        used_classes = sorted(get_used_classes(c))
         if use_template_get_node and c["name"] == "Node":
             correct_method_name(c["methods"])
 
diff --git a/misc/scripts/check_get_file_list.py b/misc/scripts/check_get_file_list.py
new file mode 100755
index 000000000..4295504b8
--- /dev/null
+++ b/misc/scripts/check_get_file_list.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python
+
+import os, sys
+
+from pathlib import Path
+
+sys.path.insert(1, os.path.join(os.path.dirname(__file__), "..", ".."))
+
+from binding_generator import get_file_list, generate_bindings
+
+api_filepath = "godot-headers/api.json"
+bits = "64"
+double = "float"
+output_dir = "self_test"
+
+generate_bindings(api_filepath, use_template_get_node=False, output_dir=output_dir)
+flist = get_file_list(api_filepath, output_dir, headers=True, sources=True)
+
+p = Path(output_dir)
+allfiles = [str(f.as_posix()) for f in p.glob("**/*.*")]
+missing = list(filter((lambda f: f not in flist), allfiles))
+extras = list(filter((lambda f: f not in allfiles), flist))
+if len(missing) > 0 or len(extras) > 0:
+    print("Error!")
+    for f in missing:
+        print("MISSING: " + str(f))
+    for f in extras:
+        print("EXTRA: " + str(f))
+    sys.exit(1)
+else:
+    print("OK!")

From 102e3c8d1602d099976c3a2533b9f79f23b01e78 Mon Sep 17 00:00:00 2001
From: Aaron Franke <arnfranke@yahoo.com>
Date: Fri, 7 Jul 2023 21:44:24 -0500
Subject: [PATCH 34/37] Bump Ubuntu version on CI from 18.04 to 20.04

---
 .github/workflows/ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 3e472285e..9a2836e02 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -18,7 +18,7 @@ jobs:
       matrix:
         include:
           - name: 🐧 Linux (GCC)
-            os: ubuntu-18.04
+            os: ubuntu-20.04
             platform: linux
             artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
             artifact-path: bin/libgodot-cpp.linux.release.64.a
@@ -52,7 +52,7 @@ jobs:
             cache-name: macos-unversal
 
           - name: 🤖 Android (arm64)
-            os: ubuntu-18.04
+            os: ubuntu-20.04
             platform: android
             artifact-name: godot-cpp-android-arm64-release
             artifact-path: bin/libgodot-cpp.android.release.arm64v8.a

From 5f401ad88ab5d5cbffb1706ffdbe66a31d6ef516 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Tue, 26 Sep 2023 22:58:12 +0200
Subject: [PATCH 35/37] CI: Update all images and actions

---
 .github/workflows/ci.yml | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index 9a2836e02..b353c05a2 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -20,21 +20,21 @@ jobs:
           - name: 🐧 Linux (GCC)
             os: ubuntu-20.04
             platform: linux
-            artifact-name: godot-cpp-linux-glibc2.27-x86_64-release
+            artifact-name: godot-cpp-linux-glibc2.31-x86_64-release
             artifact-path: bin/libgodot-cpp.linux.release.64.a
             godot_zip: Godot_v3.5-stable_linux_server.64.zip
             executable: Godot_v3.5-stable_linux_server.64
             cache-name: linux-x86_64
 
           - name: 🏁 Windows (x86_64, MSVC)
-            os: windows-2019
+            os: windows-2022
             platform: windows
             artifact-name: godot-cpp-windows-msvc2019-x86_64-release
             artifact-path: bin/libgodot-cpp.windows.release.64.lib
             cache-name: windows-x86_64-msvc
 
           - name: 🏁 Windows (x86_64, MinGW)
-            os: windows-2019
+            os: windows-2022
             platform: windows
             artifact-name: godot-cpp-linux-mingw-x86_64-release
             artifact-path: bin/libgodot-cpp.windows.release.64.a
@@ -42,7 +42,7 @@ jobs:
             cache-name: windows-x86_64-mingw
 
           - name: 🍎 macOS (universal)
-            os: macos-11
+            os: macos-13
             platform: osx
             artifact-name: godot-cpp-macos-universal-release
             artifact-path: bin/libgodot-cpp.osx.release.64.a
@@ -60,7 +60,7 @@ jobs:
             cache-name: android-arm64
 
           - name: 🍏 iOS (arm64)
-            os: macos-11
+            os: macos-13
             platform: ios
             artifact-name: godot-cpp-ios-arm64-release
             artifact-path: bin/libgodot-cpp.ios.release.arm64.a
@@ -71,7 +71,7 @@ jobs:
 
     steps:
       - name: Checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
         with:
           submodules: recursive
 
@@ -133,7 +133,7 @@ jobs:
     runs-on: ubuntu-20.04
     steps:
       - name: Checkout
-        uses: actions/checkout@v2
+        uses: actions/checkout@v4
         with:
           submodules: recursive
 

From a4aecf3295bd6e1b9d5f9933f3ba623207fcaf00 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Wed, 4 Oct 2023 13:42:43 +0200
Subject: [PATCH 36/37] CI: Fix MinGW install error by pinning to earlier
 version

Works around https://github.com/egor-tensin/setup-mingw/issues/14.

(cherry picked from commit 0369f6fea031886a49e650fe5577e246adbeed39)
---
 .github/workflows/ci.yml | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index b353c05a2..13f8851e4 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -99,6 +99,8 @@ jobs:
       - name: Windows dependency (MinGW)
         if: ${{ matrix.platform == 'windows' }}
         uses: egor-tensin/setup-mingw@v2
+        with:
+          version: 12.2.0
 
       - name: Build godot-cpp (debug)
         run: |

From cc8c15c32f33d0707aef27996a176f69c94393ac Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= <rverschelde@gmail.com>
Date: Thu, 18 Jul 2024 10:39:14 +0200
Subject: [PATCH 37/37] SCons: Remove old Python 2 compat code

---
 SConstruct | 14 ++------------
 1 file changed, 2 insertions(+), 12 deletions(-)

diff --git a/SConstruct b/SConstruct
index f653d5481..4d8f30b35 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1,21 +1,11 @@
 #!/usr/bin/env python
 
+import codecs
 import os
 import sys
 import subprocess
 from binding_generator import scons_generate_bindings, scons_emit_files
 
-if sys.version_info < (3,):
-
-    def decode_utf8(x):
-        return x
-
-else:
-    import codecs
-
-    def decode_utf8(x):
-        return codecs.utf_8_decode(x)[0]
-
 
 # Workaround for MinGW. See:
 # http://www.scons.org/wiki/LongCmdLinesOnWin32
@@ -258,7 +248,7 @@ elif env["platform"] == "ios":
         env.Append(CCFLAGS=["-miphoneos-version-min=10.0"])
 
     try:
-        sdk_path = decode_utf8(subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-path"]).strip())
+        sdk_path = codecs.utf_8_decode(subprocess.check_output(["xcrun", "--sdk", sdk_name, "--show-sdk-path"]).strip())[0]
     except (subprocess.CalledProcessError, OSError):
         raise ValueError("Failed to find SDK path while running xcrun --sdk {} --show-sdk-path.".format(sdk_name))
 
