Cubyz icon indicating copy to clipboard operation
Cubyz copied to clipboard

Mac Developer Support

Open archbirdplus opened this issue 1 year ago • 1 comments

This issue is about merging the necessary modifications to allow Cubyz to compile on Mac.

This has several benefits:

  • Prevent my modifications from constantly going stale.
  • Allow Mac developers to contribute to Cubyz more easily, and potentially test features themselves.
  • Forms an initial step for later pursuing #299.
  • Allows us to give feedback to Zig and Mesa developers on their own Mac support.

This is similar but distinct to issue #299. #299 refers to native Cubyz support for Mac, which requires adapting Cubyz or OpenGL to work on Mac with native performance. This issue only requires that Cubyz compiles, regardless of playability.

Changes to consider:

  • Cubyz:
    • Update build.zig with Mac libraries.
      • Note: Mac libGL will have to be in a non-standard location, unless we ship it with Cubyz-libs.
    • Allow GLFW context to be switched to EGL at runtime for debugging the Zink driver.
    • Unfortunately, from past experience, run_linux.sh might also involve rather invasive manual linking.
  • Cubyz-libs:
    • Update build.zig to build libraries for Mac.
    • Note: because of the new platforms, this requires duplicating libcubyz_deps.a several times (20 MB with -Doptimize=ReleaseSmall), which may be undesirable.
  • Other niceties, with secondary utility:
    • Install scripts or instructions for additional libraries/applications, such as Mesa LLVMpipe/Zink libGL. Alternatively ship our own versions of these.
    • Include GLFW as a submodule referencing the official GLFW repo or our own fork. This is for isolating those changes and updating the dependency easier.
    • Include an "official" build script for Cubyz-libs releases.

archbirdplus avatar Apr 16 '24 05:04 archbirdplus

I'm mostly in favor of this. However since the future probably involves vulkan #102 I would like to avoid adding too much extra stuff, especially all the zink stuff, to the repositories for now.

Install scripts or instructions for additional libraries/applications, such as Mesa LLVMpipe/Zink libGL. Alternatively ship our own versions of these.

You are the only person on mac who will be going through all that trouble to get a barely playable game, so honestly we don't need install instructions for now. I think install instruction might actually be harmful because their existence would give the impression that the game would work on mac, which it doesn't.

Include GLFW as a submodule

Git submodules are annoying to use. It's better to use the zig package manager for that (similarly to how I did it for freetype and harfbuzz).

Note: because of the new platforms, this requires duplicating libcubyz_deps.a several times (20 MB with -Doptimize=ReleaseSmall), which may be undesirable.

Include an "official" build script for Cubyz-libs releases.

I've decided to extract these into a separate issue #325 which would be a requirement for this.

IntegratedQuantum avatar Apr 16 '24 11:04 IntegratedQuantum

By the way hasn't this been fixed a while ago? You have been able to develop on mac for quite a while I think.

IntegratedQuantum avatar Jun 19 '24 16:06 IntegratedQuantum