Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does not compile in macos #6

Closed
rkalnins opened this issue Sep 5, 2024 · 1 comment
Closed

Does not compile in macos #6

rkalnins opened this issue Sep 5, 2024 · 1 comment

Comments

@rkalnins
Copy link
Contributor

rkalnins commented Sep 5, 2024

Summary

Could not compile godot-motion-matching/master in macos. Encountered several issues detailed below and see rkalnins/godot-motion-matching:fix-macos-build for changes I made to get macos build to work. I'm opening a PR where we can discuss these changes in a review. Thank you so much for starting this feature, I'm very excited for where this is going and have been playing around with similar ideas in Godot for a bit.

System

  • macos: 133.6.9 (x86_64)
  • scons: v4.8.0.7c688f694c644b61342670ce92977bf4a396c0d4
  • Python: 3.12.5
  • clang: Apple clang version 15.0.0 (clang-1500.1.0.2.5)

Issues

Unsigned long variant conversions

Several cases, all similar to this:

src/mm_bone_state.h:59:28: error: conversion from 'Variant' to 'size_type' (aka 'unsigned long') is ambiguous
        return bone_states[bone_name_to_index.find_key(name)];

Godot's Variant could not seem to find a conversion for unsigned long (size_t in this case). Maybe related to godotengine/godot#36690 ?

__VARARGS__ expansion

src/mm_animation_library.cpp:221:5: error: expected expression
    BINDER_PROPERTY_PARAMS(MMAnimationLibrary, Variant::FLOAT, sampling_rate);
    ^
src/common.h:19:96: note: expanded from macro 'BINDER_PROPERTY_PARAMS'
    ClassDB::add_property(get_class_static(), PropertyInfo(variant_type, #variable, __VA_ARGS__), STRING_PREFIX(set_, variable), STRING_PREFIX(get_, variable));

__VARARGS__ did not correctly handle the preceding comma. Using ##__VARARGS__ will omit the comma if __VARARGS__ is empty.

Incomplete type, forward declaration of MMFeature used in TypedArray<MMFeature>

godot-cpp/include/godot_cpp/variant/typed_array.hpp:58:30: error: incomplete type 'MMFeature' named in nested name specifier
                set_typed(Variant::OBJECT, T::get_class_static(), Variant());
                                           ^~~
src/mm_animation_library.h:32:5: note: in instantiation of member function 'godot::TypedArray<MMFeature>::TypedArray' requested here
    GETSET(TypedArray<MMFeature>, features)
    ^
src/common.h:4:18: note: expanded from macro 'GETSET'
    type variable{__VA_ARGS__};       \
                 ^
src/mm_animation_library.h:16:7: note: forward declaration of 'MMFeature'
class MMFeature;

Adding #include "features/mm_feature.h" to mm_animation_library.h fixed this but not sure if this is the best solution.

Missing MAX_FLT definition

<cfloat> include added to stats.hpp fixed this

Miscellaneous Warnings

Some minor warnings but since the API is probably subject to changes I didn't worry here. Very much up to you and I don't want force anything but I would suggest that the ternaries like at mm_trajectory_feature.cpp:156 be parenthesized since the operator precedence, although not ambiguous by operator precedence, are slightly difficult to read at first glance.

@rkalnins rkalnins mentioned this issue Sep 5, 2024
@GuilhermeGSousa
Copy link
Owner

Thank you for this, I agree with everything you mentioned here. For the forward declaration of MMFeature I don't thnk we can get around having to include #include "features/mm_feature.h", since the default constructor is callling a static function of the type.

I'll be setting up platform builds so we can hopefully catch these sooner!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants