MrcSnm / D-Metal-Binding

Bindings for the D language to Apple's Metal Graphics API
Boost Software License 1.0
6 stars 2 forks source link

The hello_triangle example doesn't produce an executable #4

Closed esthermations closed 8 months ago

esthermations commented 1 year ago

Although it does compile and produces a static binary, I'm not really sure how to use the hello_triangle example, or what the main() function I need to write to use it would look like. I've written the equivalent in Objective-C, but that uses NSApplication, NSWindow etc which aren't included in this binding. Can this be documented or added to the examples?

Thank you!

MrcSnm commented 1 year ago

The example code here should be included as a static library in a XCode Project. I've done that way since XCode is the main way to develop a project on macos. Doing a main function would bring some extra complications here like the necessity of needing to deal with some system linker stuff + code signing.

So, for testing, what I would recommend is simply creating a metal sample app from xcode and then importing the static library created from the example.

LunaTheFoxgirl commented 9 months ago

What changes would be needed to make this usable outside of xcode, I intend to make a metal port of Inochi2D which will be used with the macOS version of Inochi Creator, there a standalone D app is neccesary.

Also code signing in this regard is up to the publisher of the app that uses the binding, not you.

MrcSnm commented 9 months ago

What changes would be needed to make this usable outside of xcode, I intend to make a metal port of Inochi2D which will be used with the macOS version of Inochi Creator, there a standalone D app is neccesary.

Also code signing in this regard is up to the publisher of the app that uses the binding, not you.

The bindings has nothing related to the executable production. This only happens because it is lacking the initial NSApp setup inside the examples. The bindings are good-to-go. You only need to be sure to link to metal.framework and objc.framework

MrcSnm commented 9 months ago

@LunaTheFoxgirl Also, if you need, you can ping me on the D discord that I can help you, my nick is @hipreme

LunaTheFoxgirl commented 9 months ago

What changes would be needed to make this usable outside of xcode, I intend to make a metal port of Inochi2D which will be used with the macOS version of Inochi Creator, there a standalone D app is neccesary. Also code signing in this regard is up to the publisher of the app that uses the binding, not you.

The bindings has nothing related to the executable production. This only happens because it is lacking the initial NSApp setup inside the examples. The bindings are good-to-go. You only need to be sure to link to metal.framework and objc.framework

Ohh I see, I misinterpreted your reply, sorry.

LunaTheFoxgirl commented 8 months ago

Although it does compile and produces a static binary, I'm not really sure how to use the hello_triangle example, or what the main() function I need to write to use it would look like. I've written the equivalent in Objective-C, but that uses NSApplication, NSWindow etc which aren't included in this binding. Can this be documented or added to the examples?

Thank you!

You can now compile the sdl-example instead, this example works on my M3 Max powered device.