modules and mains
Brian Tiffin
btiffin at gnu.org
Sun Aug 22 19:44:57 UTC 2021
On Sunday, 22 August 2021 at 10:24:13 UTC, Mathias LANG wrote:
> On Sunday, 22 August 2021 at 03:22:02 UTC, Brian Tiffin wrote:
> ...
> IIUC, you want to generate multiple binaries, too ?
> In which case, I think you need more of a build tool solution
> than a language solution.
>
> Recent-ish versions of DUB (>= v1.24.0) support this out of the
> box.
> Provided the following structure:
> ```
> + $(pwd)
> + - dub.json
> + - source/
> + - source/appname/
> + - source/appname/prog1.d
> + - source/appname/prog2.d
> + - source/appname/common.d
> ```
>
> If your `dub.json` contains:
> ```
> {
> "name": "swissarmyknife",
> "targetType": "executable",
>
> "configurations": [
> {
> "name": "prog1",
> "targetName": "prog1",
> "mainSourceFile": "source/appname/prog1.d"
> },
> {
> "name": "prog2",
> "targetName": "prog2",
> "mainSourceFile": "source/appname/prog2.d"
> }
> }
> ```
>
> It will build `prog1` by default, and `prog2` if you use `dub
> build -c prog2`.
> Note that you might want to put a `library` configuration as
> first entry,
> so that you can also use your code base as a library if you
> wish to extend your project later.
Cool, thanks Mathias. I'm still using `gdc-11` on the play
machine. I tried `dub` with vibe.d and it's borked on this 32bit
laptop. Probably simple, but at this point on the learning
curve, the hassles with dmd and dub are keeping me away from
those tools. Might be soon to those steps, but not today. ;-)
Bookmarks made to revisit this thread when the time comes.
I do look forward to attaining a more complete grasp of the D
space. The hint that Ali passed on about `version` settings not
carrying through to imports helped enough that I'm pretty happy
with the plans for now. They might be wrong headed plans in the
grand scheme, but for now, things are working out. A bunch of
stand alone CLI programs, with a boss that can manage them all,
without need of shelling out a process.
Have good, make well
More information about the Digitalmars-d-learn
mailing list