#Is there a way to translate multiple headers with 1 translation

1 messages · Page 1 of 1 (latest)

thick cape
#

I have been using b.addWriteFiles but it looks terrible and just nah

hardy mica
#

Make one header that #includes all other headers and translate that

thick cape
#

bruh

#

they should really fix this

misty grotto
#

It's not necessary when you can write a trivial file that's just the #includes you want. If you have a use case that can't be solved any other way, then you have a compelling argument. Otherwise it's just multiplying the number of ways to achieve the same thing -- adding complexity to the system (= risk of bugs and corner cases) for vanishingly small benefit.

thick cape
#

const think its a risk of bugs when they thing they would need is an array of paths instead

#

I dont really see any downsides to having the addTranslateC to take in multiple paths

fringe portal
#

the order of the include some times is important, some custom macros being defined before or after the include statements are important also, so basically there are lots of small cases which can all be solved by just creating a header file and write what you want there instead of creating a niche feature

shadow tulip
# thick cape I have been using b.addWriteFiles but it looks terrible and just nah

this is what I do:

const c_translate = b.addTranslateC(.{
    .root_source_file = b.addWriteFiles().add("stub.h",
        \\#include <SDL3/SDL.h>
        \\#include <SDL3/SDL_vulkan.h>
        \\#include <vk_mem_alloc.h>
        \\#include <dcimgui.h>
        \\#include <dcimgui_impl_sdl3.h>
        \\#include <dcimgui_impl_vulkan.h>
    ),
    .target = target,
    .optimize = optimize,
});