Thread overview
Cannot make LDC use LTO when called via DUB
Sep 23, 2017
Nordlöw
Sep 23, 2017
Nordlöw
Sep 25, 2017
Sebastiaan Koppe
Sep 25, 2017
Jacob Carlborg
Sep 25, 2017
Nordlöw
September 23, 2017
I've added

buildType "release" {
         buildOptions "releaseMode" "optimize" "inline"
         dflags-posix-ldc "-flto=thin" "-Xcc=-fuse-ld=gold"
}

to my dub.sdl and built (on Linux) as

    /usr/bin/dub -v run --compiler=ldc2 --build=release

but neither the flag "-flto=thin" nor "-Xcc=-fuse-ld=gold" is propagated to the ldc2 call (at least no printed on stdout).

What's missing?
September 23, 2017
On Saturday, 23 September 2017 at 15:19:09 UTC, Nordlöw wrote:
> I've added
>
> buildType "release" {
>          buildOptions "releaseMode" "optimize" "inline"
>          dflags-posix-ldc "-flto=thin" "-Xcc=-fuse-ld=gold"
> }
>
> to my dub.sdl and built (on Linux) as
>
>     /usr/bin/dub -v run --compiler=ldc2 --build=release
>
> but neither the flag "-flto=thin" nor "-Xcc=-fuse-ld=gold" is propagated to the ldc2 call (at least no printed on stdout).
>
> What's missing?

Neither

dflags-dmd "-xxx"
dflags-posix-dmd "-xxx"
dflags-linux-dmd "-xxx"

has any effect on my build (in dub.sdl).
September 25, 2017
> Neither
>
> dflags-dmd "-xxx"
> dflags-posix-dmd "-xxx"
> dflags-linux-dmd "-xxx"
>
> has any effect on my build (in dub.sdl).

I didn't know dflags-* was a thing, and I can't find it in docs either.

Maybe you are looking for

dflags "..." platform="..."
September 25, 2017
On 2017-09-25 09:47, Sebastiaan Koppe wrote:

> I didn't know dflags-* was a thing, and I can't find it in docs either.

That's how it works in the JSON package description file.

-- 
/Jacob Carlborg
September 25, 2017
On Monday, 25 September 2017 at 07:47:28 UTC, Sebastiaan Koppe wrote:
> Maybe you are looking for
>
> dflags "..." platform="..."

Ahh, you're right.

Thanks!