using dub to compile plugins
Andre Pany
andre at s-e-a-p.de
Wed Dec 19 13:14:20 UTC 2018
On Wednesday, 19 December 2018 at 12:57:14 UTC, Codifies wrote:
> I am currently using this dub.sdl
>
> name "runz80"
> targetType "executable"
> lflags "libz80/libz80.a"
>
> however I will be creating a number of plugins, each plugin
> will consist of a single source file, I'd like the plugin
> source directory to be separate from main source directory and
> compile the plugins (.so) to a (binary) plugins directory
>
> (the plugins will be dynamically loaded at runtime - I've
> previously done this in C so I don't anticipate any particular
> issues - famous last words!)
>
> I could do this with a few simple rules in a Makefile, but I
> have no clue how to achieve this using dub.
>
> can someone show me a concrete example of doing this ? Ideally
> just dropping a new source file into the plugins source folder
> should produce a new .so the next time dub is run, without
> having to explicitly add each plugin to the dub file...
You can use dub sub packages. Each plugin will be a dub package
with its own dub descriptor (sdl) file.
For your main dub sdl you set targetType to None.
Kind regards
Andre
More information about the Digitalmars-d-learn
mailing list