using dub to compile plugins
Atila Neves
atila.neves at gmail.com
Fri Dec 21 10:56:39 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...
Unless the plugins have dub dependencies, don't use dub for it.
Plugins that do can have their own dub.sdl/json with targetType
"dynamicLibrary".
> 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...
I don't see how you can do this with dub, and I wouldn't attempt
it either. Just use make, and have make call dub for the main
project (and potentially any plugins that need it). Remember to
make the dub targets `.PHONY` since you don't want to be managing
the D dependencies by hand.
More information about the Digitalmars-d-learn
mailing list