On Sat, 05 Jan 2019 17:44:27 +0000, Neia Neutuladh wrote: > 2. Different build configurations. The same source code has two > different build targets; the executable doesn't depend on the library. > Or, with enough bludgeoning, you can make the executable depend on the > library.
Hit 'send' too soon. The build configuration way would be: --- # dub.sdl configuration "exe" { targetType "executable" } configuration "lib" { targetType "staticLibrary" excludedSourceFiles "src/cli/*" } --- Then you'd build with: dub build --config=lib dub build --config=exe To make this version of things yield an executable depending on a library, you'd use something like: --- # dub.sdl configuration "exe" { targetType "executable" excludedSourceFiles "src/lib/*" importPaths "src/lib" libs "-L." "-L-l:libmyproject.so" } configuration "lib" { targetType "sharedLibrary" excludedSourceFiles "src/cli/*" } --- The one advantage of this is being able to use shared libraries. It's awkward.