Open takinutani opened 1 year ago
This is related to the following post in the forum. Dub option for specifying importC include paths
The compiler is not setting options for the C preprocessor even though "cImportPaths" is set in dub.json. In the following code, Lack of append -P when editing DFlag.
-P
settings.addDFlags(settings.cImportPaths.map!(s => "-I"~s)().array());
at
dub/1.34.0/dub/source/dub/compilers/dmd.d(255,32): settings.addDFlags(settings.cImportPaths.map!(s => "-I"~s)().array()); dub/1.34.0/dub/source/dub/compilers/gdc.d(114,32): settings.addDFlags(settings.cImportPaths.map!(s => "-I"~s)().array()); dub/1.34.0/dub/source/dub/compilers/ldc.d(135,32): settings.addDFlags(settings.cImportPaths.map!(s => "-I"~s)().array());
dub.json
{ "name": "test", "cImportPaths": ["include_path"] }
(base) PS D:\labo\dlang\work\test> D:\scoop\user\apps\dmd\2.105.1\windows\bin\dub.exe build -v --compiler=dmd Building test ~master: building configuration [application] [cwd=D:/labo/dlang/work/test] dmd -m64 -c -ofC:\Users\kinut\AppData\Local\dub\cache\test\~master\build\application-debug-wwJttrcyM7Ir6TFENv5q2A\test.obj -debug -g -w -version=Have_test -Isource -Iinclude_path source\app.d -vcolumns
(base) PS D:\labo\dlang\work\test> D:\scoop\user\apps\ldc\1.34.0\bin\dub.exe build -v --compiler=ldc2 Building test ~master: building configuration [application] ldc2 -c -ofC:\Users\kinut\AppData\Local\dub\cache\test\~master\build\application-debug-GclWdmZTTjBXFPnUBK5wPg\test.obj -d-debug -g -w --oq -od=C:\Users\kinut\AppData\Local\dub\cache\test\~master\build\application-debug-GclWdmZTTjBXFPnUBK5wPg/obj -d-version=Have_test -Isource -Iinclude_path source\app.d -vcolumns
dmd --help
(base) PS D:\labo\dlang\work\test> dmd --help -P=<preprocessorflag> pass preprocessorflag to C preprocessor
In dmd, -Iinclude_path should be -P=-Iinclude_path
-Iinclude_path
-P=-Iinclude_path
ldc2 --help
(base) PS D:\labo\dlang\work\test> ldc2 --help -P <cppflag> - Pass <cppflag> to C preprocessor
In ldc, -Iinclude_path should be -P-Iinclude_path
-P-Iinclude_path
In gdc, it appears -Iinclude_path works, though it is undocumented
This is related to the following post in the forum. Dub option for specifying importC include paths
System information
Bug Description
The compiler is not setting options for the C preprocessor even though "cImportPaths" is set in dub.json. In the following code, Lack of append
-P
when editing DFlag.at
How to reproduce?
dub.json
Expected Behavior
dmd --help
In dmd,
-Iinclude_path
should be-P=-Iinclude_path
ldc2 --help
In ldc,
-Iinclude_path
should be-P-Iinclude_path