Bye bye, fast compilation times

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Feb 7 01:27:08 UTC 2018


On Wed, Feb 07, 2018 at 01:22:02AM +0000, Andres Clari via Digitalmars-d wrote:
[...]
> Is there some tutorial or example for using SCons with dub
> dependencies?

Not that I know of.  Basically what I did was:

- Create a dummy dub project in a subdirectory, containing a dummy
  source file containing an empty main().

- Declare whatever dub dependencies you need in this dummy project.

- Run `dub build -v` inside this subdirectory to make dub fetch
  dependencies, build libraries, etc..

- Parse the output, esp. the last few lines that show which include
  paths, linker flags, and libraries are required to build the main
  program.

- Specify these include paths, linker flags, and libraries in your
  SConstruct file for building your real project.

- Build away.

- If you need to refresh dependencies, go into the dummy project and run
  `dub build --force` to rebuild all dependencies, then run scons in
  your real project.

Arguably, some/all of the above could be automated by SCons. Though the
whole point is to *not* run dub every single time you build, so I'd keep
them separate, or as a non-default build target that only triggers when
you explicitly want it to.

Also, none of this is specific to SCons; you could use whatever other
build system you wish with the above steps.


T

-- 
This sentence is false.


More information about the Digitalmars-d mailing list