Open w0rp opened 9 years ago
I think should handle that in dmd.conf by specifying suitable import paths for the compiler.
@etcimon : How do you currently do this ?
In ldc2.conf you have this:
{
[..]
// default switches appended after all explicit command-line switches
post-switches = [
"-I%%ldcbinarypath%%/../import",
];
// default switches injected before all explicit command-line switches
switches = [
"-defaultlib=phobos2-ldc,druntime-ldc",
];
[..]
};
So basically you need to replace this with post-switches = [ ]
, and remove -defaultlib
switch, and then in dub.sdl/dub.json you will have
sourcePaths "druntime/core" "druntime/rt"
sourceFiles "druntime/object.d"
importPaths "druntime"
Where druntime is the folder containing your version of std/core/rt folders, and every subproject needs to have importPaths
manually set to this folder too. Unfortunately you don't have any way of setting importPaths: "$dependency:name/druntime"
so it only works if you clone and setup your project relatively. Also dub doesn't handle setting up the ldc2/dmd configurations for it :)
I was just experimenting with using DUB to build a project which uses a minimal druntime. I had the idea of creating a minimal druntime as a sourceLibrary, and creating another project which uses a cross compiler and which uses the minimal druntime as a dependency.
I ran into a snag in that DUB compiles a file with the compiler in order to determine the build environment. However, if the compiler has no druntime of its own, then the step where the build environment is determined fails. I suppose the 'dflags' setting could be changed in the
dub.json
file to include the PATH to the alternate runtime, but that's not so attractive.Is it possible to support this kind of build with DUB? Is there some way a package can be configured currently to support this that I missed? It would be kind of cool to build minimal D projects with DUB. I really hate setting import paths and writing
Makefile
s...