www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - Adding flags to dub build

reply Jean-Louis Leroy <jl leroy.nyc> writes:
Hi,

I want to add a few flags while building with dub. I tried:

     DFLAGS='-d-version=explain' dub test ...

...but DFLAGS does not seem to be honored. In fact I wouldn't 
mind adding a builtType to my dub.sdl (but then will it be 
inherited by the subpackages) but I don't see how to specify 
flags there either...maybe because it tries to hide variations in 
compiler switches?

J-L
Jul 18
parent reply Guillaume Piolat <contact spam.com> writes:
On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy wrote:
 Hi,

 I want to add a few flags while building with dub. I tried:

     DFLAGS='-d-version=explain' dub test ...

 ...but DFLAGS does not seem to be honored. In fact I wouldn't 
 mind adding a builtType to my dub.sdl (but then will it be 
 inherited by the subpackages) but I don't see how to specify 
 flags there either...maybe because it tries to hide variations 
 in compiler switches?

 J-L
Use "dflags" or "lflags" (linker)
Jul 18
parent reply Jean-Louis Leroy <jl leroy.nyc> writes:
On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat wrote:
 On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy 
 wrote:
 Hi,

 I want to add a few flags while building with dub. I tried:

     DFLAGS='-d-version=explain' dub test ...

 ...but DFLAGS does not seem to be honored. In fact I wouldn't 
 mind adding a builtType to my dub.sdl (but then will it be 
 inherited by the subpackages) but I don't see how to specify 
 flags there either...maybe because it tries to hide variations 
 in compiler switches?

 J-L
Use "dflags" or "lflags" (linker)
It doesn't work either... dflags='-d-version=explain' dub --vverbose test openmethods:benchmarks --build release --force Using dub registry url 'http://code.dlang.org/' Refreshing local packages (refresh existing: true)... Looking for local package map at /var/lib/dub/packages/local-packages.json Looking for local package map at /home/jleroy/.dub/packages/local-packages.json Determined package version using GIT: openmethods 0.0.1+commit.5.g94ad5a9 Refreshing local packages (refresh existing: false)... Looking for local package map at /var/lib/dub/packages/local-packages.json Looking for local package map at /home/jleroy/.dub/packages/local-packages.json Collecting dependencies for openmethods Building package openmethods:benchmarks in /home/jleroy/dev/d/methods.d/benchmarks/ Refreshing local packages (refresh existing: false)... Looking for local package map at /var/lib/dub/packages/local-packages.json Looking for local package map at /home/jleroy/.dub/packages/local-packages.json Collecting dependencies for openmethods:benchmarks Adding local /home/jleroy/dev/d/methods.d/ Found dependency openmethods >=0.0.0 ../ Collecting dependencies for openmethods Checking for missing dependencies. Configurations used for dependency resolution: openmethods (0): [invalid, 0.0.1+commit.5.g94ad5a9] Interation (ci=0) openmethods invalid (C) Interation (ci=-1) openmethods 0.0.1+commit.5.g94ad5a9 Refreshing local packages (refresh existing: false)... Looking for local package map at /var/lib/dub/packages/local-packages.json Looking for local package map at /home/jleroy/.dub/packages/local-packages.json Collecting dependencies for openmethods:benchmarks Adding local /home/jleroy/dev/d/methods.d/ Found dependency openmethods >=0.0.0 ../ Collecting dependencies for openmethods Checking for upgrades. Using cached upgrade results... Package methods can be installed with version 0.0.1. Use "dub upgrade" to perform those changes. Add config openmethods library Add config openmethods:benchmarks Including openmethods:benchmarks -> openmethods library openmethods:benchmarks -> openmethods library Using configuration 'library' for openmethods Using configuration '' for openmethods:benchmarks Add config openmethods library Add config openmethods:benchmarks application Including openmethods:benchmarks application -> openmethods library openmethods:benchmarks application -> openmethods library Using configuration 'library' for openmethods Using configuration 'application' for openmethods:benchmarks Creating build generator. Add config openmethods:benchmarks application Add config openmethods library Including openmethods:benchmarks application -> openmethods library openmethods:benchmarks application -> openmethods library Using configuration 'application' for openmethods:benchmarks Using configuration 'library' for openmethods Gathering build settings for openmethods:benchmarks (application) Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/benchmarks.d Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/ Executable configuration "application" of package openmethods:benchmarks defines no main source file, this may cause certain build modes to fail. Add an explicit "mainSourceFile" to the package description to fix this. Gathering build settings for openmethods (library) Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/ Configuration 'application' does not output a library. Falling back to "dub -b unittest -c application". Add config openmethods:benchmarks application Add config openmethods library Including openmethods:benchmarks application -> openmethods library openmethods:benchmarks application -> openmethods library Using configuration 'application' for openmethods:benchmarks Using configuration 'library' for openmethods Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/openmethods.d Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/ Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ . Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/benchmarks.d Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/ Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ . Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/benchmarks.d Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/ Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ . Generate target openmethods:benchmarks (executable /home/jleroy/dev/d/methods.d/benchmarks openmethods_benchmarks) Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/openmethods.d Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/ Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ . Generate target openmethods (staticLibrary /home/jleroy/dev/d/methods.d openmethods) openmethods: ["openmethods"] openmethods:benchmarks: ["openmethods:benchmarks", "openmethods"] Performing "release" build using ldc2 for x86_64. openmethods 0.0.1+commit.5.g94ad5a9: building configuration "library"... ldc2 -lib -of.dub/build/library-release-linux.posix-x86_64-ldc_0-D62368700F7DBA2BBAD9A3866E6CA 78/libopenmethods.a -release -enable-inlining -O -w -oq -od=.dub/obj -d-version=Have_openmethods -Isource/ source/openmethods.d Copying target from /home/jleroy/dev/d/methods.d/.dub/build/library-release-linux.posix-x86_64-ldc_0-D62368700F7DBA2BBAD9A3866E6CA 78/libopenmethods.a to /home/jleroy/dev/d/methods.d openmethods:benchmarks 0.0.1+commit.5.g94ad5a9: building configuration "application"... ldc2 -ofbenchmarks/.dub/build/application-release-linux.posix-x86_64-ldc_0-843E89F34C0F2CD241BED2A7781E4811/op nmethods_benchmarks -release -enable-inlining -O -w -oq -od=.dub/obj -d-version=Have_openmethods_benchmarks -d-version=Have_openmethods -Ibenchmarks/source/ -Isource/ benchmarks/source/benchmarks.d libopenmethods.a Copying target from /home/jleroy/dev/d/methods.d/benchmarks/.dub/build/application-release-linux.posix-x86_64-ldc_0-843E89F34C0F2CD241BED2A7781E4811/op nmethods_benchmarks to /home/jleroy/dev/d/methods.d/benchmarks Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/openmethods.d Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ source/ Fixing relative path: /home/jleroy/dev/d/methods.d/ ~ . Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/benchmarks.d Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ source/ Fixing relative path: /home/jleroy/dev/d/methods.d/benchmarks/ ~ . Running ./benchmarks/openmethods_benchmarks Using ldc2... ...
Jul 18
next sibling parent Jean-Louis Leroy <jl leroy.nyc> writes:
On Tuesday, 18 July 2017 at 20:12:13 UTC, Jean-Louis Leroy wrote:
 On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat 
 wrote:
 On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy 
 wrote:
 Hi,

 I want to add a few flags while building with dub. I tried:

     DFLAGS='-d-version=explain' dub test ...

 ...but DFLAGS does not seem to be honored. In fact I wouldn't 
 mind adding a builtType to my dub.sdl (but then will it be 
 inherited by the subpackages) but I don't see how to specify 
 flags there either...maybe because it tries to hide 
 variations in compiler switches?

 J-L
Use "dflags" or "lflags" (linker)
It doesn't work either...
The Source holds all the answers ;-) DFLAGS='-d-version=explain' dub test openmethods:benchmarks --build '$DFLAGS' ... Performing "$DFLAGS" build using ldc2 for x86_64. ...
Jul 18
prev sibling parent Moritz Maxeiner <moritz ucworks.org> writes:
On Tuesday, 18 July 2017 at 20:12:13 UTC, Jean-Louis Leroy wrote:
 On Tuesday, 18 July 2017 at 20:00:48 UTC, Guillaume Piolat 
 wrote:
 On Tuesday, 18 July 2017 at 19:49:35 UTC, Jean-Louis Leroy 
 wrote:
 Hi,

 I want to add a few flags while building with dub. I tried:

     DFLAGS='-d-version=explain' dub test ...

 ...but DFLAGS does not seem to be honored. In fact I wouldn't 
 mind adding a builtType to my dub.sdl (but then will it be 
 inherited by the subpackages) but I don't see how to specify 
 flags there either...maybe because it tries to hide 
 variations in compiler switches?

 J-L
Use "dflags" or "lflags" (linker)
It doesn't work either...
It's a build setting [1], not a command line option, you set it in the package file (dub.json/dub.sdl)... https://code.dlang.org/package-format?lang=json#build-settings
Jul 18