craftr-build / craftr-build-4.x

Frontend for the Craftr build framework.
https://craftr-build.github.io/craftr/
Other
60 stars 14 forks source link

Auto Dependency support for all supported compilers #2

Closed NiklasRosenstein closed 8 years ago

NiklasRosenstein commented 9 years ago

GCC and Clang support the -MMD -MF <filename>.d option. This will be more complicated with MSVC as it can only output the included headers files to stdout using the /showIncludes option. Ninja is capable of taking that into account as well, but we need to figure the include prefix from the current compiler, we can't assume everybody has an english version of the compiler installed.

More information here: Ninja auto dependencies

NiklasRosenstein commented 8 years ago

For GCC and Clang we can use the options -MMD -MF $out.d to generate a dependency file (a subset of GNU Make). However, for MSVC, we have to use the /showIncludes option which outputs the include files to the console. For non-english versions of MSVC, the global variable msvc_deps_prefix must be set in NInja.

We could implement this by providing a ninja Craftr module in which all members are directly translated to global variables in Ninja. The ninja.msvc_deps_prefix could be adjusted via the command-line or from the compiler.msvc module.