Remix.run Logo
Automate compile_flags for C/C++ projects on the Zig build system(simonhartcher.com)
23 points by deevus 2 days ago | 5 comments
deevus 2 days ago | parent | next [-]

I built this after struggling with editor integration while working on a game decompilation project. Zig's build system is great for C/C++ cross-compilation, but editors couldn't find any includes.

Technical approach: The tool hooks into build.zig, extracts dependency paths from Zig's cache, and generates a compile_flags.txt that clangd understands.

Currently supports -I flags only. Planning to add -D macros and -std flags based on feedback.

Happy to answer questions about implementation details.

hiccuphippo 2 days ago | parent [-]

I wonder, would this help port projects from cmake to build.zig? I tried porting something (SDLPoP, a port of Prince of Persia) and the amount of macros I had to set up was overwhelming.

deevus a day ago | parent [-]

It will help with the editor experience, but not the porting itself.

Porting to build.zig can be a bit of work. It does have some capability to use cmake config, which can help make the process easier.

I ported wildmidi across and consumed their config (I think it was cmake). I have a PR open there:

https://github.com/Mindwerks/wildmidi/pull/260

DrNosferatu 2 days ago | parent | prev [-]

Would love to decompile <3 "Screamer 2" <3

- A thought: would you care to write up a tutorial documenting the details of your efforts so far, so us others can try our hand at this with that reference?

It would be awesome!

deevus a day ago | parent [-]

We were lucky enough to find a debug version of Fatal Racing. Having function names helped a lot. That made the process much easier.

I have been less involved with the actual decomp in ROLLER specifically. Though I was part of one of the key decomp pieces which was demystifying the games binary storage format. That part alone took me a year of on and off work.

Once that was done, the rest of the process was much easier.

I suggest if you want to have a go yourself, you just need to start brute forcing it with IDA or Ghidra.

Additionally find out what compiler was used. If it was watcom, there is a great tool called wcdatool that may be of use to you.