I think I have found my way out for cliFFTop:
To import the dependency, since it doesn’t have a build.zig.zon file, I need to specify the name of the dependency for --save
zig fetch --save=cliFFTop git+https://github.com/BlueAlmost/cliFFTop
And after imported the dependency, instead of directly using addImport(), I need to construct a module for a specific algorithm of choice:
const cliFFTop = b.dependency("cliFFTop", .{});
const ffts = b.addModule("ffts", .{
.root_source_file = cliFFTop.path("cliFFTop/src/ffts.zig"),
.target = target,
.optimize = optimize,
});
exe.root_module.addImport("ffts", ffts);
With this setup, I managed to let ZLS recognize the functions in ffts.zig.
Update:
However, the ffts alone is not enough since it needs other modules, so for a quick hack just to mess around the library, I just manually import the libraries:
const cliFFTop = b.dependency("cliFFTop", .{});
const ffts = b.addModule("ffts", .{
.root_source_file = cliFFTop.path("cliFFTop/src/ffts.zig"),
.target = target,
.optimize = optimize,
});
const utils = b.addModule("utils", .{
.root_source_file = cliFFTop.path("cliFFTop/src/utils.zig"),
.target = target,
.optimize = optimize,
});
const complex_math = b.addModule("complex_math", .{
.root_source_file = cliFFTop.path("cliFFTop/src/complex_math.zig"),
.target = target,
.optimize = optimize,
});
const luts = b.addModule("luts", .{
.root_source_file = cliFFTop.path("cliFFTop/src/luts.zig"),
.target = target,
.optimize = optimize,
});
ffts.addImport("utils", utils);
ffts.addImport("complex_math", complex_math);
ffts.addImport("luts", luts);
luts.addImport("utils", utils);
exe.root_module.addImport("ffts", ffts);
exe.root_module.addImport("utils", utils);
exe.root_module.addImport("complex_math", complex_math);
exe.root_module.addImport("luts", luts);
I know there are better solutions, but this is good enough for now.