Skip to content

Commit 30f215b

Browse files
committed
FIX: separated situation of building/installing on target_include_directories on cmake
Changes to be committed: - modified: binding_generator.py - modified: cmake/godotcpp.cmake - modified: include/godot_cpp/core/object.hpp
1 parent 27d7ad0 commit 30f215b

3 files changed

Lines changed: 9 additions & 3 deletions

File tree

binding_generator.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -768,7 +768,10 @@ def generate_builtin_class_header(builtin_api, size, used_classes, fully_used_cl
768768

769769
result.append(f"class {class_name} {{")
770770
result.append(f"\tstatic constexpr size_t {snake_class_name}_SIZE = {size};")
771-
result.append(f"\tuint8_t opaque[{snake_class_name}_SIZE] = {{}};")
771+
# We don't get alignment information from the JSON so we have to guess.
772+
# This logic should be correct for all built-in types as they exist right now.
773+
alignment = 8 if size >= 8 else 4
774+
result.append(f"\talignas({alignment}) uint8_t opaque[{snake_class_name}_SIZE] = {{}};")
772775

773776
result.append("")
774777
result.append("\tfriend class Variant;")

cmake/godotcpp.cmake

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,10 @@ function(godotcpp_generate)
371371
target_include_directories(
372372
godot-cpp
373373
${GODOTCPP_SYSTEM_HEADERS_ATTRIBUTE}
374-
PUBLIC include ${CMAKE_CURRENT_BINARY_DIR}/gen/include
374+
PUBLIC
375+
include
376+
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/gen/include>
377+
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
375378
)
376379

377380
# gersemi: off

include/godot_cpp/core/object.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ struct MethodInfo {
7070
GDExtensionClassMethodArgumentMetadata return_val_metadata;
7171
LocalVector<GDExtensionClassMethodArgumentMetadata> arguments_metadata;
7272

73-
inline bool operator==(const MethodInfo &p_method) const { return id == p_method.id; }
73+
inline bool operator==(const MethodInfo &p_method) const { return id == p_method.id && name == p_method.name; }
7474
inline bool operator<(const MethodInfo &p_method) const { return id == p_method.id ? (name < p_method.name) : (id < p_method.id); }
7575

7676
operator Dictionary() const;

0 commit comments

Comments
 (0)