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

generalize system SDK inclusion #39

Closed
slimsag opened this issue Oct 24, 2021 · 3 comments · Fixed by #58
Closed

generalize system SDK inclusion #39

slimsag opened this issue Oct 24, 2021 · 3 comments · Fixed by #58
Labels
Milestone

Comments

@slimsag
Copy link
Member

slimsag commented Oct 24, 2021

Today, we have special build logic in https://github.com/hexops/mach/blob/main/glfw/build.zig which:

This logic is useful outside of just our GLFW bindings, though. For example, it is useful to use this for cross-compiling Google's Dawn WebGPU implementation.

It would also be useful to be able to use this logic outside of Mach entirely, for example to cross compile SDL applications @MasterQ32 ikskuh/SDL.zig#8 - or maybe for @Avokadoen to cross-compile https://github.com/Avokadoen/zig_vulkan perhaps

Idea: Move this logic into a new system_sdk library, so that one can easily import / benefit from this logic.

Challenge: I don't think these SDKs will always include all system libraries, for example the Linux one picks a very specific set of packages - just those required to build Mach. And it would be nice to slim down the MacOS one even further (currently ~164M). Additionally, it's possible that the versions Mach uses are not what others want, or may change over time. So one important thing here will be making it so that people can very easily fork the SDK repos to modify which system libraries are included, and use their fork if preferred - although probably it'll just work fine in most cases.

Question: Does anyone actually want this? Does this sound useful?

@Avokadoen
Copy link
Contributor

Avokadoen commented Oct 24, 2021

Since i am already using the GLFW bindings this would probably be useful for zig_vulkan as well. While we are on the topic, I would also vote to move the GLFW bindings out of the mach repo into its own so it's more apparent for other projects that it's an option to use if you need a window library in zig 👍

Currently zig vulkan cross compile between windows and linux, sadly the only system wide dependency is vulkan which does not support static linking

@slimsag
Copy link
Member Author

slimsag commented Oct 24, 2021

While we are on the topic, I would also vote to move the GLFW bindings out of the mach repo into its own so it's more apparent for other projects that it's an option to use if you need a window library in zig 👍

Good point, it would be super nice to have these libraries be in separate repos. At the same time, I am a huge fan of monorepo benefits (a single issue tracker, place to view commit activity, etc.) I will start looking into git subtree, maybe that would give the best of both worlds

@slimsag
Copy link
Member Author

slimsag commented Oct 24, 2021

GLFW moved into a separate repo in #42 - it's now at https://github.com/hexops/mach-glfw

@slimsag slimsag added the glfw label Oct 29, 2021
slimsag added a commit that referenced this issue Oct 31, 2021
This refactors the logic for system SDK inclusion out of the GLFW-specific `build.zig`,
and should make it very easy for anyone to copy this file and start getting cross-platform
builds of their own OpenGL/Vulkan Zig projects.

There may be some libraries we need to add for Vulkan to these SDKs, I haven't yet tested
that - but the overall idea here seems sound.

Fixes #39

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
slimsag added a commit that referenced this issue Oct 31, 2021
This refactors the logic for system SDK inclusion out of the GLFW-specific `build.zig`,
and should make it very easy for anyone to copy this file and start getting cross-platform
builds of their own OpenGL/Vulkan Zig projects.

There may be some libraries we need to add for Vulkan to these SDKs, I haven't yet tested
that - but the overall idea here seems sound.

Fixes #39

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
slimsag added a commit to slimsag/mach-glfw that referenced this issue Oct 31, 2021
This refactors the logic for system SDK inclusion out of the GLFW-specific `build.zig`,
and should make it very easy for anyone to copy this file and start getting cross-platform
builds of their own OpenGL/Vulkan Zig projects.

There may be some libraries we need to add for Vulkan to these SDKs, I haven't yet tested
that - but the overall idea here seems sound.

Fixes hexops/mach#39

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
slimsag added a commit to slimsag/mach-glfw that referenced this issue Aug 26, 2022
This refactors the logic for system SDK inclusion out of the GLFW-specific `build.zig`,
and should make it very easy for anyone to copy this file and start getting cross-platform
builds of their own OpenGL/Vulkan Zig projects.

There may be some libraries we need to add for Vulkan to these SDKs, I haven't yet tested
that - but the overall idea here seems sound.

Fixes hexops/mach#39

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
@slimsag slimsag added this to the Mach 0.2 milestone Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants