#`addCSourceFile` breaks include paths for zig files?

1 messages · Page 1 of 1 (latest)

dense breach
#

can you post your build.zig and relevant code?

meager briar
#
    const mqttc = b.addObject(.{
        .name = "mqttc",
        .target = target,
        .optimize = optimize,
    });
    mqttc.addCSourceFile(.{
        .file = b.path("./MQTT-C/src/mqtt.c"),
        .flags = &[_][]const u8{
            "-DMQTTC_PAL_FILE=./mqtt_pal_custom.h",
            "-I./MQTT-C/include",
            "-I./src",
        },
    });

    const iotmodule = b.addExecutable(.{
        .name = "iotmodule",
        .root_source_file = b.path("./src/main.zig"),
        .target = target,
        .optimize = optimize,
    });
    iotmodule.addIncludePath(b.path("./MQTT-C/include"));
    iotmodule.addIncludePath(b.path("./src"));
    iotmodule.addObject(mqttc);

    b.installArtifact(iotmodule);
pub usingnamespace @cImport({
    @cDefine("MQTTC_PAL_FILE", "./mqtt_pal_custom.h");
    @cInclude("mqtt.h");
});