Skip to content

[Feature] Implementation of macOS linker functions#28

Merged
TomasBorquez merged 16 commits intoTomasBorquez:masterfrom
dsifriend:macOSLinkerFunctions
Jun 8, 2025
Merged

[Feature] Implementation of macOS linker functions#28
TomasBorquez merged 16 commits intoTomasBorquez:masterfrom
dsifriend:macOSLinkerFunctions

Conversation

@dsifriend
Copy link
Copy Markdown
Contributor

This PR provides an implementation of linker functions for framework bundles, relying on compiler support for these, as discussed in #23.

The implementation for all the functions are based on their regular "Include" or "StaticLib" equivalents, with the exception of basic LinkFrameworkOptions support, which is modeled after Zig's solution, and covers the two most common alternative linking modes for framework bundles.

Since full support for modern framework bundles is only available with clang, assertions to that effect are made at the top of the corresponding functions, and specific hints are offered for users wanting to take advantage of GCC's partial support.

@dsifriend dsifriend changed the title Implementation od macOS linker functions Implementation of macOS linker functions Jun 5, 2025
Copy link
Copy Markdown
Owner

@TomasBorquez TomasBorquez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from that minor comment, PR looks good, to make it easier, you can add the test case fix on this PR and close the previous one, also changes are supposed to be made in:

./src/api.c
./src/api.h

and then you run the amalgam script ./scripts/run-amalgam.sh and that adds the changes to mate.h, and before sending run run-tests-macos.sh, if it works, take a screenshot and add it to the PR as proof of work, from there I review it and if it's all good we merge :)

mate.h Outdated

static void mateLinkFrameworksWithOptions(String *targetLibs, LinkFrameworkOptions options, StringVector *frameworks) {
if (isGCC()) {
Assert(0,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick:

Assert(!isGCC(), ...)

and I like the idea that there are two asserts for better error messages

@TomasBorquez TomasBorquez changed the title Implementation of macOS linker functions [Feature] Implementation of macOS linker functions Jun 6, 2025
@dsifriend
Copy link
Copy Markdown
Contributor Author

you can add the test case fix on this PR and close the previous one

Got it. I'll close it now and work on moving the changes to the right spot in the morning.

@dsifriend dsifriend mentioned this pull request Jun 6, 2025
@dsifriend
Copy link
Copy Markdown
Contributor Author

Should be good to go now 👍

@TomasBorquez
Copy link
Copy Markdown
Owner

Should be good to go now 👍

Hey looks good, can you send a screenshot of running tests to make sure nothing broke? also add test 07-raylib-source-code, on here:

"06-lua-source-code"

# "07-raylib-source-code" # Requires framework linking on macOS, which isnt implemented yet

@dsifriend
Copy link
Copy Markdown
Contributor Author

Hey looks good, can you send a screenshot of running tests to make sure nothing broke?

I'm not sure that'll be much help, but FWIW they all show as passing on GitHub after these latest changes. If we actually wanted to test the window creation and stuff we'd need to change the basic-example on all platforms.

also add test "07-raylib-source-code" …

Yeah, I forgot to pull those back in. The removal of tests for Apple's GCC too. Good catch.

@TomasBorquez
Copy link
Copy Markdown
Owner

they all show as passing on GitHub after these latest changes

aren't those the formatting checks?

If we actually wanted to test the window creation and stuff we'd need to change the basic-example on all platforms.

yeah but you can't do those tests in github actions, i didn't look much into how raylib does it but i think they just compile their code and if it works then the workflow passes lmao

@TomasBorquez TomasBorquez merged commit b4531b6 into TomasBorquez:master Jun 8, 2025
1 check passed
@TomasBorquez
Copy link
Copy Markdown
Owner

anyways merging, thanks for the PR :)

@dsifriend dsifriend deleted the macOSLinkerFunctions branch June 8, 2025 22:15
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

Successfully merging this pull request may close these issues.

2 participants