Repository: mesonbuild/meson

Issue:
[d] empty include directory when using include_directories('.') in meson.source_root()

**Describe the bug**
In my D project I need to always have the root source dir as an include-directory.
Thus I did
```
 project_dep = declare_dependency(
    include_directories: ['.'],
)
```

and use it like this: 
```
bix_lib = library(
	'bix',
	['bix.d'],
    dependencies: [ project_dep]
)
```

But I get the following error using ldc:
```
ldc2 -I=ex/mod/libbx.so.p -I=ex/mod -I=../ex/mod -I= -I=.. -I=subprojects -I=../subprojects -enable-color -wi -g -d-debug -relocation-model=pic -makedeps=ex/libbx.so.p/bx.d.o.deps -of=ex/libbx.so.p/bx.d.o -c ../ex/bx.d
Error: Expected argument to '-I'
```

**To Reproduce**
Attached a tar ball reproducing the issue for me.
[meson_issue.tar.gz](https://github.com/mesonbuild/meson/files/7153466/meson_issue.tar.gz)
**Expected behavior**
-I=. instead of -I=

**system parameters**
* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)?
plain native
* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
 linux (arch)
* what Python version are you using e.g. 3.8.0
python 3.9.6
* what `meson --version`
 meson --version
0.58.1



Discussion:

Resolving patch:
diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py
--- a/mesonbuild/compilers/d.py
+++ b/mesonbuild/compilers/d.py
@@ -105,6 +105,8 @@ def get_linker_output_args(self, outputname: str) -> T.List[str]:
         return ['-of=' + outputname]
 
     def get_include_args(self, path: str, is_system: bool) -> T.List[str]:
+        if path == "":
+            path = "."
         return ['-I=' + path]
 
     def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str],


Test patch:
diff --git a/test cases/d/12 root include directory/meson.build b/test cases/d/12 root include directory/meson.build
new file mode 100644
--- /dev/null
+++ b/test cases/d/12 root include directory/meson.build	
@@ -0,0 +1,7 @@
+project('some', 'd')
+
+project_dep = declare_dependency(
+    include_directories: ['.'],
+)
+subdir('some')
+
diff --git a/test cases/d/12 root include directory/some/dlang/code.d b/test cases/d/12 root include directory/some/dlang/code.d
new file mode 100644
--- /dev/null
+++ b/test cases/d/12 root include directory/some/dlang/code.d	
@@ -0,0 +1,7 @@
+void foo() {} 
+
+version (Windows)
+{
+    import core.sys.windows.dll;
+    mixin SimpleDllMain;
+}
diff --git a/test cases/d/12 root include directory/some/dlang/meson.build b/test cases/d/12 root include directory/some/dlang/meson.build
new file mode 100644
--- /dev/null
+++ b/test cases/d/12 root include directory/some/dlang/meson.build	
@@ -0,0 +1,8 @@
+code_lib = library('code',
+    ['code.d'],
+    dependencies: [project_dep])
+
+code_dep = declare_dependency(
+    link_with: code_lib,
+    dependencies: project_dep
+)
\ No newline at end of file
diff --git a/test cases/d/12 root include directory/some/meson.build b/test cases/d/12 root include directory/some/meson.build
new file mode 100644
--- /dev/null
+++ b/test cases/d/12 root include directory/some/meson.build	
@@ -0,0 +1 @@
+subdir('dlang')
\ No newline at end of file