Compare commits
8 Commits
851e049ebf
...
cbbac9aa70
Author | SHA1 | Date |
---|---|---|
|
cbbac9aa70 | |
|
09a22bc476 | |
|
dd62b9685f | |
|
8d13acca91 | |
|
b1769a70f0 | |
|
b733102f4a | |
|
718d0baea3 | |
|
b77cb648c3 |
|
@ -281,13 +281,13 @@ void call_with_variant_args(T *p_instance, void (T::*p_method)(P...), const Vari
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -299,13 +299,13 @@ void call_with_variant_args_ret(T *p_instance, R (T::*p_method)(P...), const Var
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -317,13 +317,13 @@ void call_with_variant_args_retc(T *p_instance, R (T::*p_method)(P...) const, co
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -335,7 +335,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const G
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -346,7 +346,7 @@ void call_with_variant_args_dv(T *p_instance, void (T::*p_method)(P...), const G
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -370,7 +370,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -381,7 +381,7 @@ void call_with_variant_argsc_dv(T *p_instance, void (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -405,7 +405,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -416,7 +416,7 @@ void call_with_variant_args_ret_dv(T *p_instance, R (T::*p_method)(P...), const
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -440,7 +440,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -451,7 +451,7 @@ void call_with_variant_args_retc_dv(T *p_instance, R (T::*p_method)(P...) const,
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -552,7 +552,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const GDExtensionC
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -563,7 +563,7 @@ void call_with_variant_args_static_dv(void (*p_method)(P...), const GDExtensionC
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -597,13 +597,13 @@ void call_with_variant_args_static_ret(R (*p_method)(P...), const Variant **p_ar
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -615,13 +615,13 @@ void call_with_variant_args_static_ret(void (*p_method)(P...), const Variant **p
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((size_t)p_argcount < sizeof...(P)) {
|
if ((size_t)p_argcount < sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = (int32_t)sizeof...(P);
|
r_error.expected = (int32_t)sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -644,7 +644,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDExtension
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if ((size_t)p_argcount > sizeof...(P)) {
|
if ((size_t)p_argcount > sizeof...(P)) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_MANY_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
@ -655,7 +655,7 @@ void call_with_variant_args_static_ret_dv(R (*p_method)(P...), const GDExtension
|
||||||
#ifdef DEBUG_ENABLED
|
#ifdef DEBUG_ENABLED
|
||||||
if (missing > dvs) {
|
if (missing > dvs) {
|
||||||
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
r_error.error = GDEXTENSION_CALL_ERROR_TOO_FEW_ARGUMENTS;
|
||||||
r_error.argument = sizeof...(P);
|
r_error.expected = sizeof...(P);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -117,6 +117,9 @@ struct _NO_DISCARD_ Vector2i {
|
||||||
int64_t length_squared() const;
|
int64_t length_squared() const;
|
||||||
double length() const;
|
double length() const;
|
||||||
|
|
||||||
|
int64_t distance_squared_to(const Vector2i &p_to) const;
|
||||||
|
double distance_to(const Vector2i &p_to) const;
|
||||||
|
|
||||||
real_t aspect() const { return width / (real_t)height; }
|
real_t aspect() const { return width / (real_t)height; }
|
||||||
Vector2i sign() const { return Vector2i(SIGN(x), SIGN(y)); }
|
Vector2i sign() const { return Vector2i(SIGN(x), SIGN(y)); }
|
||||||
Vector2i abs() const { return Vector2i(Math::abs(x), Math::abs(y)); }
|
Vector2i abs() const { return Vector2i(Math::abs(x), Math::abs(y)); }
|
||||||
|
|
|
@ -82,6 +82,9 @@ struct _NO_DISCARD_ Vector3i {
|
||||||
_FORCE_INLINE_ int64_t length_squared() const;
|
_FORCE_INLINE_ int64_t length_squared() const;
|
||||||
_FORCE_INLINE_ double length() const;
|
_FORCE_INLINE_ double length() const;
|
||||||
|
|
||||||
|
_FORCE_INLINE_ int64_t distance_squared_to(const Vector3i &p_to) const;
|
||||||
|
_FORCE_INLINE_ double distance_to(const Vector3i &p_to) const;
|
||||||
|
|
||||||
_FORCE_INLINE_ void zero();
|
_FORCE_INLINE_ void zero();
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector3i abs() const;
|
_FORCE_INLINE_ Vector3i abs() const;
|
||||||
|
@ -136,6 +139,14 @@ double Vector3i::length() const {
|
||||||
return Math::sqrt((double)length_squared());
|
return Math::sqrt((double)length_squared());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Vector3i::distance_squared_to(const Vector3i &p_to) const {
|
||||||
|
return (p_to - *this).length_squared();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector3i::distance_to(const Vector3i &p_to) const {
|
||||||
|
return (p_to - *this).length();
|
||||||
|
}
|
||||||
|
|
||||||
Vector3i Vector3i::abs() const {
|
Vector3i Vector3i::abs() const {
|
||||||
return Vector3i(Math::abs(x), Math::abs(y), Math::abs(z));
|
return Vector3i(Math::abs(x), Math::abs(y), Math::abs(z));
|
||||||
}
|
}
|
||||||
|
|
|
@ -84,6 +84,9 @@ struct _NO_DISCARD_ Vector4i {
|
||||||
_FORCE_INLINE_ int64_t length_squared() const;
|
_FORCE_INLINE_ int64_t length_squared() const;
|
||||||
_FORCE_INLINE_ double length() const;
|
_FORCE_INLINE_ double length() const;
|
||||||
|
|
||||||
|
_FORCE_INLINE_ int64_t distance_squared_to(const Vector4i &p_to) const;
|
||||||
|
_FORCE_INLINE_ double distance_to(const Vector4i &p_to) const;
|
||||||
|
|
||||||
_FORCE_INLINE_ void zero();
|
_FORCE_INLINE_ void zero();
|
||||||
|
|
||||||
_FORCE_INLINE_ Vector4i abs() const;
|
_FORCE_INLINE_ Vector4i abs() const;
|
||||||
|
@ -140,6 +143,14 @@ double Vector4i::length() const {
|
||||||
return Math::sqrt((double)length_squared());
|
return Math::sqrt((double)length_squared());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Vector4i::distance_squared_to(const Vector4i &p_to) const {
|
||||||
|
return (p_to - *this).length_squared();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector4i::distance_to(const Vector4i &p_to) const {
|
||||||
|
return (p_to - *this).length();
|
||||||
|
}
|
||||||
|
|
||||||
Vector4i Vector4i::abs() const {
|
Vector4i Vector4i::abs() const {
|
||||||
return Vector4i(Math::abs(x), Math::abs(y), Math::abs(z), Math::abs(w));
|
return Vector4i(Math::abs(x), Math::abs(y), Math::abs(z), Math::abs(w));
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,6 +49,14 @@ double Vector2i::length() const {
|
||||||
return Math::sqrt((double)length_squared());
|
return Math::sqrt((double)length_squared());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int64_t Vector2i::distance_squared_to(const Vector2i &p_to) const {
|
||||||
|
return (p_to - *this).length_squared();
|
||||||
|
}
|
||||||
|
|
||||||
|
double Vector2i::distance_to(const Vector2i &p_to) const {
|
||||||
|
return (p_to - *this).length();
|
||||||
|
}
|
||||||
|
|
||||||
Vector2i Vector2i::operator+(const Vector2i &p_v) const {
|
Vector2i Vector2i::operator+(const Vector2i &p_v) const {
|
||||||
return Vector2i(x + p_v.x, y + p_v.y);
|
return Vector2i(x + p_v.x, y + p_v.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,143 +1,59 @@
|
||||||
project(godot-cpp-test)
|
cmake_minimum_required(VERSION 3.24)
|
||||||
cmake_minimum_required(VERSION 3.6)
|
project(gdexample)
|
||||||
|
|
||||||
set(GODOT_GDEXTENSION_DIR ../gdextension/ CACHE STRING "Path to GDExtension interface header directory")
|
add_subdirectory(
|
||||||
set(CPP_BINDINGS_PATH ../ CACHE STRING "Path to C++ bindings")
|
../ # path to godot-cpp
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}/godot-cpp # needed because godot-cpp is top directory
|
||||||
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
)
|
||||||
set(TARGET_PATH x11)
|
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
|
||||||
set(TARGET_PATH win64)
|
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
|
||||||
set(TARGET_PATH macos)
|
|
||||||
else()
|
|
||||||
message(FATAL_ERROR "Not implemented support for ${CMAKE_SYSTEM_NAME}")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Change the output directory to the bin directory
|
|
||||||
set(BUILD_PATH ${CMAKE_SOURCE_DIR}/bin/${TARGET_PATH})
|
|
||||||
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${BUILD_PATH}")
|
|
||||||
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${BUILD_PATH}")
|
|
||||||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${BUILD_PATH}")
|
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG "${BUILD_PATH}")
|
|
||||||
SET(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE "${BUILD_PATH}")
|
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_DEBUG "${BUILD_PATH}")
|
|
||||||
SET(CMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE "${BUILD_PATH}")
|
|
||||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_DEBUG "${BUILD_PATH}")
|
|
||||||
SET(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE "${BUILD_PATH}")
|
|
||||||
|
|
||||||
# Set the c++ standard to c++17
|
|
||||||
set(CMAKE_CXX_STANDARD 17)
|
|
||||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
||||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
||||||
|
|
||||||
set(GODOT_COMPILE_FLAGS )
|
|
||||||
set(GODOT_LINKER_FLAGS )
|
|
||||||
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
||||||
# using Visual Studio C++
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /WX") # /GF /MP
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /DTYPED_METHOD_BIND")
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MDd") # /Od /RTC1 /Zi
|
|
||||||
else()
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /MD /O2") # /Oy /GL /Gy
|
|
||||||
STRING(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
string(REPLACE "/RTC1" "" CMAKE_CXX_FLAGS_DEBUG ${CMAKE_CXX_FLAGS_DEBUG})
|
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
|
|
||||||
# Disable conversion warning, truncation, unreferenced var, signed mismatch
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /wd4244 /wd4305 /wd4101 /wd4018 /wd4267")
|
|
||||||
|
|
||||||
add_definitions(-DNOMINMAX)
|
|
||||||
|
|
||||||
# Unkomment for warning level 4
|
|
||||||
#if(CMAKE_CXX_FLAGS MATCHES "/W[0-4]")
|
|
||||||
# string(REGEX REPLACE "/W[0-4]" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
|
||||||
#endif()
|
|
||||||
|
|
||||||
else()
|
|
||||||
|
|
||||||
set(GODOT_LINKER_FLAGS "-static-libgcc -static-libstdc++ -Wl,-R,'$$ORIGIN'")
|
|
||||||
|
|
||||||
set(GODOT_COMPILE_FLAGS "-fPIC -g -Wwrite-strings")
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-omit-frame-pointer -O0")
|
|
||||||
else()
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -O3")
|
|
||||||
endif(CMAKE_BUILD_TYPE MATCHES Debug)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Disable exception handling. Godot doesn't use exceptions anywhere, and this
|
|
||||||
# saves around 20% of binary size and very significant build time (GH-80513).
|
|
||||||
option(GODOT_DISABLE_EXCEPTIONS ON "Force disabling exception handling code")
|
|
||||||
if (GODOT_DISABLE_EXCEPTIONS)
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -D_HAS_EXCEPTIONS=0")
|
|
||||||
else()
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} -fno-exceptions")
|
|
||||||
endif()
|
|
||||||
else()
|
|
||||||
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
|
|
||||||
set(GODOT_COMPILE_FLAGS "${GODOT_COMPILE_FLAGS} /EHsc")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Get Sources
|
# Get Sources
|
||||||
file(GLOB_RECURSE SOURCES src/*.c**)
|
file(GLOB_RECURSE SOURCES src/*.c**)
|
||||||
file(GLOB_RECURSE HEADERS include/*.h**)
|
file(GLOB_RECURSE HEADERS include/*.h**)
|
||||||
|
|
||||||
# Define our godot-cpp library
|
# Define our godot-cpp library
|
||||||
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
|
if(${PLATFORM} STREQUAL "WEB")
|
||||||
|
# wasm libraries loaded with dlopen() are created like this in cmake
|
||||||
|
add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS})
|
||||||
|
set_target_properties(${PROJECT_NAME}
|
||||||
|
PROPERTIES
|
||||||
|
PREFIX "lib"
|
||||||
|
SUFFIX ".wasm"
|
||||||
|
)
|
||||||
|
elseif(${PLATFORM} STREQUAL "MACOS" OR ${PLATFORM} STREQUAL "IOS")
|
||||||
|
# TODO: create framework with cmake FRAMEWORK property
|
||||||
|
# or with template file
|
||||||
|
message(WARNING "Mac/IOS framework configuration is not tested and may not work.")
|
||||||
|
|
||||||
target_include_directories(${PROJECT_NAME} SYSTEM
|
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
|
||||||
PRIVATE
|
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||||
${CPP_BINDINGS_PATH}/include
|
FRAMEWORK TRUE
|
||||||
${CPP_BINDINGS_PATH}/gen/include
|
MACOSX_FRAMEWORK_IDENTIFIER com.godotengine.${PROJECT_NAME}
|
||||||
${GODOT_GDEXTENSION_DIR}
|
MACOSX_FRAMEWORK_INFO_PLIST Info.plist
|
||||||
|
)
|
||||||
|
else()
|
||||||
|
add_library(${PROJECT_NAME} SHARED ${SOURCES} ${HEADERS})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries(${PROJECT_NAME} PUBLIC godot-cpp)
|
||||||
|
|
||||||
|
get_directory_property(GODOT_CC_FLAGS DIRECTORY ../ DEFINITION GODOT_CC_FLAGS)
|
||||||
|
get_directory_property(GODOT_CXX_FLAGS DIRECTORY ../ DEFINITION GODOT_CXX_FLAGS)
|
||||||
|
target_compile_options(${PROJECT_NAME} PRIVATE
|
||||||
|
${GODOT_CC_FLAGS}
|
||||||
|
${GODOT_CXX_FLAGS}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Create the correct name (godot.os.build_type.system_bits)
|
get_directory_property(GODOT_LINK_FLAGS DIRECTORY ../ DEFINITION GODOT_LINK_FLAGS)
|
||||||
# Synchronized with godot-cpp's CMakeLists.txt
|
target_link_options(${PROJECT_NAME} PRIVATE ${GODOT_LINK_FLAGS})
|
||||||
|
|
||||||
set(BITS 32)
|
|
||||||
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
set(BITS 64)
|
|
||||||
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
||||||
|
|
||||||
if(CMAKE_BUILD_TYPE MATCHES Debug)
|
get_directory_property(LIBRARY_SUFFIX DIRECTORY ../ DEFINITION LIBRARY_SUFFIX)
|
||||||
set(GODOT_CPP_BUILD_TYPE Debug)
|
set_target_properties(${PROJECT_NAME}
|
||||||
else()
|
PROPERTIES
|
||||||
set(GODOT_CPP_BUILD_TYPE Release)
|
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
|
||||||
endif()
|
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
|
||||||
|
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/project/bin"
|
||||||
|
|
||||||
string(TOLOWER ${CMAKE_SYSTEM_NAME} SYSTEM_NAME)
|
OUTPUT_NAME "${PROJECT_NAME}${LIBRARY_SUFFIX}"
|
||||||
string(TOLOWER ${GODOT_CPP_BUILD_TYPE} BUILD_TYPE)
|
)
|
||||||
|
|
||||||
if(ANDROID)
|
|
||||||
# Added the android abi after system name
|
|
||||||
set(SYSTEM_NAME ${SYSTEM_NAME}.${ANDROID_ABI})
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(CMAKE_VERSION VERSION_GREATER "3.13")
|
|
||||||
target_link_directories(${PROJECT_NAME}
|
|
||||||
PRIVATE
|
|
||||||
${CPP_BINDINGS_PATH}/bin/
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
|
||||||
godot-cpp.${SYSTEM_NAME}.${BUILD_TYPE}$<$<NOT:$<PLATFORM_ID:Android>>:.${BITS}>
|
|
||||||
)
|
|
||||||
else()
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
|
||||||
${CPP_BINDINGS_PATH}/bin/libgodot-cpp.${SYSTEM_NAME}.${BUILD_TYPE}$<$<NOT:$<PLATFORM_ID:Android>>:.${BITS}>.a
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
# Add the compile flags
|
|
||||||
set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY COMPILE_FLAGS ${GODOT_COMPILE_FLAGS})
|
|
||||||
set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS ${GODOT_LINKER_FLAGS})
|
|
||||||
|
|
||||||
set_property(TARGET ${PROJECT_NAME} PROPERTY OUTPUT_NAME "gdexample")
|
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
[preset.0]
|
||||||
|
|
||||||
|
name="<null>"
|
||||||
|
platform="Linux/X11"
|
||||||
|
runnable=false
|
||||||
|
dedicated_server=false
|
||||||
|
custom_features=""
|
||||||
|
export_filter="all_resources"
|
||||||
|
include_filter=""
|
||||||
|
exclude_filter=""
|
||||||
|
export_path=""
|
||||||
|
encryption_include_filters=""
|
||||||
|
encryption_exclude_filters=""
|
||||||
|
encrypt_pck=false
|
||||||
|
encrypt_directory=false
|
||||||
|
|
||||||
|
[preset.0.options]
|
||||||
|
|
||||||
|
custom_template/debug=""
|
||||||
|
custom_template/release=""
|
||||||
|
debug/export_console_wrapper=1
|
||||||
|
binary_format/embed_pck=false
|
||||||
|
texture_format/bptc=true
|
||||||
|
texture_format/s3tc=true
|
||||||
|
texture_format/etc=false
|
||||||
|
texture_format/etc2=false
|
||||||
|
binary_format/architecture="x86_64"
|
||||||
|
ssh_remote_deploy/enabled=false
|
||||||
|
ssh_remote_deploy/host="user@host_ip"
|
||||||
|
ssh_remote_deploy/port="22"
|
||||||
|
ssh_remote_deploy/extra_args_ssh=""
|
||||||
|
ssh_remote_deploy/extra_args_scp=""
|
||||||
|
ssh_remote_deploy/run_script="#!/usr/bin/env bash
|
||||||
|
export DISPLAY=:0
|
||||||
|
unzip -o -q \"{temp_dir}/{archive_name}\" -d \"{temp_dir}\"
|
||||||
|
\"{temp_dir}/{exe_name}\" {cmd_args}"
|
||||||
|
ssh_remote_deploy/cleanup_script="#!/usr/bin/env bash
|
||||||
|
kill $(pgrep -x -f \"{temp_dir}/{exe_name} {cmd_args}\")
|
||||||
|
rm -rf \"{temp_dir}\""
|
|
@ -5,6 +5,9 @@ GODOT=${GODOT:-godot}
|
||||||
END_STRING="==== TESTS FINISHED ===="
|
END_STRING="==== TESTS FINISHED ===="
|
||||||
FAILURE_STRING="******** FAILED ********"
|
FAILURE_STRING="******** FAILED ********"
|
||||||
|
|
||||||
|
# Import to get GDExtension library working
|
||||||
|
$GODOT --headless --path project --export-pack '<null>' /dev/null
|
||||||
|
|
||||||
OUTPUT=$($GODOT --path project --debug --headless --quit)
|
OUTPUT=$($GODOT --path project --debug --headless --quit)
|
||||||
ERRCODE=$?
|
ERRCODE=$?
|
||||||
|
|
||||||
|
|
|
@ -64,6 +64,12 @@ def generate(env):
|
||||||
elif sys.platform == "darwin":
|
elif sys.platform == "darwin":
|
||||||
toolchain += "darwin-x86_64"
|
toolchain += "darwin-x86_64"
|
||||||
env.Append(LINKFLAGS=["-shared"])
|
env.Append(LINKFLAGS=["-shared"])
|
||||||
|
|
||||||
|
if not os.path.exists(toolchain):
|
||||||
|
print("ERROR: Could not find NDK toolchain at " + toolchain + ".")
|
||||||
|
print("Make sure NDK version " + get_ndk_version() + " is installed.")
|
||||||
|
env.Exit(1)
|
||||||
|
|
||||||
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
|
# Get architecture info
|
||||||
|
|
Loading…
Reference in New Issue