Want Zig?
It's actually pretty simple building the project with Zig and even using the C functions. The issue is maintaining things and any additional abstraction levels.
I think what I added won't cause issues it might spark some interest and someone might have ideas on how to develop it further.
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).
View this failed invocation of the CLA check for more information.
For the most up to date status, view the checks section at the bottom of the pull request.
Is it possible to keep the zig files in a separate repo? We usually don't add language-specific files directly to this repo unless we can support it ourselves (and we cannot for zig).
Yeah it definitely is. You would basically combine this build.zig and the one in my zmujoco repo, adjust the paths, fetch mujoco manually get the third-party repos CMake gets for you or use the setup.zig . You can basically combine my mujoco zmujoco and phyzx into one project / build.zig. That's how I was initially doing it for phyzx but it started getting messy. I made everything self contained now in a way and I think it won't cause issues, ( I think ) it's basically a zig feature, what this allows for is to build mujoco & use the mujoco.h from zig and define based on mujoco.h either bindings or use the direct c interop ( probably should've made an exampl eand a test for all the functions that was one of the reasons o separating them ). But yeah setup.zig is to replace CMake fetch and then everything else was done in the build.zig I wanted to let you know in case you want to add this or maybe the entire phyzx as zig bindings / directory. I guess I'll close this? Maybe make a new pull request just to add the bindings I have to the README?
I think you actually could use the build.zig.zon to specify outside paths it's just zig has a new version so everything is on hard mode and the third_party packages mujoco uses don't have zig bindings so there's a weird way to do it with tar files but I wasn't really experimenting on that side more so how this stuff I am working on will integrate with mujoco / phyzx. And I wanted to see how much if anything you guys want to integrate zig into the project
Okay sorry to spam you but since you gave me a problem to solve it's definitely possible. You would have a branch with only zig files & use the build.zig.zon for everything.
Few issues versions stay frozen, you need to manually update things or you need to keep updating the expected hash.
Bigger issue is linking the files and defining things in the build.zig that's where I got stuck a bit and zig has a new version so it's hard to find the reerences and A.I. thinks my compiler is broken and I need to reinstall zig so I am basically manually grepping source files guessing around ( this is what I meant everything is on hard mode ) So I'd rather not deal with it unless you want to merge it honestly. Also it's not very friendly for iterating as it keeps fetching things and I wanted to have all the files in the repo as well. Now I used submodules but I see you're not really doing that ( But this is what I meant this should be a minimal addition and depending on how you want to go about developing it further or someone else the foundation is there )
The build.zig.zon you could use with just this zig directory ( You wouldn't need the other 2 files )
.{
.name = .lib_zmujoco,
.fingerprint = 0xaba5f16825593fb1,
.version = "0.0.1",
.minimum_zig_version = "0.15.0",
.dependencies = .{
.zglfw = .{
.url = "https://github.com/zig-gamedev/zglfw/archive/refs/heads/main.tar.gz",
.hash = "1220818bec2ffefc64bc842ad6ed1b3f80f9e96b33c7fda6b3373b5e285a25ffc8fc",
},
.libccd = .{
.url = "https://github.com/danfis/libccd/archive/refs/heads/master.tar.gz",
.hash = "1220b8a2032c446b8341ac4f91d95e618816b4942ba9a7fb858b79718b1d4d7a4fd0",
// .lazy = true,
},
.qhull = .{
.url = "https://github.com/qhull/qhull/archive/refs/heads/master.tar.gz",
.hash = "1220f254d0a4163d3b6cf68cda14a9007ee72da5288d89b048c99f305cf0b4f4de0c",
// .lazy = true,
},
.lodepng = .{
.url = "https://github.com/lvandeve/lodepng/archive/refs/heads/master.tar.gz",
.hash = "1220cfe8de44df6b6d5549d27cadd3cbc641c793f0b4b7072ca4e9b8d39f306f970f",
// .lazy = true,
},
.tinyxml2 = .{
.url = "https://github.com/leethomason/tinyxml2/archive/refs/heads/master.tar.gz",
.hash = "1220c2660779ef1e9ec7909692354e35e9e1d8fcf7c2d31cb403e02f26ae363071cd",
// .lazy = true,
},
.tinyobjloader = .{
.url = "https://github.com/tinyobjloader/tinyobjloader/archive/refs/heads/master.tar.gz",
.hash = "1220d9c58909e326041be85d8c2f51c42c0e1b784d5d8bab620d76b30fd0a4bcc36b",
// .lazy = true,
},
.triangle_mesh_distance = .{
.url = "https://github.com/InteractiveComputerGraphics/TriangleMeshDistance/archive/refs/heads/master.tar.gz",
.hash = "1220d9c58909e326041be85d8c2f51c42c0e1b784d5d8bab620d76b30fd0a4bcc36b",
// .lazy = true,
},
.marchingcubecpp = .{
.url = "https://github.com/aparis69/MarchingCubeCpp/archive/refs/heads/master.tar.gz",
.hash = "12200c590f2adca95e82bee5ebb7af9bb154cb392212a20e4a4c22a7fbc13803b1f5",
// .lazy = true,
},
.mujoco = .{
.url = "https://github.com/google-deepmind/mujoco/archive/refs/tags/3.3.7.tar.gz",
.hash = "1220ab68518f60893986f79a9a0bed49ab620b7c3deb804965d97d64220da2b37491",
},
},
.paths = .{
"build.zig",
"build.zig.zon",
"zig",
},
}
If you want the build.zig let me know otherwise I'd rather not solve that problem :D