Compare commits

...

7 Commits

Author SHA1 Message Date
David Snopek 6a73abc560
Merge 2cc967787a into 631cd5fe37 2024-01-24 14:44:34 +00:00
MJacred 2cc967787a Update README: fix godot-cpp issue tracker url
(cherry picked from commit 8a535d0ecc)
2024-01-24 08:44:28 -06:00
Rémi Verschelde 631cd5fe37
Merge pull request #1306 from dsnopek/4.1-cherrypicks-6
Cherry-picks for the godot-cpp 4.1 branch - 6th batch
2023-11-13 20:28:26 +01:00
Alex Drozd 731a10a4ea ignoring venv in .gitignore
(cherry picked from commit 92dd34ae96)
2023-11-13 13:00:24 -06:00
Thaddeus Crews a1ae58448c fix is_msvc and use_hot_reload variables
(cherry picked from commit 648b8c4489)
2023-11-13 13:00:24 -06:00
Thaddeus Crews 805cdde0b7 GDCLASS synced by ending with "private:"
• Matches implementation used by modules and godot itself
• Apply same to GDEXTENSION_CLASS, setup with same diff-friendly spacers as GDCLASS

(cherry picked from commit 6eb5d450bd)
2023-11-13 13:00:24 -06:00
Fredia Huya-Kouadio 29335d8f5c Update the environment variables used to access the Android NDK toolchain
(cherry picked from commit 86dbd5fa0d)
2023-11-13 13:00:24 -06:00
5 changed files with 130 additions and 106 deletions

4
.gitignore vendored
View File

@ -191,3 +191,7 @@ godot.creator.*
# compile commands (https://clang.llvm.org/docs/JSONCompilationDatabase.html) # compile commands (https://clang.llvm.org/docs/JSONCompilationDatabase.html)
compile_commands.json compile_commands.json
# Python development
.venv
venv

View File

@ -57,7 +57,7 @@ first-party `godot-cpp` extension.
Some compatibility breakage is to be expected as GDExtension and `godot-cpp` Some compatibility breakage is to be expected as GDExtension and `godot-cpp`
get more used, documented, and critical issues get resolved. See the get more used, documented, and critical issues get resolved. See the
[Godot issue tracker](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+label%3Atopic%3Agdextension) [Godot issue tracker](https://github.com/godotengine/godot/issues?q=is%3Aissue+is%3Aopen+label%3Atopic%3Agdextension)
and the [godot-cpp issue tracker](https://github.com/godotengine/godot/issues) and the [godot-cpp issue tracker](https://github.com/godotengine/godot-cpp/issues)
for a list of known issues, and be sure to provide feedback on issues and PRs for a list of known issues, and be sure to provide feedback on issues and PRs
which affect your use of this extension. which affect your use of this extension.

View File

@ -325,10 +325,12 @@ public:
_gde_binding_create_callback, \ _gde_binding_create_callback, \
_gde_binding_free_callback, \ _gde_binding_free_callback, \
_gde_binding_reference_callback, \ _gde_binding_reference_callback, \
}; }; \
\
private:
// Don't use this for your classes, use GDCLASS() instead. // Don't use this for your classes, use GDCLASS() instead.
#define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) \ #define GDEXTENSION_CLASS_ALIAS(m_class, m_alias_for, m_inherits) /******************************************************************************************************************/ \
private: \ private: \
inline static ::godot::internal::EngineClassRegistration<m_class> _gde_engine_class_registration_helper; \ inline static ::godot::internal::EngineClassRegistration<m_class> _gde_engine_class_registration_helper; \
void operator=(const m_class &p_rval) {} \ void operator=(const m_class &p_rval) {} \
@ -357,6 +359,10 @@ protected:
return nullptr; \ return nullptr; \
} \ } \
\ \
static inline bool has_get_property_list() { \
return false; \
} \
\
static void (Wrapped::*_get_get_property_list())(List<PropertyInfo> * p_list) const { \ static void (Wrapped::*_get_get_property_list())(List<PropertyInfo> * p_list) const { \
return nullptr; \ return nullptr; \
} \ } \
@ -369,6 +375,10 @@ protected:
return nullptr; \ return nullptr; \
} \ } \
\ \
static void (Wrapped::*_get_validate_property())(::godot::PropertyInfo & p_property) const { \
return nullptr; \
} \
\
static String (Wrapped::*_get_to_string())() const { \ static String (Wrapped::*_get_to_string())() const { \
return nullptr; \ return nullptr; \
} \ } \
@ -391,10 +401,6 @@ public:
return nullptr; \ return nullptr; \
} \ } \
\ \
static GDExtensionClassInstancePtr recreate(void *data, GDExtensionObjectPtr obj) { \
return nullptr; \
} \
\
static void free(void *data, GDExtensionClassInstancePtr ptr) { \ static void free(void *data, GDExtensionClassInstancePtr ptr) { \
} \ } \
\ \
@ -415,7 +421,9 @@ public:
_gde_binding_free_callback, \ _gde_binding_free_callback, \
_gde_binding_reference_callback, \ _gde_binding_reference_callback, \
}; \ }; \
m_class() : m_class(#m_alias_for) {} m_class() : m_class(#m_alias_for) {} \
\
private:
// Don't use this for your classes, use GDCLASS() instead. // Don't use this for your classes, use GDCLASS() instead.
#define GDEXTENSION_CLASS(m_class, m_inherits) GDEXTENSION_CLASS_ALIAS(m_class, m_class, m_inherits) #define GDEXTENSION_CLASS(m_class, m_inherits) GDEXTENSION_CLASS_ALIAS(m_class, m_class, m_inherits)

View File

@ -11,20 +11,32 @@ def options(opts):
"21", "21",
) )
opts.Add( opts.Add(
"ANDROID_NDK_ROOT", "ANDROID_HOME",
"Path to your Android NDK installation. By default, uses ANDROID_NDK_ROOT from your defined environment variables.", "Path to your Android SDK installation. By default, uses ANDROID_HOME from your defined environment variables.",
os.environ.get("ANDROID_NDK_ROOT", None), os.environ.get("ANDROID_HOME", os.environ.get("ANDROID_SDK_ROOT")),
) )
def exists(env): def exists(env):
return "ANDROID_NDK_ROOT" in os.environ or "ANDROID_NDK_ROOT" in ARGUMENTS return get_android_ndk_root(env) is not None
# This must be kept in sync with the value in https://github.com/godotengine/godot/blob/master/platform/android/detect.py#L58.
def get_ndk_version():
return "23.2.8568313"
def get_android_ndk_root(env):
if env["ANDROID_HOME"]:
return env["ANDROID_HOME"] + "/ndk/" + get_ndk_version()
else:
return os.environ.get("ANDROID_NDK_ROOT")
def generate(env): def generate(env):
if "ANDROID_NDK_ROOT" not in env: if get_android_ndk_root(env) is None:
raise ValueError( 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." "To build for Android, the path to the NDK must be defined. Please set ANDROID_HOME to the root folder of your Android SDK installation."
) )
if env["arch"] not in ("arm64", "x86_64", "arm32", "x86_32"): if env["arch"] not in ("arm64", "x86_64", "arm32", "x86_32"):
@ -40,7 +52,7 @@ def generate(env):
env["android_api_level"] = "21" env["android_api_level"] = "21"
# Setup toolchain # Setup toolchain
toolchain = env["ANDROID_NDK_ROOT"] + "/toolchains/llvm/prebuilt/" toolchain = get_android_ndk_root(env) + "/toolchains/llvm/prebuilt/"
if sys.platform == "win32" or sys.platform == "msys": if sys.platform == "win32" or sys.platform == "msys":
toolchain += "windows" toolchain += "windows"
import platform as pltfm import platform as pltfm

View File

@ -239,6 +239,15 @@ def generate(env):
print("Building for architecture " + env["arch"] + " on platform " + env["platform"]) print("Building for architecture " + env["arch"] + " on platform " + env["platform"])
tool = Tool(env["platform"], toolpath=["tools"])
if tool is None or not tool.exists(env):
raise ValueError("Required toolchain not found for platform " + env["platform"])
tool.generate(env)
target_tool = Tool("targets", toolpath=["tools"])
target_tool.generate(env)
# Disable exception handling. Godot doesn't use exceptions anywhere, and this # Disable exception handling. Godot doesn't use exceptions anywhere, and this
# saves around 20% of binary size and very significant build time. # saves around 20% of binary size and very significant build time.
if env["disable_exceptions"]: if env["disable_exceptions"]:
@ -249,15 +258,6 @@ def generate(env):
elif env.get("is_msvc", False): elif env.get("is_msvc", False):
env.Append(CXXFLAGS=["/EHsc"]) env.Append(CXXFLAGS=["/EHsc"])
tool = Tool(env["platform"], toolpath=["tools"])
if tool is None or not tool.exists(env):
raise ValueError("Required toolchain not found for platform " + env["platform"])
tool.generate(env)
target_tool = Tool("targets", toolpath=["tools"])
target_tool.generate(env)
# Require C++17 # Require C++17
if env.get("is_msvc", False): if env.get("is_msvc", False):
env.Append(CXXFLAGS=["/std:c++17"]) env.Append(CXXFLAGS=["/std:c++17"])