DUB: Sometimes generates .di file and sometimes do not.

BoQsc vaidas.boqsc at gmail.com
Sun Nov 5 19:43:07 UTC 2023


Configuration to generate only `.di` (D Header file)

```
name "dheaders"
description "generates .di header file for a static library."
authors "public domain"
copyright "Public Domain. No rights reserved."
license "public domain"

configuration "staticLibrary" {
	dflags "-Hf=$PACKAGE_DIR/builds/library.di"
	targetName "library"
	targetType "library"
	targetPath "builds"
	sourceFiles "library.d"	
	extraDependencyFiles "$PACKAGE_DIR/builds/library.di"
	dflags "-o-"
}
```





[-o- Suppress generation of object file. Useful in conjuction 
with -D or -H 
flags.](https://dlang.org/dmd-windows.html#switch-o-)

Similarly [`buildOptions 
"syntaxOnly"`](https://dub.pm/package-format-sdl#build-options) 
can also be used in-place of `dflag "-o-"` they are 
correspondingly the same.


```
configuration "staticLibrary" {
	dflags "-Hf=$PACKAGE_DIR/builds/library.di"
	targetName "library"
	targetType "library"
	targetPath "builds"
	sourceFiles "library.d"	
	extraDependencyFiles "$PACKAGE_DIR/builds/library.di"
	buildOptions "syntaxOnly"
}
```


More information about the Digitalmars-d-learn mailing list